Macos + apache + php + phpmyadmin integration process organization _ PHP Tutorial

Source: Internet
Author: User
Macos + apache + php + phpmyadmin integration process. There are two ways to start Apache: enter localhost in the browser, and you can see that the content is Itworks! In the Library WebServerDocument to start Apache

There are two methods:

In this way, enter "http: // localhost" in the browser and you will see the content of "It works !" Is located under "/Library (resource Library)/WebServer/Documents/", which is the default root directory of Apache.

Run PHP to install MySQL

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

Note: The upgrade of Mac OS X or other causes may cause MySQL to start or automatically run upon startup. the prompt"Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' ", This should be caused by some circumstances/usr/local/mysql/dataThe host has changed, just run"sudo chown -R mysql /usr/local/mysql/data.

In addition, if you use PHP to connect to MySQL, the error "Can't connect to local MySQL server through socket"/var/mysql may be reported. sock '", or use localhost to connect to MySQL and 127.0.0.1 is required because php will find/var/mysql/mysql.sockBut MYSQL for MAC changed the file location and put it under/tmp. The solution is to modify php. ini as follows:

mysql.default_socket = /tmp/mysql.sock
Use phpMyAdmin

PhpMyAdmin is a MySQL management program developed with PHP. it is very popular and practical. Using phpMyAdmin to manage MySQL is a very effective way to verify the effect of the previous steps. This is mainly in the recent researchPhpcmsTo start the application, follow these steps:



About error handling:

Solution

Copy config. sample. inc. php to config. inc. php.

This error indicates that the database is not connected. Modify the config. inc. php file,
Set $ cfg ['servers'] [$ I] ['host'] = 'localhost ';
Change to $ cfg ['servers'] [$ I] ['host'] = '2017. 0.0.1 ';

--------------------------------------------------

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

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

Cause:This may be because the mysql password was not successfully set, so we cannot log on to the server using the configured mysql root password.

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

If you use an empty password to log on again: . 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 values to true, and set $ cfg ['servers'] [$ I] ['password'] = ''; after setting the configuration file, phpmyadmin allows logging on to the mysql database with an empty password.

If you attempt to log on to phpmyadmin again with an empty password, you may not be able to log on again. clear the cookie or close the original phpmyadmin logon window and use the empty password to log on again.

If the empty password is still disabled at this time, try to enter a few characters as the password to check whether the login is successful.

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

You can enter http: // localhost in the browser to view an It works file! Page, which is located in/Library (resource Library)/WebServer/Document...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.