Professional PHP

PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.
« Keywords and Language Simplicity
The Endpoints of the Scale of Stupidity on Video »

Working with PHP 5 in Mac OS X 10.5 (Leopard)

October 28th, 2007

PHPMac OS X is a great development platform for working with PHP. Leopard comes with Apache, PHP and many other development tools, such as subversion already installed. Leopard brings a much needed upgrade from Tiger’s tired PHP 4 to a very modern version of PHP 5.2.4. This is a guide for setting up a PHP development environment under 10.5 using the version of PHP that ships with leopard.

You may prefer to use one of the 3rd party distributions of PHP, such as MAMP, XAMPP or Marc Liyanage. This is a guide to using the version of PHP that comes with 10.5.

Enable Developer Tools

These steps may not be strictly necessary for this process, but I find it useful to do them.
First, enable your root password.
You may also want to install XCode Tools from your Leopard disk (or grab the latest from Apple developer tools). The tools are required is you are going to compile any extensions for PHP.

Editing Configuration Files

We will have to edit several configuration files that exist as part of the unixy underpinnings of OS X. I’m going to recommend the free text editor, TextWrangler for this purpose. Normally, the finder hides the configuration files from view. However, in the finder, you can use the “Goto Folder…” option under the “Go” menu to view these files. This option if available via command-shift-G. Actually, this option is available in any file open dialog in OS X via command-shift-G. In addition, Text Wrangler will allow you to browse these files with its “open hidden…” option. But, the much easier option is selecting “Open file by name…” (command-D) and just typing the full path and filename. To save many of these files, you will need to enter your root password. Be Careful.

Enabling PHP

PHP is installed in Mac OS X by default, but not enabled. To enable it, we must edit the apache 2 configuration file, which is located at /etc/apache2/httpd.conf. Find the line which loads the PHP 5 module, which looks like this:

#LoadModule php5_module libexec/apache2/libphp5.so

The line is currently commented out. All we have to do is remove the comment symbol, #, so the line looks like this:

LoadModule php5_module libexec/apache2/libphp5.so

Save.

Starting Apache

Go to the sharing panel in system preferences and enable “Web Sharing.” This will start the apache server.
Sharing Panel
Another way to do this is to type the following in the Terminal application:

sudo apachectl start

You will be prompted to enter your root password. After that, your apache server should now be running. If you need to restart the server from the terminal, you can type this:

sudo apachectl restart

If you find this tedious to type, there is a script that you can download to do this later in this post.

Visiting our Web Site

Now, lets check our work. In the sharing panel, you can click on the URL under “Your computer’s website.” Alternatively, in the web browser, go to the url http://localhost/. localhost is a special name that means “My computer.” If your web server is working, you should see a page titled “Test Page for Apache Installation.” If you go to http://localhost/manual/, you can read an Apache 2.2 manual, hosted from your own server. But, this don’t tell you that PHP is working.
For that, we’ll have to create a very simple php program. Create a new file in TextWrangler and type the following:

 
< ?php phpinfo(); ?>
 

(Don’t just copy and paste this. Note that there should be no space between the < and the ?php. The WordPress software I use for this blog inserts an extra space.)
Save this using the file name info.php in the /Library/WebServer/Documents/ directory. (start from the top level directory of your hard drive, not the library directory in your home directory. Now you should be able to visit the PHP page you just created by visiting http://localhost/info.php. You should see the PHP logo and a big table of configuration information.

Showing the World

For security purposes, you should consider that anything you put in your WebServer/Documents folder will be available across the web. If you have information that you want to keep private, think twice about putting it there, unless you know how to protect it.
But, if you want people to see the pages that you are sharing, there can be a few obstacles. You can give out the URL that is listed in the sharing control panel under “Your computer’s website.” However, if you are behind a NAT router, such as I am, this IP address based url will only work for other computers on your network and not for the internet as a whole. You may have to configure network router or firewall in order to discover your true ip address and to route web server requests to that IP to your computer. Doing this is beyond the scope of this tutorial.
Additionally, IP address based urls don’t make good urls to share. IP addresses can change. If you plan to host a permanent web site, you may want to purchase a domain name and point it to your Mac. This also, is beyond the scope of this tutorial.
Perhaps the best option is to purchase both a domain name and professional hosting. Apache based PHP Hosting is widely available and cheap. You can get support from a good host on uploading your files to the remote server. I’m going to presume that you will use one of the many excellent PHP hosting options and are only configuring PHP on your own machine for education, testing or development purposes.

Enabling a Personal Website

If you clicked on the URL under “Your Personal Website,” you might have gotten a page that says forbidden. This is because in the default configuration in Leopard, unlike in Tiger, does not allow Apache to serve documents from home directories. If you want to enable this feature, you have to create a new Configuration file.
Create a new file with the following contents and save it to /etc/apache2/users/jeff.conf.

 
<directory "/Users/jeff/Sites">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</directory>
 

Replace “jeff” with your user name, which is also the name of your home directory. Exact capitalization is imporant. This tells the Apache server that it is ok to serve web content out of the ~jeff directory. You will have to restart Apache for this to take effect.
You may also have to create a Sites folder in your home directory to hold the files you want to serve. Leopard will automatically bless this folder with a special Icon.

Virtual Hosting

If you want to experiment with or work on more than one site at a time, the single directory in WebServer Documents and the Personal Websites configuration don’t work well. Projects collide and files outside of your home directory can be harder to work with. The answer to this is to setup virtual hosting. Lets turn our Personal Website sharing solution into a virtual hosting solution that allows us to work with multiple websites as subdirectories of our Sites folder.
So, lets create a sample site, called mysite. We’ll create a folder called “mysite” as a sub folder of our Sites folder. Capitalization is important.
Now, we are going to want to access our site with an easy to use domain name, so that our url is http://mysite/. There is an easy way to create new domain names that are only for personal use. To do this, we can add it to our /etc/hosts file. Add the following lines at the end of this file:

# My local aliases
127.0.0.1 mysite

127.0.0.1 is a special IP address designation that never changes and corresponds to localhost to mean this computer. We are telling our Mac that the name mysite is hosted on the local computer. This rule is only in effect on the same machine. If you go to a different machine, you cannot use the http://mysite/ url.
Now we need to configure apache for virtual hosting. We are going to have to edit our /etc/apache2/users/jeff.conf file. Change the contents of this file to the following:

 
<directory "/Users/jeff/Sites/*/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</directory>
 
NameVirtualHost *:80
 
<virtualhost *:80>
    DocumentRoot /Users/jeff/Sites/mysite
    ServerName mysite
</virtualhost>
 

Remember to replace “jeff” with your user name. Place your info.php test file into the mysite directory and rename it to index.php. Now, restart your apache server. When you visit http://mysite/, you should now see the familiar php logo and information page.
If you want to add another site, just add a second line in your hosts file, another subdirectory of Sites and append the following to your apache configuration file:
 
<virtualhost *:80>
    DocumentRoot /Users/jeff/Sites/myothersite
    ServerName myothersite
</virtualhost>
 

Sharing with the World, Part II

Sharing your virtual hosted sites with the world is more complicated if you don’t have a domain name setup. You can, however, add your hosts files entries to other computers that you want to share with. However, you have to change the 127.0.0.1 IP address to the IP address of your computer, taking into account any NAT.
There is a special case of this. If you are using parallels, perhaps for test viewing your pages in internet explorer, you may want your virtual hosted sites to be available. The good news is that Windows also supports a hosts file. Here is how to edit your windows hosts file. The big problem is knowing what IP address to use. You can’t use 127.0.0.1 on the windows side because that is the virtual windows machine, not your Mac’s address. You can use the IP address shown on your network system preferences panel, 192.168.1.100 for me. But, this number is subject to change and you will have to re-edit your hosts file on the windows side.
If you are using Parellels, be sure to upgrade to the new beta version for Leopard, build 5540. Once you’ve done that, if you visit the network panel in system preferences and select the “Parallels Host-Guest” network, you will see the IP address that parallels assigns to your host machine. (assuming you are using Shared Networking.) You can then use this IP address in your windows hosts file. You may also be able to change “Using DHCP” to “Using DHCP with Manual address” and re-entering this number if you have a problem with the number changing. Here, my number is 10.37.129.3:

Network Preferences panel

Installing MySQL

MySQL has a binary distribution for Mac OS X. They also have reasonably good documentation on installing MySQL on Mac OS X for their distribution. Note that Leopard specific packages for MySQL have not been created yet.

Starting MySQL

So far, the MySQL preferences panel from the Tiger release is broken and does not correctly start and stop MySQL (bug report. You can do this from the terminal window with

sudo /usr/local/mysql/support-files/mysql.server start

To shutdown the server type:

sudo /usr/local/mysql/support-files/mysql.server stop

If you find this tedious to type, you can download WebDevCP, which is a small AppleScript application that I made. Launching WebDevCP launches both Apache and MySQL. Quitting the application shuts them both down. usually. Launching and quitting requires a password. No warranty on this thing. It was just something I was using personally and figured others might find useful.

Bring the mysql.sock to PHP

One problem that has come about with MySQL and Leopard is the location of the mysql.sock file. Previously, the default location for this file was in the /tmp directory. That location has now moved to the /var/mysql directory. PHP will look for it there. Unfortunately, the default location from the MySQL will still place it in the old location. We can fix this by creating a my.cnf configuration file in the /etc directory. Save a file with the following contents to /etc/my.cnf:

[client]
socket = /var/mysql/mysql.sock

[mysqld]
socket = /var/mysql/mysql.sock

In the terminal window, type the following commands to create the directory for the sock file:

sudo mkdir /var/mysql
sudo chown _mysql /var/mysql

One drawback to this is that if you have installed the MySQL GUI tools, they will look for the mysql.sock file at the old location. You can enter the new socket in the connection dialog under More Options, there is a box labeled “connect using socket.” Just enter /var/mysql/mysql.sock.
Another solution is to change the php.ini file to expect the socket in a different location. I’m going with the my.cnf option because I expect the MySQL will have a Leopard version out in a few days that changes the default location.

Where is PEAR?

OS X has traditionally had problems with PEAR. Many point updates would overwrite the included version of PEAR with an older, and perhaps insecure version. Sadly, Apple has fixed this by not including PEAR at all in their OS. This is a big inconvenience for people wanting to use Apple’s default version of PHP, versus a third party distribution. So, lets get PEAR installed. Type the following in the terminal window to download the PEAR installer:

curl http://pear.php.net/go-pear > go-pear.php

after that, type

sudo php -q go-pear.php

To run it. Hit enter to select the default locations. PEAR will be installed, but it won’t be ready to use until we modify our php.ini file.

PHP .ini configuration

Now we need to make some changes to our php configuration file. Leopard has an empty configuration file by default, but provides a file which you can use as a template. From the terminal window, type:

sudo cp /etc/php.ini.default /etc/php.ini

Now, edit the /etc/php.ini file. Find the include_path setting:

;include_path = ".:/php/includes"

And change it to

include_path = ".:/usr/share/pear"

This enables our PEAR installation. You may also want to make some changes which will improve your ability to debug PHP. FInd the line that says

log_errors = Off

and change it to

log_errors = On

You have to then restart Apache for these PHP changes to go into effect.

Errors and Omissions

Thats all there is to using the version of PHP delivered with OS X. If you find this confusing, you are probably better off with something like XAMPP or MAMP. I’ll probably end up compiling my own versions of PHP, but that is a different blog post. I’ve already had problems with this configuration when I tried to install XDebug via PECL. One last thing, if you run into problems, you can check the apache2 error_log file using the Console application.

For support, try the Sitepoint forums or Apple’s Discussion Forums.

Filed Under

  • Mac, PHP

Related Posts

  • Holiday Tech Support
  • Evolution not Revolution
  • Status of WACT
  • PHP first impressions from a J2EE programmer
  • php | tek 2008
Both comments and pings are currently closed.

223 Responses to “Working with PHP 5 in Mac OS X 10.5 (Leopard)”

  1. MonkeyT says:
    10/28/2007 at 7:33 pm

    A very good walkthrough, covering every stumbling block I found while playing with Leopard this weekend except one. Apple’s default install uses PDO, but only includes drivers for SQLite and SQLite2 – no PDO_MySQL, despite having both the MySQL and MySQLi extensions. I ran into the aforementioned pecl trouble, so I haven’t gotten the pdo_mysql driver installed yet. My time’s up for playing with 10.5 for a few days, but If you find a working patch for this, that may be a good thing to add to your tutorial. I’m sure it will be a common problem.

  2. maetl says:
    10/28/2007 at 10:40 pm

    I had various problems with the /etc/hosts file on OS X 10.4, but as it turns out there is an alternative less traditional way Apple does (did?) things, using the netinfo manager.

  3. Ralph Martin says:
    10/29/2007 at 4:37 am

    Because of the PDO MYSQL issue above, I tried to build my own version of PHP5, but ended up with a missing symbol to do with the XML library. Has anyone managed to build PHP5 successfully for Leopard? If so, care to share the trick?

  4. PHPDeveloper.org says:
    10/29/2007 at 6:19 am

    Jeff Moore’s Blog: Working with PHP 5 in Mac OS X 10.5

  5. MonkeyT says:
    10/29/2007 at 6:28 am

    @maeti said: I had various problems with the /etc/hosts file on OS X 10.4, but as it turns out there is an alternative less traditional way Apple does (did?) things, using the netinfo manager.

    Yep, Tiger could use netinfo, but apparently Leopard has deprecated netinfo and the netinfo manager is no longer installed.

  6. Mickey79 says:
    10/29/2007 at 8:25 am

    I would like to add the “dbase” extension to the PHP installation on Leopard. Can I do that if I follow this method? If yes, How?

  7. Acrobatic says:
    10/29/2007 at 9:42 am

    Great post–this bugged me all weekend after my Leopard upgrade broke my Virtual Hosts… I miss NetInfo. The only tweak I’d recommend is to let people know to change their permissions on the example. I had to use

    chmod 755 mysite and
    chmod 755 * (inside the mysite directory)

    to get my sample page to show.

    Thanks for the instructions, this has been a big help

  8. MonkeyT says:
    10/29/2007 at 10:01 am

    upgrade broke my Virtual Hosts

    This is widely reported. During the upgrade process, apparently Apple’s scripts don’t properly account for the fact that /private/etc/httpd/users/ has now become /private/etc/apache2/users/ and fail to move the old user accounts to the new location. Simple fix, drag the files to their new home. Editing the accounts might trigger new file builds as well. New installs of Leopard don’t have this trouble.

  9. developercast.com » Jeff Moore’s Blog: Working with PHP 5 in Mac OS X 10.5 says:
    10/29/2007 at 10:07 am

    [...] his latest post, Jeff Moore talks about a much needed upgrade to a popular operation system (the Leopard version of [...]

  10. Team BKWLD » Leopard Upgrade Breaks MySQL [READ: DON’T UPGRADE] says:
    10/29/2007 at 12:49 pm

    [...] [UPDATE] The most comprehensive solution to date is here. [...]

  11. Karsten says:
    10/29/2007 at 1:30 pm

    Thanks for all this instruction.

    Do you know what happened to pear DB? Previous to installing Leopard it was in /usr/lib/php/DB.php, now ??? The pear installation above doesn’t seem to include DB – just MDB2.

    Please forgive my ignorance.

  12. Karsten says:
    10/29/2007 at 1:45 pm

    I just saw that DB is suspended. I will install the package for my older projects… Thanks.

  13. andare.ch - Blog » Blog Archive » Apache, PHP und MySQL unter Leopard (MAMP on Leopard) says:
    10/29/2007 at 2:17 pm

    [...] zu MySQL bin ich im Übrigen auf diesen, sehr ausführlichen und hilfreichen Artikel gestossen: Working with PHP 5 in Mac OS X 10.5 Verwandte Artikel:Leopard in der PostMySQL und Mac OS 10.4 Windows CE der Sieger? Bitte bringt [...]

  14. Lonnie Olson says:
    10/29/2007 at 2:57 pm

    Your article is really good. Except for two small problems.

    1. Enable root password. This is completely unnecessary. It is not required to ever enable the root password. In fact, enabling the root account only further exposes your computer to security risks. Use sudo instead.
    2. Enabling a Personal Website. You said that personal websites is not configured by default. This is not true! See /etc/apache2/extra/httpd-userdir.conf. Also a specific /etc/apache2/users/username.conf is created for every user you create on the machine.
  15. Jeff says:
    10/29/2007 at 3:54 pm

    I’m glad this post is proving useful.

    Lonnie, I’ve updated the post to correct some typos and incorporate your two problems.

    Additionally, I’ve updated the Section on Parallels networking on how to discover the IP address of your Mac.

    In a couple days, I’ll probably have a post on how to compile PHP from scratch under Leopard and add extensions such as XDebug.

  16. Stan says:
    10/29/2007 at 9:38 pm

    Looking forward to your directions for compiling, I’ve not had any luck due to problems with the mysql bindings.

  17. How to enable PHP 5 in OS X 10.5 Leopard says:
    10/30/2007 at 7:06 am

    [...] is a great article on this here. No Comments, Comment or [...]

  18. Stan says:
    10/30/2007 at 7:41 am

    In order to get PHP to compile and run on OS X 10.5 you will need to do a couple of thin gs…

    First, if you want mysql support in your build – install the binary from mysql’s website and then do the following:
    sudo mkdir /usr/local/mysql/lib/musql
    sudo ln -s /usr/local/mysql/lib/libmysqlclient.15.0.0.dylib /usr/local/mysql/lib/mysql/libmysqlclient.15.0.0.dylib
    sudo ln -s /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/mysql/lib/mysql/libmysqlclient.15.0.0.dylib
    sudo ln -s /usr/local/mysql/lib/libmysqlclient.dylib /usr/local/mysql/lib/mysql/libmysqlclient.15.0.0.dylib

    Then, you will need to download the apache2 source. Apache2 needs to be recompiled because of an architectural error when compiling php. I’ve been unable to resolve this error by compiling PHP as a universal binary, so rather then waste anymore time apache is easy enough to compile we’ll go ahead and just do that.
    ./configure –enable-layout=Darwin –enable-mods-shared=all && make && sudo make install

    Note, this install overwrites the existing 10.5 install. The upside of this is that it can be controlled via the Sharing Preferences.

    Then you should be able to compile PHP with apache2 just fine. If you want the newly compiled php to overwrite the existing one be sure to set –prefix=/usr otherwise set –prefix=/usr/local

    If you have any questions or want to know about compiling PHP with gd support feel free to drop me a line.

    Pax.

  19. Nick says:
    10/30/2007 at 10:40 am

    Is it possible to add postgresql support to the apple version of php? I’m about ready to give up on trying and just install my own copy of php and apache.

  20. Rainer says:
    10/30/2007 at 6:59 pm

    Very nice page.

    But unfortunately I ran into a problem when trying to install pear.

    (1)$ sudo php -q go-pear.php
    dyld: NSLinkModule() error
    dyld: Symbol not found: __zval_ptr_dtor
    Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20060613/libpdf_php.so
    Expected in: flat namespace

    Trace/BPT trap

    What might I have done wrong?

  21. Keith says:
    10/31/2007 at 9:31 am

    After upgrading to Leopard on the weekend I was madly searching the internet to get info on how to get my testing environment functional again.

    There are lots of sights with pieces of info, but this is far and away the best resource I found for getting your Apache, PHP and MySQL functional after upgrading to Leopard.

    Thanks for your detailed work!

  22. Upgraded to Leopard | NSLog(); says:
    10/31/2007 at 2:50 pm

    [...] I had to re-install MySQL. I used the 10.4 package, and the startup item appears to work. I used this article, which deals mostly with setting up PHP in Leopard, to edit my “my.cnf” file so that PHP could find [...]

  23. Superfunkomatic - Observations of the Socially Inept » Blog Archive » holy frickin' updates batman says:
    10/31/2007 at 4:39 pm

    [...] found a helpful post and was able to get everything up and running again in about an hour. if your stuck configuring a webserver on leopard mac OS 10.5 check out this link – http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/ [...]

  24. superfunkomatic says:
    10/31/2007 at 4:40 pm

    thanx so much for posting this. what a lifesaver! went through created the user conf files, changed the path to wordpress blogs and bob is your uncle – everything work like a charm. back in business.

    many thanx for sharing this information. sending you a virtual beer!

  25. Josh says:
    10/31/2007 at 6:26 pm

    @Rainer

    It isn’t a problem with the go-pear script, it’s a problem with the libpdf_php.so module. I’ve tried to install XDebug & pdo_mysql and I get similar errors. even doing php -v on the command line will give you the same error. Weird thing is that running a simple script like

     
     phpinfo();
     

    will run just fine and show the installed modules, but any semi complex script, or anything on the cli will fail, even if it doesn’t actually call the custom module.
    For now if you comment out the libpdf_php.so module in your php.ini, pear should work.

    Hopefully someone will figure out the trick to compiling modules soon.

  26. Playing With Wire » Installing symfony on OS X Leopard says:
    10/31/2007 at 10:25 pm

    [...] blog suggested go-pear.php as an alternative way to install PEAR on the Mac and it does work. So with no [...]

  27. Glagla Dot Org » Blog Archive » Léopard est livré avec PHP5 says:
    11/1/2007 at 3:24 am

    [...] mais il semble bien que Léopard soit livré avec PHP5. Sous réserve de quelques manipulations (Working with PHP 5 in Mac OS X 10.5 – en anglais), il est possible d’avoir une magnifique installation (incluant PHP5, PEAR et [...]

  28. Installer une plate-forme de développement PHP sur Leopard says:
    11/1/2007 at 2:28 pm

    [...]  Working with PHP 5 in Mac OS X 10.5 – Jeff Moore (0 visite) [...]

  29. Installer une plate-forme de développement PHP sur Leopard says:
    11/1/2007 at 2:28 pm

    [...]  Working with PHP 5 in Mac OS X 10.5 – Jeff Moore (0 visite) [...]

  30. kobak pont org » links for 2007-11-02 says:
    11/1/2007 at 6:27 pm

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP php 5 leopardon (via vbali) (tags: PHP Leopard osx Mac Apache howto server) [...]

  31. Joannou Ng says:
    11/1/2007 at 9:52 pm

    This will be helpful to some folks:
    Migrating MySQL 5.0.45 to Mac OS X 10 .5 Leopard http://blog.tomatocheese.com/archives/2007/11/1/migrating_mysql_to_mac_os_x_leopard/

  32. james says:
    11/1/2007 at 10:48 pm

    Ran into the problem of trying to recompile PHP on OSX 10.5 Server when trying to add pdo-mysql. I too couldn’t resolve the arch type errors. Thought about going with the recompile of apache2 route, and even got as far as ./configure && make, but didn’t do the make install because I noticed that the configure script identified the system as i386.

    … Now I know one of the big deals about 10.5 is that most (or all) of it is 64bit from the ground up. Including things like apache2 and mysql. I was able to muck around with the Makefile and get it to target i686, but how can be sure that it’s compiling apache2 as a 64bit binary?

    I’m slightly less concerned about replacing apache2 with a 32bit binary on my MacBook Pro… but on a Xserve with apache2 being used for all the iCal CalDAV and wiki and webmail stuff, I’m a little more hesitant.

  33. ye.hu » leopard és web development says:
    11/2/2007 at 3:25 am

    [...] leopard és web development This entry was written by ioros and posted on 2007. November 2. at 12:24 pm and filed under Url. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Comments are closed, but you can leave a trackback: Trackback URL. [...]

  34. StringFoo :: Web Development Resources» Blog Archive » Leopard Upgrade Hell: Web Developers Hold Off says:
    11/2/2007 at 4:45 am

    [...] If you just can’t wait to upgrade, then I strongly suggest heading over to this excellent step-by-step guide to installing LAMP on Leopard. Follow the steps precisely, and fill your mug of patience to the [...]

  35. PHP auf Mac OS X Leopard | IT.CappuccinoNet.com Blog says:
    11/2/2007 at 5:21 am

    [...] auf dem neuen Mac OX X Leopard PHP installieren möchte, finden eine gute Anleitung im Blog PHP Programming, Web Development, PHP Advocacy and PHP Best Practices. Bookmark to: (No Ratings Yet)  Loading [...]

  36. John Wooten, Ph.D. says:
    11/2/2007 at 1:42 pm

    Thanks for your advice. With some diddling around, starting and stopping, etc. I got my personal web server working again and my Mantis problem tracker going as well as the cvs viewer again. I am still having problems with getting a perl script that used to run under cgi-bin working. Obviously there is more to fix.

    Thanks.

  37. Outside the Box » Blog Archive » Spotted cat says:
    11/2/2007 at 3:21 pm

    [...] It was rather worrisome (and my Internet connection was acting up at the time), but then I found Working with PHP 5 in Mac OS X 10.5 (Leopard) and it solved that problem. Phew. [...]

  38. Gabriel U. says:
    11/2/2007 at 9:16 pm

    These instructions are great and helped me get my development coding environment back on track. I thought I was going to have to spend weeks trying to get my computer to run Apache, PHP, and MySQL the way I had them running with Mac OS X 10.4 but I was able to get things running in a couple of hours with these instructions.

    Much appreciation goes to the person whom wrote and/or gathered all of this information.

  39. Luke says:
    11/2/2007 at 9:43 pm

    Thank-you so much for posting these solutions!!
    I am very new to PHP, MySql and Apache and this page was a great help. I couldn’t find any other information on how to get things working in Leopard.

  40. Josh says:
    11/4/2007 at 12:36 pm

    Looks Like we can’t compile extensions under the Apple-supplied PHP:

    http://netevil.org/blog/2007/11/php-objective-c-bridge

    Hopefully Marc over at entropy.ch will get the Quad-binary thing solved soon…

  41. bert says:
    11/4/2007 at 1:44 pm

    Thanks, has helped to transfer to leopard…

    One remaining problem is that i can not access the virtual hosts from parallels. Windows always goes to the localhost directory location on the mac.

    My virtual hosts do not specify a port number, just a name and a different directory location. Works on the mac site, not on the pc site… I set all virtual server names to point to Parallels Host-Guest ip the in the windows host file…

  42. Lee Cooper says:
    11/4/2007 at 4:05 pm

    Just a quick note…I’ve spent the weekend trying to get this to work…obviously I’m not as technically adept as most of you guys, and as a recent Mac convert, not as familiar with the Mac yet either.

    Here’s how I was able to get parallels to work so I could test my sites in IE. I installed Bonjour for Windows in my VM, then I could access my webserver running on my mac by using the URL http://macleemo.local (my mac is MacLeemo). I was then able to see my Joomla sites in both my Mac and parallels!

    Thanks for the great tutorial!

  43. discoliam says:
    11/4/2007 at 5:20 pm

    Just wanted to say, this was uber helpful. Annoying how Leopard doesn’t allow Apache to serve documents from home folders. Its been buging me for days.

    Cheers.

  44. All adders are puffs… at Disco Liam says:
    11/4/2007 at 5:47 pm

    [...] quote. Having spent the entire day cursing the ground Jobs walks on, I finally stumble across the greatest blog post I’ve ever read. And I quote: “…the default configuration in Leopard, unlike in Tiger, does not allow [...]

  45. Chris says:
    11/5/2007 at 2:04 am

    Do you know how to add the GD libraries to PHP under OS X.5 leopard??

    I used to use Mark Lyanages packages for years and they came complete with that. Easy one-step installation which even restarted Apache when installing. . . . but I dont know enough about Compiling it myself to add GD image library support to PHP under Apache 2.

    Any detailed info would be GREATLY appreciated.

    THanks!

  46. Nick Jennings says:
    11/5/2007 at 4:03 am

    I stumbled across this article, and I’m glad I did.

    I always knew that apache was built into OS X, but I never knew that PHP was too. Up until now I’ve been using MAMP for all my development, but I reckon I will try and get rid of it now if I can MySQL to install and play nice!

    Thanks a lot.

  47. Enabling PHP 5 on Mac OS X Leopard at DavidCramer.net says:
    11/5/2007 at 10:52 am

    [...] Apache2 and PHP5, and enabling it is as simple as uncommenting a line. Check out this guide for a full tour of using Apache2 with PHP5 and MySQL on the latest release from [...]

  48. John Grogan says:
    11/5/2007 at 11:04 am

    Thanks! this post was a lifesaver

  49. Useless Nexus » Blog Archive » links for 2007-11-06 says:
    11/5/2007 at 9:30 pm

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP Leopard comes with Apache, PHP and many other development tools, such as subversion already installed. Leopard brings a much needed upgrade from Tiger’s tired PHP 4 to a very modern version of PHP 5.2.4. This is a guide for setting up a PHP development en (tags: Apple Mac php development howto web webdesign server security sharing) [...]

  50. PHP5 en Mac OS X 10.5 (Leopard) « Abraham Estrada - Abe Blog says:
    11/5/2007 at 11:06 pm

    [...] al punto que iba es que me encontre con un blog (Professional PHP) que da las intrucciones sobre como habilitar el PHP5 que ya trae el Mac OS X 10.5 (Leopard) en el [...]

  51. Apple Leopard - Probleme mit apache , php und mysql at stephanhahn.ch says:
    11/6/2007 at 1:04 am

    [...] die Leopard Version von Mac OSX hat man ganz schöne probleme mit dem Apache , Php und Mysql. Auf dieser Seite findet man die Lösung [...]

  52. Daniel Haus says:
    11/6/2007 at 11:13 am

    As for the pdo_mysql issue, that is nagging me too, if found this message here: http://discussions.apple.com/thread.jspa?messageID=5669164&#5669164

    Haven’t tried it yet, but this seems to be the easiest and fastest way.

  53. Leo Studer says:
    11/7/2007 at 4:12 am

    Jeff, thank you for this clear instruction. Where are you with rebuilding PHP? Do you also have to rebuild Apache and Mysql? I am waiting for this new instructions, especially about XDebug…
    …

  54. Enabling Your Personal Web Site on Leopard : Laran Evans says:
    11/7/2007 at 10:04 am

    [...] a more thorough walkthrough take a look at this. November 7, 2007 | Filed Under OSX, [...]

  55. Daniel’s Weblog » Blog Archive » Does anyone know how to get pdo_mysql working on Leopard? says:
    11/8/2007 at 4:57 pm

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) [...]

  56. Marc says:
    11/11/2007 at 5:56 am

    Hello, your topic is very interesting, and I have now a complete installation on my os 10.5, BUT, it is absolutely impossible to install a GD2 library, necessary for my business (building websites with Spip) …

    I have download the php5 Liyanage package, but I dont know to enable this, Apple’s Apache2 is always reading his own php5 …

    If you have a solution, I will be very happy … and excuse my english, I am writing from Paris (France) :-)

    Thanks a lot … Marc

  57. Macpro.se - PHP 5 i Leopard says:
    11/11/2007 at 6:42 am

    [...] dig som är intresserad av att jobba med PHP5 i Mac OS X 10.5 Leopard kan denna guide vara [...]

  58. Jeff says:
    11/11/2007 at 7:24 am

    I haven’t done my from-scratch compilation of PHP on leopard yet, but it looks like that is the way to go if you want to use certain extensions. Meanwhile, I ran into a post on building mysql for os x.

  59. Adam says:
    11/13/2007 at 6:32 am

    Why does it appear to be so difficult to use PHP on Mac OS X? Is there no such program like MAMP for Mac? Like there’s LAMP for Linux and WAMP for Windows.

    Friends at TalkPHP.com!

  60. bugugly says:
    11/13/2007 at 11:12 am

    @Rainer

    probably your /usr/bin/php is hosed
    If like me, you have installed Entropy or Zend or both, try the complete path on the command line.
    # /usr/local/php5/bin/php -v
    or
    # /usr/local/Zend/Core/bin/php -v

    When you decide which you want:
    # cd /usr/bin
    # ln -s php

    I linked both php and php-config to my entropy php and it is working so far. My pear was broken also and is now working again.

    Pretty sure this is not the best way, like if Apple updates your default php the links should get overwritten, but it works for now.

  61. bugugly says:
    11/13/2007 at 11:16 am

    Sorry

    #ln —one you want— -s php

    I used XHTML tags to mark the text after ln on the earlier post, and of course the text and tags disappeared.

  62. Buggy-Net.de - » Apache2, php, MySQL beim Leopard Mac OS X 10.5 says:
    11/14/2007 at 4:28 pm

    [...] PHP5 beim Leo: http://www.procata.com/ [...]

  63. the scampo side » leopard LAMP dev environment, yeah! says:
    11/21/2007 at 11:25 am

    [...] try to use the existing Mac OS X install of PHP as it is now running on PHP5 in Leopard. I used a guide I found via kevin rose’s blog as my instruction on how to get the Mac OS X PHP install functioning. The process basically comes [...]

  64. Best PHP Books says:
    11/22/2007 at 6:27 pm

    I have many trouble installing PHP on my MAC. I have given up. I’m gonan give this tutorial shot and see what happens. Thanks for the tutorial thou.

  65. Get PHP working on Leopard (Mac OS X) » Datanomics says:
    11/23/2007 at 8:49 pm

    [...] After I upgraded to Leopard from 10.4.x, my PHP processes stopped working.  The new OS overwrote some configuration files.  Check out this post on how to get things working again. [...]

  66. Joshua Adrian says:
    11/26/2007 at 6:47 pm

    Anyone know how to get phpmyadmin up and running in combination with this tutorial…. i keep getting an “access denied for user ‘root’ @ ‘localhost’ (using password: NO) message…. have no idea what to do from here…. i have php and mysql running fine… this is the last piece i need

  67. Miles Muri says:
    11/27/2007 at 8:03 am

    @ Joshua

    You need to go into the phpMyAdmin directory and rename (make a copy) the config.sample.inc.php to config.inc.php. In the First Server section, fill in the required settings:

     
    $cfg['blowfish_secret'] = '**@@secret_blowfish_pass@@**'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
     
    /* 
     * Servers configuration
     */
    $i = 0;
     
    /* 
     * First server
     */
    $i++;
    /* Authentication type */
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    /* Server parameters */
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['connect_type'] = 'socket';
    $cfg['Servers'][$i]['socket'] = '/var/mysql/mysql.sock';
    $cfg['Servers'][$i]['compress'] = false;
    /* Select mysqli if your server has it */
    $cfg['Servers'][$i]['extension'] = 'mysql';
    /* User for advanced features */
    // you can use root here if your computer if you are comfortable with that or create a special user 
    $cfg['Servers'][$i]['controluser'] = 'someuser'; 
    $cfg['Servers'][$i]['controlpass'] = 'somepass';
     

    Works for me so far…

    Miles

  68. lucashansendotcom » PHP5 on Leopard says:
    11/28/2007 at 10:18 pm

    [...] Mac OS 10.5 is out, there are a few changes to PHP, MySQL, and Apache.  Here is a good, basic, article that outlines those changes/setup [...]

  69. Chris says:
    12/4/2007 at 4:00 pm

    Thanks to the authors for putting this tutorial together. It was very helpful in getting me up and running with Apache 2 and PHP 5 on Mac OS X Leopard. One thing that I did not find in this tutorial that I had to do was to edit the “Document Root” and “Directory” commands in Apache’s httpd.conf file to point to my Sites directory. A mention of this would be nice.

  70. Erik says:
    12/13/2007 at 9:21 am

    I have successfully got apache and php running on Leopard, however I’m having an issue with mySql. I get the following error in the terminal when running:

    sudo mysql_secure_installation

    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
    SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

    In order to log into MySQL to secure it, we’ll need the current
    password for the root user. If you’ve just installed MySQL, and
    you haven’t set the root password yet, the password will be blank,
    so you should just press enter here.

    Enter current password for root (enter for none):
    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

  71. Robert Nyman says:
    12/13/2007 at 1:44 pm

    Great and very useful article! Thank you!

  72. caruso_g says:
    12/16/2007 at 4:07 pm

    Hi, first of all thanks for this great tutorial. Everything works great!
    Except for Rails. Going, through terminal to create class instances into the database tables, it puts out this error message:

    >> story = Story.new
    Errno::ENOENT: No such file or directory – /tmp/mysql.sock

    It goes looking for the mysql.sock to the default location, but having changed it to the var directory it doesn’t find it.
    How can we solve it?

    Thanks anyone for the help.

  73. Andy says:
    12/16/2007 at 9:03 pm

    what do I do once I’ve installed go Pear? I don’t know how to list the available packages. Could someone give me the next step. The last thing I did (from above instructions) was change:
    include_path = “.:/usr/share/pear”

    If I look in /usr/share there is no pear folder in there.

  74. Moreno says:
    12/19/2007 at 2:27 am

    Thanks a lot buddy. Worked very well. Just perfect.

  75. Null is Love » Blog Archive » Taming Leopard for PHP says:
    12/19/2007 at 12:10 pm

    [...] more thorough guide is here if you run into different issues or need more help. I should note that I disagree with [...]

  76. Tuaregue » Apache no Leopard says:
    12/22/2007 at 4:18 pm

    [...] Link [...]

  77. One Thousand Words » Blog Archive » PHP, MySQL and Leopard says:
    12/27/2007 at 8:43 am

    [...] some workaround to get it working properly. I found some good help at My Macinations and again at Professional PHP.To make a long story short, because this is mostly a reminder for myself, the key resources for [...]

  78. screenmates says:
    12/29/2007 at 1:16 am

    You can install a completely different set of LAMP on OS X using Mac Ports.

  79. tomtom says:
    1/8/2008 at 8:30 pm

    Thanks a bunch for your time on this – helped my a great deal, everything fell into place as described. Muchos!

  80. Waffle With Meaning » Installing PHP, MySQL and phpMyAdmin on OS X 10.5 (Leopard) says:
    1/9/2008 at 5:27 pm

    [...] For more info on setting up a PHP website on an OS X box try Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP [...]

  81. Stifo says:
    1/22/2008 at 6:20 pm

    Another solution for mysql.sock, that works for me:

    sudo mkdir /var/mysql
    sudo chown _mysql /var/mysql
    sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

  82. Stifo says:
    1/22/2008 at 6:23 pm

    Another solution for mysql.sock that works for me:

    sudo mkdir /var/mysql
    sudo chown _mysql /var/mysql
    sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

  83. Demiurgic Design» Blog Archive » Pear and pdo_mysql in Apache2 on Leopard says:
    1/25/2008 at 8:13 am

    [...] add the modules for pdo_mysql and the pear libraries… so i’ll refer you to this post or this one before you go reinstalling apache and rebuilding php5 from source.. and getting lost in Leopards [...]

  84. PolyMicro Systems » Blog Archive » Working with PHP 5 in Mac OS X 10.5 (Leopard) - Professional PHP says:
    2/8/2008 at 5:23 pm

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP: “” [...]

  85. wobbie says:
    2/9/2008 at 3:24 pm

    I had installed on 10.4 the php package from Entropy, which installs php in /usr/local/php5

    I simply upgraded my box to 10.5 and slogged thru the issues.

    What I didn’t ponder was this.

    Since php is installed as part of 10.5, where is this installed version of PHP? That is, where is the native version of php installed at?

  86. john says:
    2/11/2008 at 2:32 am

    how about viewing the error_log on local…. anybody who has an idea?

  87. paul says:
    2/12/2008 at 4:30 pm

    Hi and thank you for the info setting up Apache in Leopard was a pain in the ass until I found this site. One question what do I create a new Configuration file in? Do i use test wrangler or something else? Thanks for all the help and info it is a life saver!

  88. Michael says:
    2/21/2008 at 8:19 pm

    Hi Guys,

    I have followed all the instructions and was able to uncomment the line to enable php. I then created the info.php file and saved it.
    When I open the browser and got http://localhost/info.php I see the actual text in the browser

    eg: i see this in the browser.

     

    Another php file i created does the same. Is there any reason why I see text, not the result of phpinfo()?

    Any help would be great.

  89. Michael says:
    2/21/2008 at 9:41 pm

    Forget my above post. I just didn’t restart the web sharing after uncommenting the line in the apache config file.

    Cheers,
    Michael.

  90. Michael Carruth says:
    2/22/2008 at 6:30 pm

    Stifo gets the platinum star for Post 84…it was the only thing that worked for me!

    Thanks, dude!

  91. Mike says:
    2/23/2008 at 8:59 am

    Thank you for your work. You have a very readable manner of writing, easy to follow, not too much info and not too little. Thanks.

  92. PHP Encoder says:
    2/26/2008 at 4:49 am

    Thanks for the instructions, it really helps me

  93. Damon says:
    2/27/2008 at 11:16 am

    For GD and possibly others that were left out, check out:
    http://docs.moodle.org/en/Step_by_Step_Installation_on_a_Mac_OS_X_10.5_Server#Install_the_GD_Library_on_the_Mac_OS_X_10.5_Server

  94. Keith says:
    3/1/2008 at 10:44 am

    everything was working fine until i tried setting up the personal web site and every time of put “http://mysite/” i got the following error message – afari can’t open the page “http://mysite/” because it could not connect to the server “mysite”.

    And i can’t work out what’s wrong – i am very much a novice at this stuff HELP HELP

    Keith

  95. Indiscripts » Blog Archive » Apache, PHP, and MySQL in Leopard says:
    3/2/2008 at 6:21 am

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) (also has information on setting up PEAR) [...]

  96. Tom says:
    3/3/2008 at 10:34 am

    Thanks for the hints

    One drawback to this is that if you have installed the MySQL GUI tools, they will look for the mysql.sock file at the old location. You can enter the new socket in the connection dialog under More Options, there is a box labeled “connect using socket.” Just enter /var/mysql/mysql.sock.

    You can also enter 127.0.0.1 instead of localhost. Also some other applications will got no connection to MySQL using localhost, but when using 127.0.0.1 all works fine.

  97. Blog Rambler » Blog Archive » Development Web Server says:
    3/12/2008 at 7:02 pm

    [...] some searching on how to do this (remember, I have never used a Mac before) and came across this fantastic tutorial. I was up and running in minutes. Everything worked perfectly except for one thing. The default PHP [...]

  98. Jago Svensson says:
    3/15/2008 at 3:42 pm

    Hi.
    Is there someone with a precompiled executable for php-cli 5.2 for OSX leopard with GD included.

    I mean the executable under /usr/bin/php about (13Mb)

    I would be very thankfull if someone could mail this to me.
    jago (at) jago.se

    Regards Jago Svensson

  99. Tony Reed says:
    3/17/2008 at 7:44 am

    I’ve downloaded and installed a Pecl extension, and when I try to run PHP (from the command-line) with the extension enabled, I get the following error:

    dyld: Symbol not found: _zend_register_long_constant
    Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20060613/id3.so
    Expected in: flat namespace

    and I don’t know how to go about compiling the extension from scratch to try to figure it out.

    I’ve installed Pear, and it works fine. I’ve done this before, I know how and what to edit in php.ini.

    OS X 10.5.2, PHP 5.2.4, Zend Engine 2.2.0

    Anyone? Sorry, but this is annoying, and no one seems to know how to fix it.

  100. RichSad says:
    3/18/2008 at 8:00 am

    I have the same problem as someone above. I did this and there is no pear in
    /usr/share/pear

    the only pear I find is in:

    /private/var/root/bin/pear

    any idea why it ended up there? I have root enabled and did the whole sequence of events under su command (logged in as root).

  101. Tony Reed says:
    3/18/2008 at 11:29 am

    @RichSad, reply #103

    When you ran go-pear, you were presented with a screen that showed you where it was going to place the stuff. If you were logged in as root, then root’s home directory is /var/root and if you just hit the “enter” key, you instructed go-pear to install the binaries for pear and pecl in /var/root/bin, which is go-pear’s default which is relative to where it’s called from.

    To run these binaries in place you can log in as root and run

    bin/pear
    bin/pecl

    and so on.

    I like this well-written set of instructions, but I think that telling novice users to work as root is a mistake. Anyway, I think you should move the binaries into some place that’s in your $PATH as a non-root user.

  102. links for 2008-03-19 « Ramblings of an Eccentric Soul… says:
    3/19/2008 at 12:19 pm

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP How to enable and work with PHP5 in Mac OS X 10.5 (tags: php development programming mac apache) « links for 2008-03-18 [...]

  103. Configure Web Dev on your Mac - MAMP | I'm Knight says:
    3/22/2008 at 9:40 am

    [...] Working with PHP 5 in Mac OS X 10.5  – a most complete guide [...]

  104. Maciej Przybecki says:
    3/30/2008 at 9:07 am

    It seems that after last Leopard security update 2008-002 my custom php installation (which replaced system one) stopped working. The php binary was replaced and it doesn’t load gd.so and mysql.so modules anymore.

    I tried to recompile and reinstall php again but it breaks on linking, claiming aboud undefined symbols of iconv.

    Any ideas ?

  105. Jonathan Bryan says:
    3/31/2008 at 2:45 am

    Great Article.

    One question. Where is the proper place to install pear??

    go-pear wants to install in the current user’s directory by default, but in your example, it appears that you installed to /usr/share/pear.

    Any advice would be greatly appreciated.

  106. at says:
    4/1/2008 at 4:02 pm

    Thank you for hints – it saved me a lot of nerves.

  107. xurizaemon says:
    4/16/2008 at 12:50 pm

    @Adam: http://www.google.co.nz/search?q=mamp or http://www.google.co.nz/search?q=xammp

  108. Zhivko says:
    4/27/2008 at 6:17 am

    works like a charm! thank you so much, excellent post, saved me weeks of frustration..

  109. JaideawHosting Admin Blog! » Blog Archive » Working with php in mac 10.5.X says:
    4/28/2008 at 4:04 pm

    [...] Link http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/ [...]

  110. Paul says:
    4/29/2008 at 1:57 pm

    Thanks so much for this post. The others didn’t cover the full process or explain things properly. This made all the difference!

    Thanks

  111. Patrick says:
    4/29/2008 at 4:05 pm

    How great it is to have things explained so well :)

  112. Anonymous says:
    5/1/2008 at 6:49 am

    I’ve got Leopard on my G5 and I’m trying to get php with oracle oci to work with apache2

    I haven’t a clue how to get this done.

    Before I upgraded from 10.4, I had Oracle running with Apache1 with php5 with OCI and no problems. Ever since the upgrade to Leopard my website has been effectively down.

    Any help would be greatly appreciated.

    Regards,

    dajon@comcast.net

  113. todd says:
    5/4/2008 at 11:27 am

    Looking for advice on how to compile php as and embedded library. I amusing this for configure

    ./configure –enable-embed –with-curl -enable-ftp –enable-zip –enable-sockets –enable-static –enable-soap –with-zlib –with-bz2 –enable-exif –enable-bcmath –enable-calendar

    I keep getting this error after running make

    ld: duplicate symbol _yytext in Zend/.libs/zend_ini_scanner.o and Zend/.libs/zend_language_scanner.o

    collect2: ld returned 1 exit status
    make: *** [libphp5.la] Error 1

    I have no idea what this means

    any ideas… thanks

    Todd

  114. kisasi says:
    5/4/2008 at 8:27 pm

    Thanks so much for the virtual hosts setup!!

  115. Tapas says:
    5/5/2008 at 3:00 pm

    Hi, I am trying to enable php. I followed most of the instruction, but it shows me the whole php code just like any other text file in the browser. doesn’t show anything else than purely those texts. I am using Leopard 10.5. Do you think, you can help ?

  116. website design says:
    5/6/2008 at 10:36 am

    how na i install the DG2 Extension???

  117. xentek says:
    5/6/2008 at 10:23 pm

    @website design

    you don’t. not with out much hair pulling and gnashing of teeth. switch to an all-in-one or try Mac Ports (more advanced terminal use required)

  118. Luis Oscar Cruz says:
    5/7/2008 at 12:37 pm

    How can I revert ?

    sudo mkdir /var/mysql
    sudo chown _mysql /var/mysql

  119. e-okul says:
    5/14/2008 at 7:33 am

    Hi,

    Thanks for your advice. With some diddling around, starting and stopping, etc. I got my personal web server working again and my Mantis problem tracker going as well as the cvs viewer again. I am still having problems with getting a perl script that used to run under cgi-bin working. Obviously there is more to fix. Thanks.

  120. Henrik says:
    5/19/2008 at 5:31 am

    I’ve tried building a soap extension for the stock php in leopard, without success. I really cannot figure out why it should be all that difficult. My struggles are documented here:

    http://www.entropy.ch/phpbb2/viewtopic.php?t=2956
    http://discussions.apple.com/thread.jspa?messageID=7046696&#7046696

    Has anyone gotten any further?

  121. Henrik says:
    5/19/2008 at 5:44 am

    From http://netevil.org/blog/2007/11/php-objective-c-bridge:
    [quote]note: you’ll need to build your own PHP on Leopard, the one Apple ships has had its exports stripped, so you can’t run the extension–it’ll build, but not run[/quote]
    Maybe that’s the reason why we’re unable to build extension for the stock php in leopard?

  122. Hip-Hop says:
    5/24/2008 at 3:29 pm

    Thanks for the set-up!!!!!!!!!!!!

  123. links for 2008-05-31 « Amy G. Dala says:
    5/31/2008 at 7:30 am

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP sudo php -q go-pear.php (tags: php reference) [...]

  124. ganache says:
    6/1/2008 at 11:21 am

    Thank you guy

  125. adapter says:
    6/1/2008 at 7:49 pm

    There are actually a few different ones out there. I have been giving this software a go and see how it pans out.

    You have a great site and i return to it ever now and then as i find the time.

  126. pambuk says:
    6/8/2008 at 5:11 am

    Hello, thanks for this post, I moved to Mac few days ago, so it was really helpful and saved me lots of time.

    I’d like to add something to the mysql.sock problem. Instead of making my.cnf and etc. it’s enough to make /var/mysql/ directory and put a symlink there.

    So:

    sudo mkdir /var/mysql
    cd /var/mysql
    ln -s /tmp/mysql.sock mysql.sock

    That’s it.

    Thanks again for the post.

  127. BentoBenji says:
    6/9/2008 at 6:51 am

    Even after moving the username.conf file into the apache2/users directory I get a 403 Forbidden error when trying to access http://localhost/~username.

    Works fine when loading from WebServer/Documents so Apache and PHP are both up and running.

    I’ve even tried playing with permissions in my site directory to no avail. I’d appreciate the help!

  128. Journal of a Tech Enthusiast » Blog Archive » Unable to connect to MySQL from PHP (on Mac OS X) says:
    6/12/2008 at 8:39 am

    [...] After asking for help from Colin, who gave me a head start and some google’ing, I found a solution. [...]

  129. DLivingston says:
    6/14/2008 at 4:43 pm

    I’ve spent considerable time on blogs, support pages, Apple, PHP, etc. and haven’t found any other experiences like this (environment details at bottom). I’ve had current, stable versions of PHP running on many versions of OS X but it’s a stumper this time. Problem: basics of PHP work – variable assignments, include files, etc. – but errors ALWAYS occur with ANY function; usually “Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING”. As I say this is the result of any function, simple or otherwise. Laughingly, the function that does work is “function_exists(’somefunction’)”. I surmise it may be permissions or something similar but I can’t seem to get a solid lead. Any pointers would be welcome.

    OS X 10.5.3, PHP 5.2.5, Apache 2, php.ini file in /etc has include_path = “.:/usr/local/php5/include”, /etc/apache2/httpd.conf configured correctly.

  130. isorabins says:
    6/17/2008 at 7:39 pm

    Has anyone had trouble finding #LoadModule php5_module libexec/apache2/libphp5.so in /private/etc/apache2/httpd.conf.
    I find the file, but that line doesnt seem to exist.
    Thanks

  131. Luca says:
    7/10/2008 at 10:02 am

    Thanks so much for this post.It was really helpful

    Luca

  132. driver says:
    7/15/2008 at 4:36 am

    hi,
    Sorry #ln —one you want— -s php I used XHTML tags to mark the text after ln on the earlier post, and of course the text and tags disappeared.
    thanks.

  133. codepoetry | Using PHP and a Shell Script to Reboot an AppleTV Remotely — via the web says:
    7/22/2008 at 9:30 am

    [...] Configure Apache to run PHP on your Mac (these instructions are for Leopard, but similar ones are out there for Tiger) [...]

  134. brett-reid.com » Blog Archive » Windows to Mac conversion says:
    7/23/2008 at 11:22 am

    [...] Working with PHP and Leopard [...]

  135. Eric says:
    7/25/2008 at 3:44 pm

    Hi and thanks this is a good tutorial.
    I was wondering if you or anyone knows how or if it is possible to upgrade the bundled versions of both Php and Apache that ships with Leopard. How deep are they bundled? (meaning: do they just come as preinstalled or are they really deep and mixed into the system (or something like that)).?

  136. PHP says:
    7/31/2008 at 12:34 am

    It is indeed a very comprehensive tutorial for PHP on mac. Lot of help on PHP with windows is available but quality resources like this for other operating systems rare.

  137. Setting up PHP, MySQL, and Apache in Mac OSX Leopard… · superfancy says:
    8/12/2008 at 10:23 pm

    [...] procata.com: This was the best resource I found and well worth checking out as it shows you how to install the PEAR extension. Has a some great tips that I didn’t cover here. [...]

  138. Sumeet says:
    8/13/2008 at 8:36 am

    I created Virtual Hosting as directed above but i cannot the sub directories i created. Like i entered ‘r’ as a new site in the file now where do i find this directory. I searched almost everywhere.

  139. Jesse says:
    8/13/2008 at 3:17 pm

    I cannot find the /etc/apache2/httpd.conf file? I typed it into spotlight. How do we open that?

    Thanks all!

  140. jitesh Shetty says:
    8/15/2008 at 4:56 pm

    Thank you very much, this is just awesome and was of great help.

  141. Erik Eldridge Blog / Working with PHP 5 in Mac OS X 10.5 Leopard - Professional PHP says:
    8/15/2008 at 6:00 pm

    [...] Working with PHP 5 in Mac OS X 10.5 Leopard – Professional PHP. Post a comment — Trackback URI RSS 2.0 feed for these comments This entry (permalink) was posted on Friday, August 15, 2008, at 4:58 pm by erik. Filed in tutorial. [...]

  142. Massimo says:
    8/17/2008 at 1:52 pm

    Very good tutorial, really of good help! I found it by googling. Thanks!
    I made a widget to start and stop the MySQL server for Loepard; in this way I don’t have to leave an application open during work, but only a widget.
    If interested, you can find it at http://www.inerziasoft.eu/en/soft/mysql.html.

  143. 23 Essential Tools For Web Development on a Mac | Web Jackalope says:
    8/18/2008 at 1:54 pm

    [...] ships with MAMP, so installation is a breeze. If you’re not MAMP, then you’ll have to configure PHP to run on your Mac, which is a much more involved process. Still, phpMyAdmin is a tried and tested solution for [...]

  144. Digressions and Other Inconsistencies » Beginning PHP on a Mac says:
    9/10/2008 at 11:05 am

    [...] of the first challenges was to figure out how to get it working on my Mac.  After following this tutorial on how to enable the version of PHP that comes with OS X Leopard, the Apache web server, and [...]

  145. Iman says:
    10/2/2008 at 12:56 pm

    I have leopard Mac OS X VERSION 10.5.4.
    I installed php Apache. SQL. I also enabled PHP. BUT WHEN ENTERING in Terminal sudo cp *.conf /private/etc/Apache2/users or cd /private/etc/httpd/users. I KEEP GETTING THE MESSAGE BELOW
    cp: *.conf: No such file or directory.
    I have httpd.CONF in the HD PRIVATE.
    What do you think it canbe wrong. I spend 2 days trying to fix this but i get the same message.No such file or directory.

  146. Mihai says:
    10/11/2008 at 10:40 am

    Hi,

    I run Leopard and have followed the tutorial hoping to be able to start my Apache server, unfortunately it still doesn’t work. When I type http://localhost/ into my browser I get the error message

    Safari can’t find the server.
    Safari can’t open the page “http://localhost/” because it can’t find the server “localhost”.

    I’ve been trying to start this Apache server for hours now, do you have any ideas for helping me out?

    Thank you,
    Mihai

  147. LAMP on Leopard - Not So Wise says:
    10/12/2008 at 3:04 am

    [...] need to enable root user, for see the official help here.If you want your own version of PHP, see reference here. I got version 5.2.6 from that came with Leopard.Leopard has PHP built-in so I just need to [...]

  148. Katrina says:
    10/15/2008 at 3:39 am

    Thanks for all this instruction.

  149. jaffle says:
    10/24/2008 at 2:43 am

    A simpler way to make php to work with the default installation of MySQL is to change the default setting in php for the mysql.sock file…

    I added

    php_value mysql.default_socket /tmp/mysql.sock

    to the /private/etc/apache2/other/php5.conf

    file (in between the tags of course)

  150. westbright.com » Blog Archive » Fixing PHP PDO after Mac OS X Update says:
    11/7/2008 at 3:01 am

    [...] layer, not those database specific mysql_* functions. So I followed the instructions at HiveLogic and [...]

  151. Andy V says:
    11/12/2008 at 9:58 pm

    Excellent tutorial. I’m work the day shift as a software engineer and this was perfect for me. No cruft, no BS, I got up and running fast. Nice job.

  152. Tobman’s Project: WebMoney » Setting up cakePHP on Mac OS X says:
    11/13/2008 at 5:17 am

    [...] order to run cakePHP we need to activate PHP. This guide basically gives you all the info you need to succeed with this task. In this article you will also [...]

  153. Casper says:
    11/15/2008 at 4:43 pm

    You. Are. Amazing.

    VERY well written tutorial, it worked perfectly first time around!!

    Cheers!

  154. Wolfgang says:
    11/22/2008 at 8:00 am

    Very good Tutorial – perfect for me as Mac-newbie!
    The only problem i ran in was the configuration of name based hosts with an Apache “forbidden error”.

    As I added after NameVirtualHost *:80

    DocumentRoot /Library/WebServer/Documents
    ServerName localhost

    now verything is doing fine with virtual hosts.
    Thank You!

  155. Diana says:
    12/5/2008 at 9:23 am

    Outstanding tutorial, so many thanks to you for taking the time to publish this.

  156. Diana says:
    12/5/2008 at 1:14 pm

    method described for installing pear no longer works.

    curl “http://cvs.php.net/viewvc.cgi/pearweb/public_html/go-pear?revision=1.118&view=co” | php

    however, I’m running into permission problems with the default usr/local/ directory, to permit the pear installation; the installer can’t create the sub-directories.

  157. Paul says:
    12/14/2008 at 9:44 am

    Hi,
    I am as close to a php novice as there is.
    I do not know very much about php at all. I am a pretty good html writer and basic actionscript but thats about the extent of my skills. I am trying to learn php.

    I tried to setup my leopard mac with a php tut on vtc.com. I tried to install one of the php packages of php.net but then at the end of install my mac said install failed. Then I tried to install a different one that said it worked. But the commands I type in terminal to try and follow the tutorial say the directory isnt set up and so forth. I think I need to reset everything and start over. Is there a way I can reset the files I made and restore my php and mysql settings to default?

    Thanks!

    Paul

  158. T=Machine » How to install PEAR on OS X 10.5 says:
    12/27/2008 at 4:54 pm

    [...] Apache2. If you’ve enabled OS X’s built-in copy of Apache2, then just go to System Preferenes, select “Sharing”, UNcheck the “web [...]

  159. Setting Up Apache, MySQL and PHP on OS X Leopard • Blog Archive • Blog of Auzigog says:
    1/3/2009 at 5:51 am

    [...] OS X PHP/PEAR guide Share and Enjoy: [...]

  160. Daniel Wabyick says:
    1/6/2009 at 5:21 pm

    Thank you for this very helpful article!

  161. Working with PHP 5 in Mac OS X 10.5 (Leopard) - Professional PHP « llbbl says:
    1/8/2009 at 10:01 am

    [...] via Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP. [...]

  162. Bruce Porter says:
    1/17/2009 at 10:46 am

    A little help, please. I’m stuck at “Enabling a Personal Website”, working with Leopard 10.5.6.

    Before creating my “bruceporter.conf” file, the URL for “Your computer’s website:” works, and I can serve up info.php.

    I create “bruceporter.conf”, with the virtual hosting directives, but cannot get the “Your personal website:” URL to work, or “http://mysite/” (I get the “Forbidden” message).

    I have index.php in the bruceporter/mysite directory. I have /etc/hosts set with an alias. I’ve rebooted, checked spellings, and gone back to square one myriad times.

    What I am missing?

  163. YC Wee says:
    2/2/2009 at 7:35 pm

    PHP is a great programming language… and the Mac is a superb programming platform.. While most people may somewhat know the former, there are a large number of programmers who still believe that Mac is for graphic designers…

    However, having said that, while the Mac has the great console of unixes and linuxes, and a very elegant UI desktop system, their WYSIWYG development tools are very limited. I would say that where Windows user has Dreamweaver and Frontpage, the Mac has almost nothing ( not any good ones as of Feb 2009 )… and now frontpage is yet evolving again into expression web…

    Use Mac for c/c++ unix/linux development, or for Mac based UI stuff.. and console based scripting..If u need to do websites.. I firmly believe that Windows ( for all its viruses, bugs and evil quirks ) still has the best visual tools for development.

  164. MikeC says:
    2/17/2009 at 9:15 am

    How do you load a module on a Mac? I’ve never done so and having some trouble. I’m pretty much trying to load the calendar.so. Any tips?

    http://au2.php.net/manual/en/calendar.setup.php

    Thanks!

  165. Running php4 & php5 on Mac OSX 10.5 at Encoded | Gregory Tomlinson says:
    2/23/2009 at 3:39 pm

    [...] There is a very simple toggle for running php4 or running php5 built into Mamp. I am also using the native php5 build that ships with Mac OSX 10.5. Published by gregory on February 23, 2009 in Projects and Servers [...]

  166. How to set up Mac OS X 10.5 for Web Development - The Disgruntled Developer says:
    2/24/2009 at 2:23 am

    [...] Just not yet…I’m going to bed. But so far, this has been a helpful tutorial. [...]

  167. stephanhahn.ch » Apple Leopard - Probleme mit apache , php und mysql « says:
    2/25/2009 at 2:29 am

    [...] upgrade auf die Leopard Version von Mac OSX hat man probleme mit dem Apache , Php und Mysql. Auf dieser Seite findet man die Lösung dazu. Tags » Trackback: Trackback-URL | Feed zum [...]

  168. Chase Adams says:
    3/16/2009 at 7:49 pm

    I’ve been using Lynda.com for mysql & php. I’ve been stuck on why my php won’t show up. You’re a life saver. Thank you thank you thank you!

  169. Carol Deckelbaum says:
    3/22/2009 at 11:03 pm

    I am a recent mac convert, trying to setup my testing environment on my brand new iMac. Your article has been very helpful. I am still having one small problem I’m hoping you can help me with. My virutal hosts are all set up and working – except the php code doesn’t run when the file has an .html extension. I have added “AddType x-mapp-php5 .html .htm” to my .htaccess file. I also tried adding
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    to httpd.conf.

    neither of these helped (after retarting the server).

    Any ideas you could throw my way would be greatly appreciated…

    Thanks,
    Carol

  170. …is now an Apple Developer! « too//damn//ninja says:
    4/9/2009 at 1:57 am

    [...] file” without first telling you what file it’s on about, or where it is) but i found a much more helpful page… which also suggested installing ‘Text Wrangler‘, a fully functional (and free i [...]

  171. Gemini77 says:
    4/14/2009 at 6:43 am

    Hi, thanks to this web page I found out the solution to a problem that was driving me crazy! Re adding a username.conf file to my /etc/apache2/users/username.conf

    Perfect! Cheers once again.. Im book marking this page!

  172. MeIr says:
    4/23/2009 at 6:24 pm

    Thanks dude, that was helpful.
    P.S. By the way don’t you think it is unsecure to allow people insert tags into comments on the website?

  173. Working with PHP 5 in Mac OS X 10.5 (Leopard) - Professional PHP says:
    4/25/2009 at 9:54 pm

    [...] View original post here: Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP [...]

  174. Ziorufus » Un server web completo su Mac Os X says:
    5/1/2009 at 4:22 pm

    [...] da questo articolo, spero di riuscire a spiegare al mondo come configurare e installare un server web su Mac Os X, [...]

  175. Michael Boudreau says:
    5/8/2009 at 6:54 pm

    I too would love to see instructions for recompiling PHP on Leopard.

    I want to use the ‘mailparse’ functions for an email project. It happens that the last recipe in O’Reilly’s “PHP Cookbook” (2nd ed) is about installing PECL extensions, and it uses ‘mailparse’ as the example. The recipe implies that all one has to do is run the ‘pecl install mailparse’ command and then add ‘extension=mailparse.so’ to the php.ini file. I did this much and restarted apache, but I get an ‘undefined function’ error when I try to invoke any of the functions.

    The PECL documentation says I need to recompile PHP to enable mailparse.

    Does this mean the PHP Cookbook instructions are incomplete? If not, where should I be checking for an error? If so and I need to recompile, has anyone done this before without too much hassle?

  176. 23 Essential Tools For Web Development on a Mac | Geeky Bitch says:
    5/14/2009 at 4:28 pm

    [...] ships with MAMP, so installation is a breeze. If you’re not MAMP, then you’ll have to configure PHP to run on your Mac, which is a much more involved process. Still, phpMyAdmin is a tried and tested solution for [...]

  177. Hutch says:
    5/16/2009 at 1:21 pm

    For all those on about recompiling php for mac may have a sweeter answer in the form of someones already done it for you.

    http://www.entropy.ch/software/macosx/php/

    Read, Install, Enjoy!!! :)

  178. aankun says:
    6/4/2009 at 3:56 pm

    great one.
    but one thing i got this error “Cannot load mcrypt extension. Please check your PHP configuration.” while loading phpmyadmin.
    any solution??? help !!!

  179. Unable to connect to MySQL from PHP (on Mac OS X) | andygoh.net says:
    6/17/2009 at 7:17 am

    [...] After asking for help from Colin, who gave me a head start and some google’ing, I found a solution. [...]

  180. hootoo says:
    7/6/2009 at 8:59 pm

    Cannot load mcrypt extension. Please check your PHP configuration.”

  181. hootoo says:
    7/7/2009 at 12:39 am

    I’ve been using Lynda.com for mysql & php. I’ve been stuck on why my php won’t show up. You’re a life saver. Thank you

  182. Simon Clarke says:
    8/13/2009 at 10:00 am

    Thank you very much.

    I’m still new to website publishing and have found this very helpful. The one problem I am having is that I want Apache2 and PHP to work with a ‘non standard’ directory: /Users/$USERNAME/Documents/Web_Development with subfolders being treated as virtual hosts. Applying the above method to this path and not the ~/Sites path does not appear to work – or rather I can’t figure out how to make it work…

    Any pointers gratefully received

    //simon

  183. Kailash Thakur says:
    8/13/2009 at 12:31 pm

    These instructions are great! Really helped me to get things sorted out on my local machine. Thank you, thank you, thank you.

  184. Nathan Roth says:
    8/16/2009 at 12:33 pm

    Hey all. I’m having problems with this, again. Initially everything was fine and I made all the changes and everything was running. But, I recently had to restore my system because of a bad update and can no longer establish a connection to the local testing server despite everything being in place (at least as far as I can tell). Can someone please help reestablish this connection??

  185. PHP 5.3.0???????? - JustOnePlanet Admin Blog says:
    8/23/2009 at 7:28 pm

    [...] Bring the mysql.sock to PHP [...]

  186. Apache, PHP, and MySQL in Leopard « Whimsical.Nu says:
    8/25/2009 at 10:07 am

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) (also has information on setting up PEAR) [...]

  187. Fixing Web Sharing after the Snow Leopard install says:
    8/28/2009 at 6:30 pm

    [...] great article before for instructions on enabling the built-in PHP5 functionality of 10.5 Leopard (this article is not so bad either), but with 10.6 Snow Leopard install I did today, I found that I was getting [...]

  188. Eric Stefanski says:
    9/19/2009 at 11:12 am

    Your instructions were so simple and straightforward that I was up all night wondering why they didn’t work for me. I think the answer is that ’something’ that should be pointing to the php5.conf file isn’t, so that there was no appropriate MIME type in httpd.conf to handle PHP, so I just ended up with the text of info.php being displayed. I manually updated the MIME types (and the directory index to accept index.php), and that fixed it.

    This is with factory-installed Snow Leopard, updated to 10.6.1 before I started configuring Apache, so maybe there’s been a little change. (I guess it’s also possible that, since php5.conf calls for DirectoryIndex to contain index.html and index.php, that my having already expanded the list of directory index files–index.htm, default.htm, etc.–kept it from doing what it’s supposed to.)

    At any rate, thank you for a good, straightforward article, without which I would have been unable to get myself into such a perplexed state, much less work my way through it!

  189. Et Cetera » And so it begins… says:
    10/31/2009 at 12:12 am

    [...] PHP, with phpicalendar [...]

  190. Environment Consistency – PHP « Developing Software in J2EE says:
    11/18/2009 at 11:12 am

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) [...]

  191. Mobile tracking says:
    11/18/2009 at 10:47 pm

    I am having problems with php5, personally I prefer php4 so I never enable php 5 in my website or blog.

  192. Insteon says:
    11/26/2009 at 1:02 pm

    It’s great to have a local testing environment back – thanks.

  193. Spotted cat | BenCrowder.net says:
    12/18/2009 at 9:18 am

    [...] It was rather worrisome (and my Internet connection was acting up at the time), but then I found Working with PHP 5 in Mac OS X 10.5 (Leopard) and it solved that problem. Phew. [...]

  194. Vlatro says:
    1/21/2010 at 11:29 am

    Cannot load mcrypt extension. Please check your PHP configuration.” +1!!!
    ______________________________________________________________________
    | |
    | Cannot load mcrypt extension. Please check your PHP configuration.” | +1!!!
    | |
    ———————————————————————–
    How to install mcrypt?

  195. Michael says:
    2/10/2010 at 8:49 am

    I am stilling getting “You don’t have permission to access /~michael/ on this server” When i try to acces “http://localsite/~michael/” . I changed my /etc/apache2/michael.conf file to “AllowOverride All”. Any help would be great.

  196. More Arduino + LCD + PHP fun « Arduinian Tales says:
    2/11/2010 at 1:56 am

    [...] http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/ (helpful to get PHP running properly on 10.6) [...]

  197. GrindSmart » Blog Archive » 18 Essential Apps For Web Development on a Mac says:
    2/24/2010 at 2:21 am

    [...] It ships with MAMP, so installation is a breeze. If you’re not MAMP, then you’ll have to configure PHP to run on your Mac, which is a much more involved process. Still, phpMyAdmin is a tried and tested solution for [...]

  198. GrindSmart » Blog Archive » 18 Essential Apps For Web Developers Using on a Mac says:
    2/24/2010 at 2:23 am

    [...] It ships with MAMP, so installation is a breeze. If you’re not MAMP, then you’ll have to configure PHP to run on your Mac, which is a much more involved process. Still, phpMyAdmin is a tried and tested solution for [...]

  199. ScooterCharger says:
    4/4/2010 at 8:09 pm

    I once had a VPN problem before when accessing back to my intranet at home from hotel or airport so I changed my intranet IP address range from 192.168.0.x to 92.68.0.x. Accessing the web server running on my Leopard laptop from the same laptop was just fine as expected, but when accessing the same server from other computers on the same intranet (within 92.68.0.x range), the browser always times out. It looks like the browser was trying to retrieve the page from the internet but not the intranet.

  200. ScooterCharger says:
    4/4/2010 at 8:18 pm

    Btw, I also had WinXP running from VMWare Fusion and the Network Adaptor Setting in Fusion was ‘NAT’, it was fine accessing to the server at 92.68.0.x from Internet Explorer from the Fusion. Should I change the intranet IP range back to 192.168.0.x? The VPN problem I had at Dallas Airport a year ago was that the coffee shop offered free internet and my laptop was given an IP address 192.168.0.xxx which happened to be the same as my intranet. My VPN was fooled into thinking that the VPN connection was already made.

  201. Herbert G. Fischer says:
    5/19/2010 at 2:36 pm

    IMHO It’s more easy to just configure mysql.sock to /tmp/mysql.sock inside php.ini.

    Just set this values:

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

  202. links for 2010-07-06 | Digitalistic - Mashup or die trying says:
    7/6/2010 at 7:05 am

    [...] Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP (tags: apache lamp php php5 osx macosx mac pear mysql install) [...]

  203. Working with PHP 5 in Mac OS X 10.5 (Leopard) | PHP SPain Blog says:
    7/23/2010 at 1:09 pm

    [...] Continue reading/Seguir leyendo This entry was posted in Programming and tagged php, web. Bookmark the permalink. ← ¡Hola mundo! php | tek 2008 → [...]

  204. Melania Pinchock says:
    7/28/2010 at 5:44 am

    Nice post man Thanks

  205. lehuuphuc says:
    8/25/2010 at 7:37 pm

    Hi, thanks much!

  206. Jack says:
    11/9/2010 at 5:03 am

    Can anybody explain why HTTP Error 400 generate sometime with comment having rough text (like :/\#%*.weq qeq). This generate only on my web server not on
    localhost

  207. Mac OS Snow Leopard: Why does my mysql.default_socket value not change in my phpinfo() page? says:
    11/22/2010 at 10:23 pm

    [...] http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/ September 7, 2010 7:44 am Anonymous Thank you so much for the awesome answer. Renaming the [...]

  208. Gastromid says:
    12/11/2010 at 1:44 am

    I’ve gotten valuable freelance jobs that teetered on replying to an email less than an hour after getting the first. I’ve come up with ingenious ideas when a friend burst into my room to strike up a random conversation.

  209. Devall Krem says:
    12/11/2010 at 2:01 am

    If serializing is prioritized over habits then won’t serialized project approach cause you to constantly work on the next group project? As project time is impossible to calculate you will eventually have to breach particular habit times.

  210. Luke Jaten says:
    1/5/2011 at 5:10 pm

    Great sit, I really enjoyed this post. Keep up the good work!

  211. Chuck says:
    2/23/2011 at 9:08 pm

    Good overall article, but I have to admit that I got quite confused with how to set this up and ran into some trouble along the way. I found this site that didn’t go into as much detail, but it did help me get setup. Hopefully it will help someone else out, too: http://www.sirtechalot.com/how-to-be-a-web-developer/how-to-setup-apache-and-php-5-on-mac-osx/

  212. » Enable Apache and PHP on Mac OSX Snow Leopard (10.6) Niltz Designs says:
    3/7/2011 at 8:25 pm

    [...] are many articles on the web related to enabling Apache and php on OSX, but I found them to be overly complicated, or scattered, [...]

  213. dntargu says:
    5/15/2011 at 12:21 am

    I have read many other walk throughs on how to use my mac’s apache server with php. I was unsuccessful UNTIL NOW… You were very detailed and explained how to perform this task.

    IT WORKS!!!

    Thank You!

  214. Miguel Paredes says:
    6/8/2011 at 10:23 am

    I saw the tutorial about installing in php at lynda.com but they got the steps wrong unlike you, thanks for sharing this, it worked for me following your steps.

  215. Mark says:
    6/22/2011 at 5:20 pm

    I was having huge problems setting up virtual hosts on my Mac in my Sites directory and went through countless directions. I finally found your page and it was the only one that worked.

    Thank you!

    I’ll be a regular reader of this blog

  216. Margarite Salameh says:
    7/25/2011 at 11:14 am

    While I in the beginning commented at http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105 I clicked on the – “notify me”- checkbox and now each and every time a remark is included on Working with PHP 5 in Mac OS X 10.5 (Leopard) – Professional PHP web site, I get a number of electronic mails with the related feedback. Perhaps there is in whatever way it’s possible to remove myself through that service? Thanks!

  217. Where are the PHP directories on Mac OS X? - Admins Goodies says:
    8/22/2011 at 9:16 am

    [...] Another article: Working with PHP 5 in Mac OS X 10.5 [...]

  218. Great Developer Tools for Mac » doap.com says:
    10/2/2011 at 4:12 am

    [...] It ships with MAMP, so installation is a breeze. If you’re not MAMP, then you’ll have to configure PHP to run on your Mac, which is a much more involved process. Still, phpMyAdmin is a tried and tested solution for [...]

  219. Caught in a Web » Installing Apache and PHP with MacPorts says:
    10/14/2011 at 3:54 pm

    [...] changes in httpd.conf/php.ini files. You can probably find tons of tutorials on that topic (try this one for example) so not gonna waste my time on explaining how to do [...]

  220. Setting up PHP, MySQL, and Apache in Mac OSX Leopard - Superfancy Industries says:
    2/15/2012 at 12:01 pm

    [...] procata.com: This was the best resource I found and well worth checking out as it shows you how to install the PEAR extension. Has some great tips that I didn’t cover here. [...]

  221. tony says:
    2/27/2012 at 6:06 pm

    thanks for this….nice to read a plain english version of how to run PHP on OSX…and it works!

  222. Enable Apache and PHP on Mac OSX Snow Leopard (10.6) | Niltz Designs says:
    3/14/2012 at 5:24 pm

    [...] are many articles on the web related to enabling Apache and php on OSX, but I found them to be overly complicated, or scattered, [...]

  223. Config apache2 trên Mac OSX – Không t? b? qua index.php – Note says:
    7/2/2012 at 2:38 am

    [...] http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/ [...]

    Subscribe Feed
    Share Subscribe to this blog…
    Share Bookmark or share this page…
  • About

    My name is Jeff Moore. I'm a PHP programmer living in San Francico and working for a startup.

    More about me…

  • Categories (Home)

    • Agile Methods (14)
    • Mac (14)
    • Misc (18)
    • Open Source (14)
    • PHP (99)
    • Software Design (29)
    • Usability (14)
    • Web Design (20)
  • Recent Comments

    • rsync to remote server via ssh  37
      Petr Halounek, Penni Tomasino, Rodney Kohnen [...]
    • WordPress BBCode Plugin  30
      wepniveth, Pamella Philipps, evakuat [...]
    • PEAR Templates  18
      Sang Bellotti, Kandice Sansing, car insurance estimates for teenagers [...]
    • Extreme Simplicity  15
      Gilbert Moatz, Roni Beauregard, Barb Geyer [...]
    • Manual Memory Management is Dead  6
      Grass Fed Filet Mignon, Kellie Carello, PAPANDOR [...]
    • Friendster wrapup: does MySQL scale  38
      Ollie Joya, nfl jersey on sale, selling scrap gold [...]
    • The Coding Apprentice  51
      fkawau, Annamae Mccane, Boca Raton Personal Injury [...]
    • The Legality of Republishing RSS Feeds  30
      dasfdsfsd, reebok authentic nfl jersey, Tory Rennemeyer [...]
    • Exceptional PHP  7
      Sports, The Click, Laraine Waterhouse [...]
    • PDO versus MDB2  42
      selling silver coins, Oliver Luongo, ddkoaorpa [...]
  • Recent Posts

    • Richard Thomas
    • ZendCon: Writing Maintainable PHP Code
    • Looking Towards the Cloud
    • Holiday Tech Support
    • Closures are coming to PHP
    • php | tek Wrapup
    • php | tek 2008
    • Sarah Snow Stever
    • Benchmarking PHP’s Magic Methods
    • The Endpoints of the Scale of Stupidity on Video
  • Site

    • Archives
    • Log in
  • Search