Apache PHP and Mysql on Leopard

Leopard, Tips, how-to 80 Comments

Leopard brings one big change to web developers working with Apache, PHP and Mysql on the Mac. Apache 2 comes with Leopard along with PHP 5.

Here is what to do to restore a test environment.

First, you need to enable PHP.

Apache’s .conf file moved from /private/etc/httpd/httpd.conf to /private/etc/apache2/httpd.conf

Open this file with your favorite text editor and uncomment the line:

# LoadModule php5_module libexec/apache2/libphp5.so

You don’t need to add the mime type for php, because it’s already done for you under leopard. The last line in the .conf file is:

Include /private/etc/apache2/other/*.conf

The ‘other’ directory contains a .conf file for php5. That takes care of the mime type and the index.php configuration for php sites.

If you develop multiple sites and you need virtual hosting functionality, scroll down to the end of the .conf file and uncomment the following:

# Include /private/etc/apache2/extra/httpd-vhosts.conf

That’s all the modification that I had to make to to the httpd.conf file.

Next, you’ll need to setup whatever virtual hosts you have in the virtual hosts file /private/etc/apache2/extra/httpd-vhosts.conf

For example, for each line that you set up in your hosts file like so:

beta-site-1.com 127.0.0.1

You need to make an entry in the httpd-vhosts.conf file like so:

<VirtualHost *:80>
   ServerName beta-site-1.com
   ServerAlias www.beta-site-1.com
   ServerAdmin webmaster@beta-site-1.com

   DocumentRoot "/Library/WebServer/beta-site-1"
   ScriptAlias /cgi-bin/ "/Library/WebServer/beta-site-1/cgi-bin"
   <Directory "/Library/WebServer/beta-site-1">
     Options FollowSymLinks MultiViews Includes
     AllowOverride All
     Order allow,deny
     Allow from all
   </Directory>
</VirtualHost>

One good thing is that the ‘upgrade’ install of Leopard does not mess with your hosts file, so whatever virtual domains you may have set up won’t be affected.

If you had Mysql installed previously, good news too, Leopard’s installer won’t touch it. I found mysqld running just like before the upgrade.

One thing changed with Leopard is the socket for Mysql. It moved to /private/tmp, so you may need to configure your php.ini file to point it to the new location.

To do so, open the file ‘/private/etc/php.ini‘, (if no such file exists, then make a copy of ‘/private/etc/php.ini.default‘ naming it ‘php.ini‘) and edit that.

You have two lines to modify:

mysql.default_socket =

becomes:

mysql.default_socket = /private/tmp/mysql.sock

and mysqli.default_socket =

becomes:

mysqli.default_socket = /private/tmp/mysql.sock

of course, from the sharing pref pane, stop the server and restart it and voila!

80 Comments

Leopard has landed on my iMac!

Leopard Be the first to Comment

Well, I finally took the plunge. After yesterday’s problems installing it on my iBook, I took all the precautions that I can and took the plunge and installed it on my iMac.

Steps:

  • Buy a 1 TB drive from Costco.
  • Plug it in and realize it’s dead.
  • Exchange 1TB drive at Costco.
  • Plug it in and it works!
  • Check main drive using DiskWarrior
  • Make a bootable backup using Superduper
  • Install Leopard by doing an ‘Upgrade’ install.

Done!

All my settings seem to be working. Had a hiccup with my keychain. For whatever reason Leopard didn’t read it properly. But strangely, even though I created a new keychain with the same name, the new - supposedly empty - keychain had all my old passwords!

I haven’t bumped into any incompatibility yet with any of the software that I use regularly:

  • Path Finder
  • BBEdit
  • PowerMail
  • Interarchy
  • Hogwasher
  • Vienna
  • Adium
  • SpamSieve
  • Ulysses
  • Photoshop

So far so good. The only thing that needed work to get it back up to its previous working status was my Apache/PHP/Mysql.

Be the first to Comment

Leopard second impression

Leopard, Software Review Be the first to Comment

Well, after my first attempt at installing Leopard by doing a normal ‘Update’ on the previous system, I couldn’t get the Finder to respond, no matter what I did.

I changed strategy and re-installed by doing an ‘Erase and Install’.

‘Erase and install’ worked perfectly.

It took about 45 minutes to install from scratch, excluding all printer drivers. I don’t use the laptop for anything other than managing the site, internet access and email while on the road; so printing is not needed at all. That saves nearly 3 GB of hard disk space.

After that I went through the step by step setup and created my user account and internet setup. Everything went smoothly. Setting the system’s preferences to my own settings took about 20 minutes.

My main reason for this test install is to test if my site management software works with the new system. Great news for me, it works flawlessly.

I performed few tests. In each instance my software downloaded and extracted submissions; formatted them and re-uploaded them to the server. So from that point of view, my mind is at ease with regards to leopard. Everything else on my system is not crucial. Even if there were some bugs, they won’t matter much. The important things work.

I’m still not sure about upgrading the iMac. I can’t do an erase and install on it without wasting few days getting back to my old setup. I may try the archive and install option instead.

For the record, this is the first time an ‘update’ style upgrade of any version of the Mac OS fails. I’ve been a Mac user for the last 22 years. Also, this is the first time I ever attempted to do an upgrade on a system that barely meets the minimum hardware requirements for the new system. So that may have something to do with the failure.

Leopard is a very slick cat so far.

Be the first to Comment

Leopard first impression

Leopard 3 Comments

Today, at 10:30 am EDT, the Purolator guy dropped off the tiny package. Leopard is packaged in what have recently become Apple’s standard software package. A box barely larger than the DVD is housing the new system, along with a small booklet.

At 10:40 I had started the install on my non-essential iBook (G4, 1.42 Ghz 512 MB of RAM). With its paltry 512 MB memory, the iBook meets the minimum system requirement for Leopard.

It took 20 minutes to verify that the installation DVD is good (a good thing to do on the first use of the DVD). Total installation time on the iBook one hour and 28 minutes. The last minute (that’s when the installer progress bar reports ‘about 1 minute remaining) lasted about 18 actual minutes.

Once the installer was done, the iBook booted to the log in screen in three minutes.

From the log in screen to the Setup Assistant, 2 min, 40 sec.

After the smooth sailing through the installation and the reboot and the setup assistant, things became frustrating.

When the setup assistant declared that everything was done, including registration, the main menu bar showed up, the Dock showed up but the Finder was completely non-responding. I clicked Safari’s icon in the Dock and it launched, connected to the net and worked perfectly. First impression of Safari (3.04) is that it’s blazing fast, even on a busy, minimal machine.

The Finder still not responding.

I launched Terminal and started ‘top’. It reported no processor activity on the Finder, but the ‘mds’ and ‘mdworker’ were going crazy (mds is the main process for Spotlight and it launches an ‘mdworker’ process each time it needs to index something). Spotlight was re-indexing the drive.

By mistake, I clicked on the new ‘Downloads’ folder in the new Dock and the Dock became unresponsive. Not good so far.

I force quit the Finder and things improved a bit. Quicksilver launched after the Finder reloaded. The Dock is still stuck. I force quit that too. However, the Finder is still non-responsive.

It seems the Finder won’t respond until Spotlight is finished indexing the main drive (60 GB). That’s a crappy design if it is intentional.

After an hour or so, I lost patience and force rebooted the computer (the shutdown and restart menu items produced no results).

I rebooted the laptop using the installation DVD and checked the drive. All clear.

Rebooted again and this time the menu bar didn’t show up and the dock is non responsive. I can’t launch anything else. I can hear the hard disk whirring away. Spotlight indexing is proceeding.

I clicked on the Spotlight icon in the non-existant menu bar and it showed a panel telling me about Spotlight and showing a progress bar reporting 2 hours left of indexing.

So, so far, not very encouraging. The laptop doesn’t have any documents on it. So if indexing is taking this long on the system files and the applications (mostly standard), then I would be very, very hesitant to install it on my iMac, which has millions of files on it.

So, to sum it up: Leopard first impression on iBook 1.42 Ghz G4 with 512 MB of RAM: CRAP!

I’ll wait for Spotlight to finish and then try to get a second impression.

3 Comments

Next Entries »