PHP+MYSQL+APACHE2 Environment construction under MAC

Source: Internet
Author: User

The local System information is as follows:

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

Os:osx EI Capitan Version 10.11 MBP13.3

Your own Apache and PHP information is as follows:

loger9567demacbook-pro:~ loger9567$ Apachectl-v
Server version:apache/2.4.16 (Unix)
Server Built:aug 22 2015 16:51:57
loger9567demacbook-pro:~ loger9567$

loger9567demacbook-pro:~ loger9567$ php-version
PHP 5.5.27 (CLI) (Built:aug 22 2015 18:20:44)
Copyright (c) 1997-2015 the PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
loger9567demacbook-pro:~ loger9567$

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

First, enable PHP, modify the working directory

Modify the Apache configuration file (preferably backed up first):/etc/apache2/httpd.conf

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

1. Remove the previous comment symbol (#) from the line below to enable PHP5:

LoadModule Php5_module libexec/apache2/libphp5.so

2. Modify the directory for your own working directory:

DocumentRoot "/library/webserver/documents"
<directory "/library/webserver/documents" >

Switch

DocumentRoot "/users/loger9567/hbuilderprojects/cros"
<directory "/users/loger9567/hbuilderprojects/cros" >

3. index file type plus index.php:

<ifmodule dir_module>
DirectoryIndex index.html index.php
</IfModule>

4. Exit Modify after saving

5. Restart Apache:sudo/usr/sbin/apachectl restart

6. In the working directory you just saved, write a: index.php, enter in the browser: localhost to verify the normal access

Second, install the configuration MySQL

1. Download and install the latest version of MySQL Server, my MySQL information is:

    • Server: 127.0.0.1 via TCP/IP
    • Server type: MySQL
    • Server version: 5.7.10-mysql Community server (GPL)
    • Protocol version: 10
    • User: [Email protected]
    • Server character set: UTF-8 Unicode (UTF8)

2. After installation, a random password is generated: Remember to log in with this random password, you will be asked to change the password first, and then run the command at the command line:

Cd/usr/local/mysql/bin

./mysql-u Root-p # Enter the random password you just entered

mysql> SET PASSWORD = PASSWORD (' root '); #否则会提示你: Required to use ALTER user to modify the password to execute the statement, and phpMyAdmin can not log on to MySQL.

Third, configuration phpMyAdmin

1. Download the latest version of PhpMyAdmin, unzip it into your working directory, and rename the folder to: PhpMyAdmin

2. Rename the config.sample.inc.php file in the phpMyAdmin root directory to config.inc.php, $cfg[' Servers ' [$i] [' host '] = ' localhost '; The localhost is changed to: 127.0.0.1.

3. Open localhost/phpmyadmin/index.php and log in to manage MySQL in the background.

PHP+MYSQL+APACHE2 Environment construction under MAC

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.