"Development software" configures the PHP development environment under Mac: Apache+php+mysql

Source: Internet
Author: User
Tags mysql in mysql version php development environment phpmyadmin

This article addresses the original address of this article outline: 1. Launch Apache 2. Run PHP 3. Configure MySQL 4. Use phpMyAdmin 5. Appendix If you have any questions, please read the final appendix.Absrtact: System OS X 10.8.5,apache is the Mac comes with, mainly PHP configuration and MySQL configuration, online tutorials are also quite a lot, I also have reference, but feel that some steps are not very smooth implementation, according to their own configuration of the process of finishingfirst, start Apache

There are two ways

1. Turn on network sharing

Open " System Preferences" , "sharing", before " Internet sharing" that item to hit √.

2. Open Terminal, enter

sudo apachectl start

You need to enter the password, enter the computer password, and then enter

sudo apachectl-v

can view version information for Apache

Server version:apache/2.2.  - (Unix) Server built:   Jul  7::

when you enter http://localhost in the browser, the IT works! appears The page

second, run PHP

1, find the Apache configuration file, under directory /etc/apache2/ , open finder, select "Go"-"Go to Folder", enter "/etc/apache2/", find the "httpd.conf" File, select Open with document to edit, tap command+f, search #LoadModule php5_module libexec/apache2/libphp5.so,


The Blue Line of the # is removed, and then saved, if there is a text lock, unable to unlock the situation, there are two ways to solve

a) Select the file, right-click after selecting "Show Info", click on the lower right corner of the small lock icon, enter the computer password to unlock, and then select the left of the + sign key, select their current computer login user, set the permissions to read and write, if still not, will be the same level folder permissions again modified once.

b) Copy the file to the desktop, modify it, and then copy it to the original folder to replace the previous file.

2. Restart Apache in the terminal input

sudo apachectl restart

PHP is ready for use.

3, in the terminal input

sudo cp/library/webserver/documents/index.html.en/library/webserver/documents/info.php

That is, copy the Index.html.en file and rename it to info.php in the root directory of Apache.

4. Open info.php, add <?php phpinfo () after it works, and then restart Apache again, enter http://localhost/info.php in the browser, and a page will appear with PHP information.


Third, configure MySQL

1, on the http://dev.mysql.com/downloads/mysql/website, select the Mac OS x platform, and then select the download in the diagram, I started to download the wrong, installation error, and then download the version of the image installed successfully

Double-click the DMG file


Double-click the first installation, double-click the third installation, and then double-click the second, the second is the profile, after installation, you can choose to start or turn off MySQL in System preferences.

2. Change the password

in the terminal input, here to change the password is 12345, but also for other, custom can

12345

iv. use of phpMyAdmin

phpMyAdmin is a PHP-developed program for managing MySQL, very practical

1, download phpMyAdmin, in the URL http://www.phpmyadmin.net/home_page/downloads.php select the appropriate version of the download, I chose the phpmyadmin-4.0.8-all-languages.tar.bz2

2, the downloaded files are extracted, put into the /library/webserver/documents/folder, and named phpMyAdmin.

3. Copy the config.sample.inc.php in/library/webserver/documents/phpmyadmin and name it config.inc.php, and put it under the current folder.

4, edit config.inc.php, modify one of the

$cfg ['Servers']] $i ['host'localhost ';

For

$cfg ['Servers'] $i ['host' ] 127.0.0.1';

Then, if you want to login without a password, change the false in the following statement to True

$cfg ['Servers'] [$i] ['allownopassword'false

5, enter http://localhost/phpmyadmin in the browser, enter the user name "root", and just change the password, if not changed password, then follow the previous step of the no password operation, and then you can directly login.

PS: To this configuration to complete, PHP development also need to download a PHP development tools, Mac PHP development tools are also quite a lot, we Google Baidu, we need to remind that, after installing the development tools, in the proposed PHP project, remember to put the project in and phpmyadmin the same directory file , you can create a new folder specifically for the PHP project, otherwise, it will not work (a big god instruction, I have not personally verified)

V. Appendices:

1. Problems you may encounter:

1) MySQL version can be downloaded directly: HTTP://DEV.MYSQL.COM/GET/DOWNLOADS/MYSQL-8.0/MYSQL-8.0.0-DMR-OSX10.11-X86_64.DMG

2) After installation, start similar to/usr/local/mysql/bin/mysql-uroot-poaq9_csfgg#f

3) After logging in, modify the password SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Newpass ');

4) Set MySQL path sudo vim ~/.bash_profile, which is added with export path= "/usr/local/mysql/bin: $PATH"

5) Set the user's link to MySQL permissions on the computer:

User Management MySQL >  Use mysql; view MySQL > Select Host,userfrom user , creating MySQL> Create User  Zx_root by   'xxxxx';   //  by will store plaintext password encryption as a hash value

Refer to Http://www.cnblogs.com/fslnet/p/3143344.html

6) Set PHP to link MySQL

Refer to Http://www.cnblogs.com/studentlv/p/5666490.html

/etc/sudo cp php.ini. default php.ini      # #复制 php.ini.  Default+rwx php.ini              /tmp/Mysql.socksudo apachectl Restart            # #重启 Apache

"Development software" configures the PHP development environment under Mac: Apache+php+mysql

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.