Home  >  Article  >  Backend Development  >  Overview of the integration process of macos+apache+php+phpmyadmin_PHP tutorial

Overview of the integration process of macos+apache+php+phpmyadmin_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:34:50810browse

Start Apache

There are two methods:

In this way, enter "http://localhost" in the browser, you can see a page with the content "It works!", which is located under "/Library (resource library)/WebServer/Documents/", this This is the default root directory of Apache.

Run PHP

Install MySQL

Mac OS X does not have built-in MySQL, so you need to install it manually. Currently, the most stable version of MySQL is 5.5. MySQL provides installation instructions for Mac OS X.

Note: Upgrading of Mac OS Changes have occurred, just run "Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' ". /usr/local/mysql/data sudo chown -R mysql /usr/local/mysql/dataIn addition, when using PHP to connect to MySQL, the error "Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'" may be reported, or using localhost cannot connect to MySQL and requires 127.0.0.1, because the connection PHP looked for

by default, but the MAC version of MYSQL changed the file location and placed it under /tmp. The solution is to modify php.ini as follows:

/var/mysql/mysql.sock

Use phpMyAdmin
<code>mysql.default_socket = /tmp/mysql.sock<br /></code>

phpMyAdmin is a program developed in PHP to manage MySQL. It is very popular and practical. Being able to use phpMyAdmin to manage MySQL is a very effective way to test the effectiveness of the previous steps. This is mainly applied in the recent research on

phpcms

. The steps are as follows:

Solution
<code><br /><br /><span><span <strong>关于错误处理:</strong></span><br /></span></code>

Copy config.sample.inc.php to config.inc.php
<code></code>

This error occurs, indicating that there is no connection to the database. Modify the config.inc.php file,

<code></code>
Set $cfg['Servers'][$i]['host'] = 'localhost';
<code></code>
Change to $cfg['Servers'][$i]['host'] = '127.0.0.1';
<code></code>
<code></code>
-------------------------------------------------- ---
<code></code>

<code></code>or

modify php.ini: mysql.default_socket = /tmp/mysql.sock

<code></code>

#1045 Unable to log in to MySQL server . Access denied for user 'root'@'localhost' (using password: YES)

Cause of the problem: This may be due to the failure to set the mysql password previously, which resulted in us being unable to log in to the server using the set mysql root password.

Solution: At this time, you can try to log in to the database using the empty password of the mysql default root account.

If an empty password appears again when logging in:

error. Then you need to modify the /phpmyadmin/config.inc.php file and find the following two lines

$cfg['Servers'][$i]['nopassword'] = false;

$cfg['Servers'][$i]['AllowNoPassword'] = false;


Change the two false to true and set

$cfg['Servers'][$i]['password'] = ''; Set the configuration file like this After that, phpmyadmin will allow logging in to the mysql database with an empty password. If you still cannot log in to phpmyadmin with an empty password again, please clear the cookies or close the original phpmyadmin login window and log in again with an empty password.

If it still shows that login with an empty password is prohibited, try entering a few characters as a password to see if you can log in successfully.


After logging in to the mysql server, change the mysql password in phpmyadmin as soon as possible.

http://www.bkjia.com/PHPjc/750100.html

truehttp: //www.bkjia.com/PHPjc/750100.htmlTechArticleThere are two ways to start Apache: Enter http://localhost in the browser and you will see a The page whose content is It works! is located in /Library/WebServer/Document...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn