How to build a PHP development environment in MacBook Pro

Source: Internet
Author: User
Tags php development environment macbook

In order to build an operation and maintenance of the project backstage, the newly-learned PHP, the first time to build a PHP development environment on the MacBook, so on record, but also for other learning partners to provide a reference.

Tools/Materials
    • Apache 2.4.16
    • Php
    • Macbook Pro
    • MySQL 5.7
Launch Apache
    1. 1

      Introduce a few commands first

      Launch Apache Service

      sudo apachectl start

      Restart Apache Service

      sudo apachectl restart

      Stop Apache Service

      sudo apachectl stop

      View Apache version

      Httpd-v

      Mac OS comes with Apache and only needs to start Apache on the line.

      Open terminal, enter command: sudo apachectl start

    2. 2

      Open the browser, enter localhost in the address bar, and the It works string will show that Apache has successfully started

    3. 3

      Under MacBook Pro, the Apache Web server root directory is under the/library/webserver/documents path

      END
Configure PHP
    1. Mac OS also comes with PHP, just need to add Apache to PHP in the Apache configuration file support is good

      Enter the command in the terminal:

      sudo vim/etc/apache2/httpd.conf

      Open httpd.conf File

    2. Remove the comment symbol for the contents of the red box callout

      LoadModule Php5_module libexec/apache2/libphp5.so

      and then save

      How to use Vim to edit content is not available here at this stage

    3. Restart Apache Service

    4. Enter the/library/webserver/documents,

      Create a new test PHP page in this directory, enter the command: sudo vim test.php

    5. Enter the following code in the test.php

      <?php phpinfo ();?>

    6. Open page localhost/test.php in the browser to test if PHP is available

      END

How to build a PHP development environment in MacBook Pro

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.