Category Archives: WordPress

TPC! Memory Usage 0.9.1 released

After receiving countless emails from supportive users (some nice, some not so nice!), I put the TPC! Memory Usage project back on my ticker.  Despite the vast number of updates to WordPress since December 2010, the Memory Usage plugin has retained the top spot in its niche.  To this day, TPC! Memory Usage is used regularly with only one noticeable problem—a missing bar graph background in the dashboard widget.  As of release 0.9.1, the background has been fixed, and the compatibility data updated for WordPress 3.8.

So… what’s in store for the future?  First, I need to refactor the code to take care of a few notices outputted in debug mode.  In addition, some of the Zend Framework dependencies may be updated, or even eliminated.  Lastly, I’ll put my ear back to the community.  In other words, tell me what you want, and we’ll see what we can do to reach that goal!

Download TPC! Memory Usage 0.9.1 for WordPress

Using SSH instead of FTP for WordPress updates

Under certain server configurations and conditions, WordPress may require an FTP connection to retrieve and process core, plugin, and theme updates.  If you only see an option for FTP on this screen, do not despair.  You are not alone!  If a server is without the libssl2 library and PECL’s ssh2 package, the SSH2 option will not be listed.  While there are WordPress plugins that mimic this capability using various PHP libraries, implementations at the server level often provide better security and performance.

  1. Download libssh2 (C library implementing SSH2 protocol)
  2. At the command line, type the following
    # Unzip the libssh2 archive
    tar -xf libssh2-1.4.3.tar.gz
    
    # Change directory to libssh2 source
    cd libssh2-1.4.3
    
    # Compile libssh2
    ./configure
    make && make install
    
    # Install ssh2 PECL library
    pecl install ssh2-beta
    

After that, the SSH2 option should appear on the WordPress update screen.
WordPress SSH updates

TPC! Memory Usage: Honorable Mentions

I’m proud to say that TPC! Memory Usage for WordPress has been adopted by a lot of WordPress administrators out there, and initial reviews have been great.  Today, I found a few articles that TPC! users may find useful and interesting, including one which benchmarks popular WordPress plugins.

If we missed an article, please let us know so we can post it.  Thank you to everyone for your continued support!

Major improvements in TPC! Memory Usage for WordPress

Over the past few weeks, I’ve been actively developing some long-awaited TPC! Memory Usage features.  The highlights of the latest release are listed below.  I believe that these will help WordPress developers and administrators improve scalability and performance of their blogs and custom applications.

  • Custom checkpoints allow administrators to measure memory usage anywhere a WordPress action is available.
  • Optional file logging allows administrators to have an effective way of tracking memory usage.
  • Improved Security Check, and listed additional variables in System Overview.
  • Fixed various bugs (special thanks to those who have taken the time to report issues).

As we continue to improve TPC! Memory Usage and implement new features, we would love to hear your thoughts.  Feel free to leave a message on the official TPC! Memory Usage page.  As always, thank you for your continued support.

Download TPC! Memory Usage

10+ WordPress Functions Every Developer Should Know About

add_action($tag, $function_to_add, $priority, $accepted_args)
do_action($tag, $arg)

add_action() attaches a function to a specific action, which is then triggered by a do_action() call somewhere during execution. This can be used to execute a group of functions using the $priority parameter to determine order (optional), and arguments can be passed through the $accepted_args parameter. Below are a few examples of how this is used in the WordPress platform:

WordPress Logo

  • do_action(‘deleted_post’)
    This is executed after a post or page is deleted, and post or page ID is passed as a parameter.  This allows you add custom functionality whenever a post is deleted.  For example, lets say you want to be notified every time a post is deleted.  You can create a function to send the e-mail, and execute add_action(‘deleted_post’, ‘notify_when_deleted’, 10, $email). After that, when do_action(‘deleted_post’) is called, the notify_when_deleted() function will be called.
  • do_action(‘wp_head’)
    The wp_head action is traditionally called within a theme’s header.  If you wanted to create an SEO plugin, you could very easily add an action to wp_head to display meta tags. Continue reading 10+ WordPress Functions Every Developer Should Know About

jQuery Tablesorter helper function for WordPress

In one of my projects, I converted WordPress into a reporting engine, which is used at 20 car dealerships to track Internet sales.  During development, I found that I was writing the same code over and over again for the jQuery Tablesorter plugin, which allows you to sort tables using a simple JavaScript call.

First, I would have to queue the script file, then add the appropriate JavaScript. To ensure the JavaScript was executed at the right time, I had to create a function to use it with add_action().  I found this to be tedious and unnecessary, and wrote a simple helper function to remedy this.  The following function was added to /wp-admin/includes/template.php, but if you use it, it will most likely go in a plugin or theme include.  This will prevent it from being overwritten during WordPress upgrades. Continue reading jQuery Tablesorter helper function for WordPress

TPC! Memory Usage 0.4 for WordPress released!

We just released TPC! Memory Usage 0.4, which in addition to providing memory usage monitoring, provides WordPress users with a detailed System Info screen within the WordPress administration panel.  The system information screen includes information on web server, PHP, MySQL, and WordPress statuses and settings.  A link has been provided from the dashboard widget for easy access.  We also added additional information on the notification feature in the FAQ section on WordPress.org due to some confusion. Continue reading TPC! Memory Usage 0.4 for WordPress released!

WordPress memory usage reduced from 14MB to 1.4MB

About two weeks ago, I wrote a short article called eAccelerator reduces WordPress memory usage which outlined how I was able to reduce WP memory usage to 8MB.  While looking into the Zend Framework, I came across Zend Optimizer again, which I hadn’t messed with in a while.  I decided to install it on a whim.  The results were unexpected…

WordPress memory usage*
Standard PHP installation 14MB
eAccelerator 8MB
eAccelerator & Zend Optimizer 1.4MB
* WP memory usage recorded by TPC! Memory Usage

Continue reading WordPress memory usage reduced from 14MB to 1.4MB

WordPress Security: Primer & Advanced Techniques

WordPress is the most widely used open source blogging software in the world.  This didn’t happen overnight, and the developers over there have certainly earned their keep.  With any web application, especially a heavily used one, there are security risks and precautions we must take.  Without a security model and virtual barriers in place to protect us, it can be an all-out free-for-all for hackers. Continue reading WordPress Security: Primer & Advanced Techniques

How Zend Server CE breaks WordPress Permalinks and how to fix it

Recently, I switched to Zend Server CE from a manually installed AMP package (Apache/MySQL/PHP) to make use of Zend’s lightweight environment and easy install package. In doing this, I found that it broke the permalinks associated with WordPress.  Despite mod_rewrite being enabled, and the “Pretty Permalinks” code being in the .htaccess file, it still didn’t work.

404 Error

To fix this problem do the following:

  1. Open up httpd.conf.  (On Windows, the default location of this file is C:Program FilesZendApache2conf.)
  2. Find the line with <Directory />.
  3. Make sure +FollowSymLinks is present on the Options line.  (i.e. Options +FollowSymLinks)
  4. Change AllowOverride None to AllowOverride All.
  5. Restart Apache.

AllowOverride controls how .htaccess files are used.  When AllowOverride is set to None, users cannot override the configurations set in httpd.conf for particular directories.  While the .htaccess in this client’s WordPress directory was correct, Apache wasn’t allowing it to override the default settings as stated in httpd.conf.  It is definitely worth it to learn more about how to configure Apache so that you can have a secure and well-performing environment, especially if a lot of developers work on the same production server.

If you have similar experience, we would love to hear what you have to say.  Perhaps it will save someone else a minute or even a few hours.