Configure the PHP + MySql environment in MacOS _ PHP Tutorial

Source: Internet
Author: User
Tags configuration php
Configure the PHP + MySql environment in MacOS. This article describes in detail the detailed steps for installing and configuring the PHP + MySql environment in the MacOS system. it is very comprehensive. we recommend you to those who have the same requirements. Configure the PHP + MySql environment in Mac OS

This article describes in detail how to install and configure the PHP + MySql environment in mac OS, which is very comprehensive. we recommend that you have the same requirements.

As mantis needs to be configured recently for bug tracking, the process is recorded here.

Because the PHP apache environment is built-in on Mac OS, you do not need to install the installation package in another place. you just need to configure it briefly.

First, open the terminal and enter the command:

The code is as follows:


Sudo vim/etc/apache2/httpd. conf

One line is like this.

The code is as follows:


# LoadModule php5_module libexec/apache2/libphp5.so

Remove.

Enable sharing in the system preference settings to hook up web sharing, as shown in figure

Restart apache with the following command:

The code is as follows:


Sudo apachectl restart

In this way, you can enter http: // localhost/in the browser.

It works!

The php environment is successfully configured.

Configure the MySql environment.

First download the dmg installation package of MySql. In: http://dev.mysql.com/downloads/mysql/

Open the dmg file, which contains three installation items. here, all three of them are installed, MySQLStartupItem. after pkg is installed, mysql will start automatically with the system startup, MySQL. prefPane indicates that you can see the mysql option in the system preference settings, and the installation item is mysql.

In this way, the installation is successful. enable mysql in the system preference settings and enable the service. After installation, the default user name is root and the password is blank. For security, set a password.

Open the terminal. if you enter mysql to prompt that this command is not available, configure the environment variable in the mysql bin directory. Directory:/usr/local/mysql/bin/. add it to the PATH variable. Here I will introduce another method,

Enter

The code is as follows:


Sudo vim/etc/bashrc

Then add

The code is as follows:


# Mysql
Alias mysql = '/usr/local/mysql/bin/mysql'
Alias mysqladmin = '/usr/local/mysql/bin/mysqladmin'

In this way, input mysql in the terminal has this command. In fact, it is a bit similar to the macro definition in C/C ++, and the role of alias replacement.

Next, modify the root password. the command is as follows:

The code is as follows:


Mysqladmin-uroot password 12345

In this way, the root password is changed to 12345.

To manage Mysql, it is troublesome to use command lines. the open-source phpMyAdmin adopts the C/S mode for convenient management. Then we installed a phpMyAdmin. It was developed by php, is: http://www.phpmyadmin.net/home_page/downloads.php

Decompress the downloaded package to the/Library/WebServer/Documents/Directory. The Complete Directory is/Library/WebServer/Documents/phpmyadmin/. then run the command line to enter the directory,

Run the following command:

The code is as follows:


Cp config. sample. inc. php config. inc. php
Vim config. inc. php

Modify the settings as follows:

The code is as follows:


$ Cfg ['blowfish _ secret'] = ''; // used for Cookie encryption and arbitrary long string
$ Cfg ['servers'] [$ I] ['host'] = '2017. 0.0.1 '; // The MySQL daemon binds an IP address.

You can enter the URL: http: // localhost/phpmyadmin/in the browser/

Server Name: root

The password you set.

You can log in to the mysql management interface.

Well, the above is all about configuring the PHP + MYSQL environment in mac OS. I hope my friends will like it.

Under the http://www.bkjia.com/PHPjc/960576.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/960576.htmlTechArticleMac OS configuration PHP + MySql environment this article detailed introduced in the mac OS system installation configuration PHP + MySql environment detailed steps complete, very comprehensive, we recommend you to those who have the same requirements ....

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.