How to use Apache-PHP-Mysql on Mac OSX

Mac OS Topics
Post Reply
Ageek
Sergeant
Sergeant
Posts: 22
Joined: Sat Aug 01, 2009 10:54 am

How to use Apache-PHP-Mysql on Mac OSX

Post by Ageek » Mon Jun 20, 2011 2:15 pm

Apache

With the Mac OSX installation Apache is installed to your system. You don't need to install it again. What you have to do it is configure and start the process.

Have look at the configuration file. First need to be the super user to edit the file

Code: Select all

$ sudo su
password:[give your login password]
# vim /etc/apache2/httpd.conf
You can see the default Apache2 configuration there. Then start the server.

Code: Select all

# /usr/sbin/apachectl start
Then open a browser and type http://localhost, then you can see the default page of apache.


PHP

PHP is also installed with the Apache2. Only you need to enable module.

Code: Select all

# vim /etc/apache2/httpd.conf
Uncomment the following line

Code: Select all

#LoadModule php5_module        libexec/apache2/libphp5.so
Restart the Apache2 to take this effect.

Code: Select all

# /usr/sbin/apachectl restart
Create test page to test the PHP. Create a file test.php in the document root of the apache /Library/WebServer/Documents/

Code: Select all

<?php
   phpinfo();
?>
Test the page http://localhost/test.php

You can place your php.ini by copying from the default php.ini.default

Code: Select all

# cp /private/etc/php.ini.default /etc/apache2/


MYSQL

You need to download .dmg of the Mysql Community server form the http://dev.mysql.com/downloads/mysql/ and install it
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: How to use Apache-PHP-Mysql on Mac OSX

Post by Neo » Sun Jul 31, 2011 10:43 pm

Excellent post. REP+
Post Reply

Return to “Mac OS”