Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lolajl

macrumors newbie
Original poster
What's the version of the Apache Server in Leopard? Is PHP included, and if so, what version?
 
Apache/2.2.6 and PHP 5.2.4 which is awesome.

PHP isn't enabled by default but all you need to do is uncomment a few lines in the httpd.conf.
 
To enable php

1) open terminal
2) cd /etc/
3) sudo cp php.ini.default php.ini
4) cd /private/etc/apache2/
5) sudo nano httpd.config
6) uncomment the two modules: php5_module and fastcgi_module. They were at line 114 and 115 for me.
7) Use ctrl and o to save
8) reload apache (can be done from system preferences).
 
Strange ... php.ini location

I installed Leopard at work and at home. The php.ini locations are different. Is there any way to have PHP use a different location for the php.ini file ?
 
To enable php

1) open terminal
2) cd /etc/
3) sudo cp php.ini.default php.ini
4) cd /private/etc/apache2/
5) sudo nano httpd.config
6) uncomment the two modules: php5_module and fastcgi_module. They were at line 114 and 115 for me.
7) Use ctrl and o to save
8) reload apache (can be done from system preferences).

Awesome! That worked great! So, how do I get MySQL working?:
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
 
Awesome! That worked great! So, how do I get MySQL working?:
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)

Found the answer on another forum. For anyone else having trouble, here's the solution:

you need to do the following in terminal.app when safe_mysql is running.

sudo mkdir /var/mysql/

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

Then restart apache.
 
Pdo_mysql

Please help. How do i turn pdo-mysql on for Leopard's native 5.2.4 php?
Thanks in advance,
V.
 
Found the answer on another forum. For anyone else having trouble, here's the solution:

you need to do the following in terminal.app when safe_mysql is running.

sudo mkdir /var/mysql/

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

Then restart apache.

The root issue is that in the php.ini file (as it comes with Leopard) it is never stated where the socket is, therefore the built-in MySQL default is used. While the above solution works, another answer is to open php.ini and edit the configuration for default socket name (around line 760):

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

This ought to do the trick.
 
Perhaps a cleaner way to fix the mysql.sock problem

We all agree that if you want the supplied version of php in Mac OS X Client to work with the default installation of MySQL (not supplied in Mac OS X Client) you need to change the default setting in php for the mysql.sock file...

A nice way of doing this is to add

Code:
php_value mysql.default_socket /tmp/mysql.sock

to the

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

file (in between the </IfModule> tags of course). In most cases the php.ini file does not exist, and instead of the complication of creating it and possibly altering it or allowing a security risk, this method even turns off if you disable php5 down the track! It will also cause no problems if Apple update php/MySQL down the track.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.