Archive for November, 2007



How I fixed PHP and MySQL for WordPress after upgrading to Leopard

Under Tiger I had WordPress installed with PHP 5 (an installation from Entropy.ch) and MySQL 5 (from the MySQL web site). After upgrading to Leopard, my configuration went sour. Here’s the behavior I was seeing:

If I requested http://localhost (or http://127.0.0.1) in Safari I would correctly get the page confirming Apache was configured correctly. However, if I requested any of my previously created web sites in my Sites directory (or even my default page http://localhost/~smcandrew), I would get a Forbidden message. It sounded like a permissions error, but that wasn’t what turned out to be the problem. It turned out to be a handful of easy to fix configuration settings.

Here’s what I did to get everything back on track.

Enabling Leopard’s PHP 5 environment

PHP 5 installs with Leopard. The problem: it’s disabled by default.

  1. Note that Apache’s .conf file has been moved to a new location (it used to be at /private/etc/httpd/httpd.conf and is now located at /private/etc/apache2/httpd.conf).
  2. Open the httpd.conf file located at /private/etc/apache2/httpd.conf with your text editor of choice and find the following line:
    # LoadModule php5_module libexec/apache2/libphp5.so

    Uncomment the line, changing it to:

    LoadModule php5_module libexec/apache2/libphp5.so
  3. If you use virtual hosting, find the following line:
    # Include /private/etc/apache2/extra/httpd-vhosts.conf

    Uncomment the line, changing it to:

    Include /private/etc/apache2/extra/httpd-vhosts.conf
  4. Save the file

As a side note, if you are using virtual hosts, you may need to go set them up as you had before in your virtual hosts file (/private/etc/apache2/extra/httpd-vhosts.conf). The Upgrade of Leopard did not modify my virtual hosts, but if you find yourself having issues this is where you should look next.

Relocate your .conf file

In Apache 2.2 the .conf file for your user is stored in a new location. It’s easy enough to move it.

  1. The old location of your .conf file is /etc/httpd/users/[yourUserName].conf
  2. The location it needs to be in for Apache 2.2 is /etc/apache2/users/[yourUserName].conf
  3. To move the file:
    Open Terminal and type the following command inserting your user name where I have ’smcandrew’ (my user name):

    cp /etc/httpd/users/smcandrew.conf /etc/apache2/users/smcandrew.conf

Be sure your .conf file has what it needs for WordPress

My .conf file got lost in the shuffle when I upgraded. I’m not sure if this was due to my plodding around or if it was a victim of the Leopard upgrade. I had saved an older version of my .conf file and used the same settings it had in the new .conf file and everything was fine. To check your .conf file:

  1. With your favorite text editor, open your .conf file from the following directory (as mentioned above, yours will be called [yourUserName].conf):
    /etc/apache2/users/
  2. I had a stock .conf file (I’m assuming it was created during the upgrade). So, I changed the text in the .conf file to read:
    <directory>
    
    Options Indexes MultiViews FollowSymLinks
    
    AllowOverride All
    
    Order allow,deny
    
    Allow from all
    
    </directory>

    Again, exchange ’smcandrew’ for your user name

  3. Save the file

Where’s my MySQL socket?

During the Leopard upgrade it looks as though Tiger’s MySQL setup wasn’t mucked with at all. But, the location of the MySQL socket isn’t where it was in Tiger. So, I had to modify my php.ini file.

  1. Open up any text editor you like and open:
    /private/etc/php.ini
  2. Find the line that reads:
    mysql.default_socket =

    and change it to:

    mysql.default_socket = /private/tmp/mysql.sock
  3. Find the line that reads:
    mysqli.default_socket =

    and change it to:

    mysqli.default_socket = /private/tmp/mysql.sock
  4. Save the php.ini file

Note: if you have no php.ini file in the aforementioned directory, you should have a ‘php.ini.default’ file. Make a copy of this file, naming it php.ini, then execute the steps above.

Restart Apache and PHP and get started!

If your upgrade woes were the same as mine, everything should be back on track now. You can restart Apache, which will enable your new PHP settings. If you like Terminal, you likely already know the command (sudo apachectl restart). If you prefer not to use Terminal, you can open System Preferences > Sharing and uncheck the check beside “Web Sharing.” Then, check it again to restart.

That’s it. Things should be back up and running. Hope this helps!

Tags:, , , , , , , ,
Seeing anything you like?
You may want to subscribe to my RSS feed. Thanks for visiting!

Leopard Dock and Menu Bar user interface options

I installed Apple’s latest version of OS X, version 10.5 or “Leopard” last week. I’ll sideline the oh-so-popular debate about questionable UI changes in Leopard, and instead post quick ‘fixes’ I found regarding two things I wasn’t a fan of:

Change OS X Dock for Leopard

Not a fan of the new 3d dock? Try a 2d dock that is available but unfortunately not exposed as an option. Here’s all you need to do:

  1. Open the Terminal application located in your Applications > Utilities folder
  2. Type:
    defaults write com.apple.dock no-glass -boolean YES

    killall Dock

The first line requests that a 2d rendition of the Dock be used. The second line terminates and then restarts all instances of the Dock.

Change Leopard’s Translucent Menu Bar

The Apple hacking community has yet to find a quick Terminal command to revert to an opaque Menu Bar. What can be done is a quick modification to your Desktop Wallpaper which will achieve the same effect. Some have scoffed at this method. My take? It’s clever and easy: thumbs up.

Tags:, , , , , , , ,
Apple iTunes
Close
E-mail It