Launch Apache
There are two ways of doing this:
So enter "http://localhost" in the browser, you can see a content of "It works!" Page, which is located under/library (Resource Library)/webserver/documents/, which is the default root directory for Apache.
Running PHP
Install MySQL
Mac OS x does not have built-in MySQL, so it needs to be installed manually, and the most stable version of MySQL is now 5.5. MySQL provides installation instructions under Mac OS x.
Note: Mac OS x Upgrades or other reasons may cause MySQL to start or boot automatically when the MySQL operator panel will prompt " Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql'
", this should be caused in some cases /usr/local/mysql/data
the host has changed, only need to run " sudo chown -R mysql /usr/local/mysql/data
".
Also, using PHP to connect MySQL may error "can ' t connect to local MySQL server through socket '/var/mysql/mysql.sock '", or using localhost can not connect to MySQL and need 127.0.0.1, because PHP by default when connecting to find /var/mysql/mysql.sock
, but the Mac version of MySQL changed the file location, placed in/tmp. The approach is to modify php.ini as follows:
mysql.default_socket = /tmp/mysql.sock
Using phpMyAdmin
phpMyAdmin is a PHP-developed program for managing MySQL, which is very popular and practical. Being able to manage MySQL with phpMyAdmin is a very effective way to test the previous steps. This was mainly applied in the recent study of Phpcms , with the following steps:
关于错误处理:
Solve< span="">
Copy the config.sample.inc.php into config.inc.php
This error indicates that no connection to the database has occurred. Modify the config.inc.php file,
Will $cfg[' Servers ' [$i] [' host '] = ' localhost ';
Instead of $cfg[' Servers ' [$i] [' host '] = ' 127.0.0.1 ';
--------------------------------------------------
or
Modify Php.ini:mysql.default_socket =/tmp/mysql.sock
#1045 cannot log on to the MySQL server . Access denied for user ' root ' @ ' localhost ' (using Password:yes)
Cause: This may be due to the previous setting of the MySQL password is not successful, so we use the set MySQL root password can not log on to the server.
Workaround: You can then attempt to log into the database using the empty password of the MySQL default root account.
If you log in with a blank password, it appears: < span=""> error. To modify the/phpmyadmin/config.inc.php file, locate the following two lines
$cfg [' Servers '] [$i] [' nopassword '] = false;
$cfg [' Servers '] [$i] [' allownopassword '] = false;
Change two false to true while setting $cfg [' Servers '] [$i] [' password '] = '; after setting the configuration file phpMyAdmin will allow you to log in to the MySQL database with a blank password.
If you re-login to phpmyadmin with a blank password, you may still not be able to log in, please clear the cookie or close the original phpMyAdmin login window and re-login with a blank password.
If this time still shows the blank password login is forbidden, try to enter a few characters as a password to see if the landing is successful.
Log in to MySQL server and change the MySQL password in phpMyAdmin as soon as possible.
http://www.bkjia.com/PHPjc/750100.html www.bkjia.com true http://www.bkjia.com/PHPjc/750100.html techarticle There are two ways to launch Apache: So enter http://localhost in the browser, you can see a content for it works! page, which is located in/library (Resource library)/webserver/document ...