• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

My Monkey Do

A Log of Coding Solutions

  • Home
  • Web Hosts
  • Tools
  • About

php

Media Uploader Crunching Issue

April 10, 2012 by Webhead

Problem

WordPress has a bug.  When uploading an image (even a small,  1KB image) the Media uploader stalls and freezes in when Crunching is 100%.   This problem happens in both the flash and html uploader.  In the HTML uploader you can see a 500 Internal Server Error.

 

Solution

There are 2 different problems that can cause this issue.

One is your server or hosting provider.  GoDaddy has since said they have fixed this issue.  However, when I contacted support they said to disable Fast CGI for PHP.  I responded with a link to the article above.  They then helped me out by telling me to update my php5.ini or php.ini file.   You’ll find that this solution was found on the WordPress forums also where you set the memory_limit and max_execution_time higher.  So in your php.ini or php5.ini if you use php5 (that’s important!  trust me, I’ve been frustrated with that before) add the following lines:
max_execution_time = 600
memory_limit =128M
upload_max_filesize = 2M

Adjust as needed.  You may also have to End your Web Process to quickly see changes.  See godaddy support forums for this.

The 2nd issue with this bug is a more frustrating and disappointing one.  I found out that WordPress uses the delete_posts capability to determine whether a user can delete a media file or not.  Well, guess what, it also uses the edit_posts capability when it crunches the file too.  So if you have a problem where only the Administrator can upload media files fine, check your user’s capabilities.  On a side note, to delete media the user needs the delete_posts capability.

 

 

 

Filed Under: Coding Tagged With: goDaddy, hosting, php, wordpress

WordPress Custom Types

March 22, 2012 by Webhead

Below is a great example on creating custom post types and also not using the edit_posts capability.

Blog: http://www.jsterup.com/dev/wordpress/custom-post_type-without-edit_post-capability

Code: http://pastebin.com/FfftYVYS

Filed Under: Coding Tagged With: php, wordpress

Creating a New Yii Application – Quick Reference

January 25, 2012 by Webhead

This post is here to remind me how to create a Web application using the Yii framework.   It will be updated from time to time.  This is assuming the yii framework is inside WebRoot

Here is how to create a new webapp named “sampleApp”.

Open your command prompt or Terminal
cd WebRoot
php YiiRoot/framework/yiic.php webapp sampleApp

configure the config files located at:
sampleApp/protected/config/main.php
sampleApp/protected/config/test.php

Now edit test.php and override your test database connection by entering info into the ‘db’ array item.

 

Filed Under: Coding Tagged With: php, yii

PHP ini overriding

January 23, 2012 by Webhead

On shared hosts, overriding the php.ini file can be frustrating.  Sometimes it works, sometimes it doesn’t.  It’s up to the host provider.   This post will keep a record of what hosts need what type of requirements and will be updated from time to time.  This overriding php.ini file can be a partial override like so:

[PHP]
; Maximum size of POST data that PHP will accept.
post_max_size = 20M
; Maximum allowed size for uploaded files.
upload_max_filesize = 20M

 

GoDaddy

The php.ini file needs to be named php5.ini if you are using PHP version 5.x.  Sometimes you’ll need to restart the web process in the control panel.  It is located under the “System Processes” icon.   Once in System Processes click on “End Web”.

Filed Under: Server Stuff Tagged With: goDaddy, hosting, php

WordPress pagination

January 11, 2012 by Webhead

Just wanted to post this because of  a great pagination solution I found for WordPress blog posts.  It is beautiful and robust.  It should be in wordpress itself.

 

http://www.ericmmartin.com/pagination-function-for-wordpress/

keywords:  next_posts_link wordpress pagination

Filed Under: Coding Tagged With: php, wordpress

get_permalink returning wrong link in excerpt

December 1, 2011 by Webhead

Problem

In WordPress, the default theme, twenty_eleven, has a function called twentyeleven_continue_reading_link.  This method is supposed to return the permalink for the current excerpt.  However if you use setup_postdata() and call the_excerpt() the permalink will return the current page’s permalink, not the excerpt’s permalink.

 

Solution

The reason it returns the current page’s permalink is because get_permalink() gets the permalink for $post which is the current page.  To resolve this, I looked in setup_postdata to see what it is doing.  setup_postdata is setting a global $id variable each time you call it.  This means that same $id variable is the excerpts id.  Which means in the twentyeleven_continue_reading_link method, instead of calling get_permalink(), you can declare the global $id variable and call get_permalink($id).  See the updated method below.

 

function twentyeleven_continue_reading_link() {
        global $id;
        return ' ' . __( 'Continue reading →', 'twentyeleven' ) . '';
}

Filed Under: Coding Tagged With: cms, php, wordpress

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 4
  • Go to page 5
  • Go to page 6
  • Go to page 7
  • Go to page 8
  • Go to Next Page »

Primary Sidebar

Topics

apache apple bootstrap buddypress chrome cloudways cms css debug drupal eCommerce firebug firefox git gmail goDaddy google hosting htaccess html html 5 IE crap image iPad iPhone javascript jquery kinsta linux localization mac os x ms sql mysql open source optimize php php 7.2 svg tinymce woocommerce wordpress wpengine xss yii youtube




Categories

  • Coding
  • Off the Shelf
  • Plugins
  • Random Thoughts
  • Server Stuff
  • Tools
  • Uncategorized