PHP Development environment configuration for Mac computers

Source: Internet
Author: User

Objective

Just after the year, the project is not much, the boss told us to take advantage of this period of leisure time to learn more other knowledge, so I and another iOS partner to learn PHP knowledge, but encountered a problem: that is the Mac computer PHP environment configuration. So the next configuration method, hope that the future learners can get started faster, do not like us Daoteng half a day.

What do you need?

    1. Install the Web server;
    2. Install PHP;
    3. Install the database, such as navigate Premium, MySQL.

Because the MAC computer OS X system already comes with Apache and PHP, just create a. php file and upload it to the web directory. They are automatically parsed by the server. So you don't need to compile or install any additional tools. Here are the specific steps.

    • Apache Configuration 1, we need to manually turn on the Apache service, open the terminal to enter the following command: Sudo apachectl start, after manually opening, enter localhost or 127.0.0.1 in the browser will display "It works!" words, The Apache service is turned on successfully, such as:

      It works.png

      2, modify the Apache configuration file, enter the following command in the terminal: sudo vim/etc/apache2/httpd.conf, then enter the computer password to enter the editor; find #loadmodule php5_module libexec/ apache2/libphp5.so, remove the previous comment sign "#" (Here are some of the Mac terminal commands to understand some basic commands can be, here, press I into the edit mode, press ESC to exit the edit mode, and then enter: Wq exit vim and save the changes);

      Config.png

      3, after two steps, in the terminal input command: sudo apachectl restart; we can restart Apache, so Apache is already configured. 4, the following can be written a simple "Hello word! "PHP program to test under." Default root directory for Mac OS Apache2:/library/webserver/documents; We can create a new. php file in this directory, but before we do, we'd better install a PHP editor, otherwise it won't be easy to use the Vim editor. I use sublime Text2, we can download it in sublime text website. Open the terminal input two command: touch/library/webserver/documents/hello.phpopen/library/webserver/documents/hello.php input

Hello.png

    • Installation Database (Navigate Premium) Specific installation I will not say, there are many tutorials on the web; start MySQL Server

      Mysql.png

New Database

Nav.png

Password not required:

Database.png

To this environment is well-equipped, we can write the program!!! The installation of the database is relatively simple, mainly because of many online tutorials, and different developers use the tool is not the same, so a pen took.

  • 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.