My Tips To You

  • strict warning: Non-static method view::load() should not be called statically in /home/webdevde/public_html/sites/all/modules/contrib/views/views.module on line 906.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/webdevde/public_html/sites/all/modules/contrib/views/handlers/ on line 0.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/webdevde/public_html/sites/all/modules/contrib/views/handlers/ on line 0.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/webdevde/public_html/sites/all/modules/contrib/views/handlers/ on line 0.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home/webdevde/public_html/sites/all/modules/contrib/views/plugins/ on line 0.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/webdevde/public_html/sites/all/modules/contrib/views/plugins/ on line 0.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/webdevde/public_html/sites/all/modules/contrib/views/plugins/ on line 0.

Using MySQL Workbench with MAMP Pro

Your rating: None Average: 3 (1 vote)

I like MySQL and have been using each release of their GUI tools for Mac OS X and have slowly been getting used to the newer MySQL Workbench tool that replaced their previous GUI tools. I also use MAMP on some dev machines, so using both together is a must-do.

There is a way to setup MySQL Workbench with MAMP/MAMP Pro and these are the list of steps I did to get both apps to work together. There could be better ways so I'll update this post over time.

  1. Click "New Server Instance".
  2. Choose "localhost". Click Continue.

Tags: mac os x, mamp, MySQL

PHP performance optimization and tuning tips

Your rating: None Average: 4 (1 vote)

In my work PHP is a required part of most, if not all web sites I help with; especially Drupal. Here are tips I've collected along the way and of course YMMV (your mileage may vary).

PHP Tuning

  • Utilize Op-code caching like APC, eAccelerator, Xcache, or Zend Accelerator. APC is my favorite and has been reported as the most stable and has good performance.
  • Run PHP in FastCGI (FCGI) mode versus regular CGI methods, if possible. FCGI uses a socket to the PHP process, not forking.
  • Disable PHP extensions not needed.
  • Disable debug/development extensions on production & staging servers.

APC (Alternative PHP Cache)

The Alternative PHP Cache (APC) is a free and open op-code cache for PHP. The behavior of these functions is affected by settings in php.ini. The bundled apc.php script provides a detailed analysis of how APC is working.

  • Increase apc.shm_size higher than the default 30MB. Drupal sites use 64MB or higher; 96MB is usually good enough.
  • Increase apc.num_files_hint 1024 works for Drupal, some sites may need higher than the default 1000 and can go up to 20000. Start small first.
  • Increase apc.user_entries_hint the default 4096 can be enough, this is another that can go up to 20000 if ncessary.
  • Enable apc.enable_cli to help speed up PHP scripts that run via the command line.
  • Enabling apc.include_once_override speeds scripts up but be warned: updated and new files will not be cached until APC is flushed.
  • Enabling apc.rfc1867 provides upload progress data to PHP, giving better user experiences on web pages during large file uploads.
  • Leave apc.max_file_size at the default 1MB.
  • Carefully use apc.filters to exclude file extensions that should not be cached by APC.
  • Disabling apc.stat will boost speed but new/updated files will not be recognized unless APC cache is rebuilt. Do not try this for fun; advanced use only.

Tags: PHP

MySQL performance optimization and tuning tips

Your rating: None

In my work MySQL plays a big part of the dynamic web data chain, especially for many PHP based sites (like Drupal). Here are tips I've collected along the way and of course YMMV (your mileage may vary).

MySQL Tuning notes

  • Disable or remove any extensions (or modules) not being used.
  • Separate the database onto its own server (Master), and try to have a (Slave) copy as a backup or for redundancy.
  • Master-Master configurations are not easy.
  • Use EXPLAIN to dig into queries and find where optimizations can be made for performance.
  • Profile MySQL during development using the SET PROFILING flag. Enable profiling, query information_schema table to review results. Disable profiling when done.
  • Enable and tune the Query cache.
  • Enable Table cache.
  • Enable (or raise) Key buffer.
  • Enable Slow Query Log to find bottleneck queries.
  • Use MyISAM table types for fast reads, but stick with InnoDB for transactional data.

Tools, Utilities, and Resources

mysqltuner - -

Useful Commands



Tags: MySQL

Apache performance optimization and tuning tips

Your rating: None Average: 4 (1 vote)

In my work Apache can play a big part of the web serving chain, especially for most PHP based sites (like Drupal). Here are tips I've collected along the way. Of course YMMV (your mileage may vary).

Conf settings

These settings can be placed inside various places, the best would be in the *.cnf file for your domain or site. At worst this stuff can go inside httpd.conf which is the global configuration file for Apache.

Compress output of common text based files

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/js
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
AddOutputFilterByType DEFLATE text/html

... or in a shorter way...
AddOutputFilterByType DEFLATE text/plain text/xml application/xhtml+xml text/css text/javascript text/js application/xml image/svg+xml application/rss+xml application/atom_xml application/x-javascript application/x-httpd-php application/x-httpd-fastphp application/x-httpd-eruby text/html

Remove ETags

Header unset ETag
FileETag None

Easy changes

  • Disable or remove any extensions not used (like mod_perl if you only are using PHP).
  • Consider moving configuration overrides from .htaccess file(s) into *.cnf files

Tags: Apache, httpd

Bash history: Ignore duplicate commands

Your rating: None Average: 3 (1 vote)

When you get comfortable with bash shell commands you may at some point be annoyed with duplicate commands coming up and forcing you to scroll through those repetitive shell commands. To have your shell ignore duplicate commands and even ignore specific commands (like ls) then follow these quick tips:

Ignore duplicate bash shell commands

export HISTCONTROL=ignoreboth

Ignore a specific bash shell command

export HISTIGNORE="ls" (history will ignore the ls command)

Ignore multiple specific bash shell commands

export HISTIGNORE="ls:pwd:exit:mount" (history will ignore the ls, pwd, exit, and mount commands)

Tags: Mac, Unix, Linux

Bash history quick recall

Your rating: None Average: 4 (1 vote)

When using the command line, like Terminal for Mac OS X there are two quick ways to recall a command you entered previously. By using the Up & Down arrow keys on the keyboard allows you to scroll through your command history. When a command is much older than a minute or two ago then a auto-complete search is possible by pressing the Ctrl+R keys together and typing in any portion of a previous command. The auto-complete search is way cool; give it a try.

Tags: Mac, Unix, Linux

List all files, even hidden ones

Your rating: None Average: 3 (1 vote)

When administering a Linux/Unix computer, one of the most common (and important) commands is how to list the contents of a directory. On Linux/Unix, the following command will display all files in a directory, even if they are hidden.

ls -Flash

The command above has some flags set (otherwise known as parameters), which is the "-Flash" portion of the command. I prefer this set of flags, and in that order since it is easy to remember the word "Flash" versus random orders of each flash like "lhaFs". These set of flags I like show the list of files vertically with many attributes shown and colorful visual indicators.

Tags: Unix, Linux