MAC is installed by default Apache and PHP, but need to use root user to enable, so follow my steps below to:
First, enable the root user
1. Select System Preferences ....
2. From the Display menu, choose Account.
3. Tap the lock icon and enter using the administrator account.
4. Click "Login Options".
5. Click the "Join" button at the bottom right.
6. Click on the "Open Directory Utility" button.
7. Click the lock icon in the Catalog Utility window.
8. Enter the Administrator account name and password, then click OK.
9. From the Edit menu, choose Enable Root user.
10. Enter the root password you want to use in the "password" and "Verify" fields, then click "OK"
Second, enable Apache
1. Enter the terminal application--utility--terminal
2. Enter SU return
3. Enter the root password
4. Start Apache, enter command apachectl start
5. Apache's home directory is:/libary/webserver/documents/
6. Open the browser input: HTTP://127.0.0.1/can see the output: it works!
Third, let Apache support PHP
1, command line input: vi/etc/apache2/httpd.conf
2, modify #loadmodule php5_module libexec/apache2/libphp5.so
Erase the #
3, command line input: Cp/etc/php.ini.default/etc/php.ini
4. Restart Apache
Apachectl restart
5. Create a new file in the/libary/webserver/documents/directory index.php to test whether PHP supports
Input:
<?php
Phpinfo ();
?>
6, enter in the browser: http://127.0.0.1/index.php if correct, you can output PHP information
Mac comes with Apache and PHP