Apache+php+mysql+navicat configuration under OSX system

Source: Internet
Author: User
Tags mysql version php and mysql

The OSX system is very friendly to PHP, we only need simple configuration to start using, this article will step by step to explain the installation and configuration of Apache, PHP and MySQL, paving the way for the start of development

Apache

Launch Apache Service

The Apache service is already installed on the MAC system and we just need to launch it directly using the following method

Enter the following command in the terminal to launch the Apache service

sudo apachectl start

Enter the following command in the terminal to view the Apache service version

sudo apachectl -v

In the browser, enter the following URL to check whether the Apache service started successfully

http://localhost http://127.0.0.1

If the Apache service starts successfully, the page will show it works!

Other configurations for Apache

Close Apache Service

Close the Apache service by entering the following command in the terminal

sudo apachectl stop

Restart Apache Service

Restart the Apache service by entering the following command in the terminal

sudo apachectl restart

Apache Service installation Path

Apache Service default installation path in /private/etc/apache2, belongs to the system Private directory, we do not find the path directly in the Finder

We can enter the path in two ways

    1. Enter the OPEN/ETC command into the ETC folder in the terminal

    2. Enter/etc in the go to folder from Finder, go to etc folder

Apache Service Deployment Path

Apache Service deployment path in /resource pool/webserver/documents/, our project needs to be placed under this path

If you want to modify the deployment path, you can find and open the httpd.conf file in the /private/etc/apache2 directory, search for documentroot , and modify the deployment path

Apache Service port number

The Apache service port number defaults to 80, if you want to modify the port number, you can find and open the httpd.conf file in the /private/etc/apache2 directory, search for Listen and modify the port number

Php

Before running our PHP, we need to change our PHP configuration file, open Finder, "Go to Folder ...", enter:

    1. /etc/apache2/

Then find our httpd.conf configuration file:

Using a text editor, cancel the following line of comments:

    1. LoadModule Php5_module libexec/apache2/libphp5.so
After the configuration file has been modified, we just need to restart our Apache service to let the changes take effect, in terminal input:
    1. sudo apachectl restart
Next we want to know the version of PHP on our Mac.
    1. Copy the Index.html.en file and rename it to info.php in the root directory of Apache.
    2. sudo cp/library/webserver/documents/index.html.en/library/webserver/documents/info.php

Open our info.php file and add it with a text editor after "It Works":
    1. <?php phpinfo ();?>
Then restart our Apache again. After rebooting, we enter in the browser URL bar:
    1. http://localhost/info.php

We can see:

Mysql

Install MySQL

First, enter the following URL in the browser, download the file shown in the diagram and install

http://dev.mysql.com/downloads/mysql/

Next, enter the following command in the terminal to view the MySQL version

mysql --version

In this machine, the version information is as follows

mysql Ver 14.14 Distrib 5.7.14, for osx10.11 (x86_64) using EditLine wrapper

If you are prompted to command not found, this is because the command accesses MySQLunder the /usr/local/bin/mysql path By default, so we can enter the following command at the terminal, Create a soft link to

sudo ln -fs /usr/local/mysql/bin/mysql /usr/local/bin/mysql

Once again, log in to the MySQL service with the user and password that was given when you installed MySQL, enter the following command in the terminal, enter the password after hitting enter

mysql -u root -p

Again, enter the following command in the terminal to exit the MySQL service

exit

Finally, enter the following command in the terminal to change the password to your own password

/usr/local/mysql/bin/mysqladmin -u USER -p password PASSWORD

Note: User is the username, default is root; Password for the new password, enter the original password can be

MySQL Start and stop

Start and stop the MySQL service by entering the following commands at the command line

sudo /usr/local/mysql/support-files/mysql.server start sudo /usr/local/mysql/support-files/mysql.server stop

Start and stop the MySQL service in System Preferences

There is a MySQL option in System Preferences, where we can manually start and stop the MySQL service

MySQL Visual management mode Navicat

I. Installing NAVICAT Premium https://www.navicat.com.cn/download/navicat-premium

Two. Open the folder to /Applications/Navicat\ Premium.app/Contents/MacOS/ replace the Navicat Premium file

Mac OS Navicat Premium 11.2.15 Simplified Chinese hack file http://download.csdn.net/detail/panshiqu/9671145

(phpMyAdmin configuration method does not elaborate, the web host on the MySQL database management tools, I personally more accustomed to Navicat interface)

Apache+php+mysql+navicat configuration under OSX system

Related Article

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.