Quickly build PHP development environment under MAC

Source: Internet
Author: User

Recently done a back end of the project, is done with Php+mysql+nginx, so the way to build the environment simple summary.

Note:

    • Material: Apache/nginx+php+mysql+mamp
    • Mac OS 10.12.1 comes with Apache,nginx and PHP
1. Run Apache
    • To view the Apache version, enter the following command in the terminal root directory:

      sudo apachectl -v
    • The terminal will output Apache version and built time

      Server version: Apache/2.4.23 (Unix)Server built:   Aug  8 2016 16:31:34
    • Open Apache

      sudo apachectl start
    • When turned on, it can be accessed via the browser: http://localhost, the page shows that "It works" indicates success.

    • Close Apache

      sudo apachectl stop
    • Restart Apache

      sudo apachectl restart
2. Configure PHP
    • Edit the Apache configuration file, terminal input:

      sudo vi /etc/apache2/httpd.conf
    • Found it:

      #LoadModule php5_module libexec/apache2/libphp5.so
    • Remove the previous "#" comment, then: Wq Save exit

    • Make a copy of the Php.ini.default and name it php.ini

      sudo cp /etc/php.ini.default /etc/php.ini
    • Restart Apache to make it effective

      sudo apachectl restart
3. Install MySQL
  • Download mysql:http://dev.mysql.com/downloads/mysql/after the download, double-click the installation, after successful, will pop up the prompt box:

    2017-02-12T09:00:08.587153Z 1 [Note] A temporary password is generated for [email protected]: s;QVTg#=i7wPIf you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
  • This temporary password is difficult to remember, you can get rid of it.

  • To start MySQL in safe mode and skip the secure password, the terminal enters the following command:

    sudo mysqld_safe --skip-grant-tables &
  • To modify the MySQL password:

    The principle is to modify the Database:mysql Table:user in the user field of the root password, 5.7 version of the MySQL password fields are authentication_string, the lower version of the call password;

    update user set authentication_string=PASSWORD("your password") where User="root";
  • To refresh the permissions, exit the restart:

    MySQL> flush privileges;MySQL> quit;终端:service mysql start
  • The password modification is complete, the password has been changed to root.

  • Open System Preference Configuration The bottom line->mysql,

    开启MySQL:Start MySQL Server关闭MySQL:Stop MySQL Server
  • Note: Automatically Start MySQL Server on startup is checked by default, and when turned on the computer will turn on MySQL by default, it is recommended that you do not need to check the default
  • Too terminal view database inconvenient, can download Navicat Lite management software, management MySQL super convenient.

4. Big recruit, install Mamp
      • After installing Mamp, you will find that the things you do above are basically wasted ... Because this one is finished, the other basic do not need to move, in addition to slightly change the configuration of what.
      • Installation Address: https://www.mamp.info/en/Install the free version is enough
      • Through the preferences settings can be set the project is Apache or Nginx, you can set the port number, you can also set the version number of PHP, and then you can point the folder to their own project, if not a new one, and finally only need to click Start.





      • Super convenient to have wood there!

        In this way, a complete engineering environment is set up, next, you can happily code!

Quickly build a PHP development environment under your 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.