1. First enable the root user SystemPreferencesUsersandGroups lower left Loginoptions lower right corner joinOpenDirectoryutility... setting root Password 2. Enable PHPOSXMountainLion pre-installed PHP5.3.13 but not enabled by default. Enable T
1. first, enable the root user System Preferences Users and Groups to join Open Directory utility in the lower-left Login options lower-right corner .... edit menu in top menu Enable root user. set the root password 2. enable php OS X Mountain Lion with PHP 5.3.13 preinstalled but not enabled by default.
1. FirstEnableRoot User
System Preferences
Users and Groups
Login options in the lower left corner
Join in the lower right corner
Open Directory utility ....
Edit menu in top menu
Enable root user.
Set root Password
2.EnablePHP
OS X Mountain Lion is pre-installed with PHP 5.3.13 but is not enabled by default,
Open Terminal,
Enter sudo nano/etc/apache2/httpd. conf to edit httpd. conf,
Search for php by Control + W and find: # LoadModule php5_module libexec/apache2/libphp5.so,
Remove the # Before this line,
Control + O save,
Control + X exit,
Return to the terminal and enter:
Login root
Enter Password
Enter apachectl restart,
PHP has been enabled properly,
3. Edit the php source code.
You can upload a PHP file named at will under the Library/WebServer/Documents directory,
For example, enter info. php In this php file. ,
Then access "localhost/info. php" in the browser ",
The detailed php configuration environment information is displayed.