Setting up Apache / MySQL / PHP on Snow Leopard Server

Apache
Turn on the Web service in Server Admin
Server Admin -> Select your server -> Settings -> Services
Select the Web checkbox
Click Save
Web should now appear on your Server Admin side pane
Start Web Service

or via terminal
[code lang=”bash”] sudo serveradmin start web
sudo serveradmin fullstatus web

[/code]

MySQL
Turn on the MySQL service in Server Admin

Server Admin -> Select your server -> Settings -> Services
Select the MySQL checkbox
Click Save
MySQL should now appear on your Server Admin side pane
Start MySQL service

or via terminal
[code lang=”bash”] sudo serveradmin start mysql
sudo serveradmin fullstatus mysql [/code]

PHP
In a terminal window edit /etc/apache2/httpd.conf

[code lang=”bash”] sudo nano /etc/apache2/httpd.conf [/code]

uncomment this line:
LoadModule php5_module           libexec/apache2/libphp5.so

Restart Apache
[code lang=”bash”] sudo apachectl restart [/code]

Create a phpinfo.php file and drop it in an active site directory or /Library/WebServer/Documents

[code lang=”php”][/code]

Browse to http://yourserverip/phpinfo.php or http://localhost/phpinfo.php to verify

Easy enough right? 🙂

  • Etri

    In Snow Leopard Server, the PHP step can also be accomplished from within Server Admin:
    Select server -> Web -> Settings -> Modules

    Here you can select PHP (php5_module) by checking it and click on the ‘Save’ button.

  • Mburke

    I have a development system running Snow Leopard Server on a MacMini with Apache/PHP/MySQL and also a production system running the same software on an Xserve. The two systems have the same software with the same version numbers and the same build numbers. When I run phpinfo it shows the MacMini having 64-bit Apache, MySQL and PHP. However phpinfo on the Xserve shows 64-bit Apache & MySQL but 32-bit PHP. How do you force 64-bit code for PHP?

    My reason for caring is because the exact same web code on the MiniMac works as expected but does not not on the Xserve. I am using Xajax and the MiniMac system sends the <XML code as expected but the Xserve system sends 2 extra bytes that result in a blank link appearing prior to the <XML code. This of course breaks the XML code completely.

    I can't see how the same version and build of the PHP code would cause this difference between the 32-bit and 64-bit object but that is the only straw I have to grasp at the moment.

    Any help would be appreciated.

  • Mburke

    That didn’t work… the “XML” tag in my message was not ignored.

    My reason for caring is because the exact same web code on the MiniMac works as expected but does not not on the Xserve.

    I am using Xajax and the MiniMac system sends the “XML” code as expected. However the Xserve system send the “XML” code with 2 extra bytes at the beginning that result in a blank line preceding the actual XML tag. This or course breaks the “XML” code and the website does not get the desired data. I assume the extra 2 bytes are CR/LF. 
    I can’t see how the same version and build of the PHP code would cause this difference between the 32-bit and 64-bit object but that is the only straw I have to grasp at the moment.