PHP Environment setup under Mac

Source: Internet
Author: User
Tags phpinfo macbook

1. Start the server

macbook-air:~ wgyp$ sudo apachectl start

Password:

macbook-air:~ wgyp$ sudo apachectl-v

Server version:apache/2.2.26 (Unix)

Server Built:dec 10 2013 22:09:38

2. enter http://localhost in the browser and the IT works! will appear The page

Note: If the IT works! does not appear Enter 127.0.0.1 in the browser, if it appears, the host binding is wrong.

3. Open in/etc/apache2/httpd.conf with VI

LoadModule Php5_module libexec/apache2/libphp5.so

The comment code, with: w save,: Q Exit Edit.

note: The ReadOnly permission appears, you can right-click on the file and choose Introduction (Get Info) share permission (shareing& permissions) Open Select the small lock in the lower right corner. You can edit the file read and write permissions.

4. Restart Apache, the terminal input sudo apachectl restart  php can be used.

5. edit php file. Copy the file/library/webserver/documents/index.html.en, rename info.php, modify the content to <?php phpinfo ();? > 

6. Restart the Apache server and enter http://localhost/info.php in the browser. You can see the effect.

note: If you press to appear: <?php phpinfo ();?> is the third step is not done.

7.documentroot,apache default read-in root change.

macbook-air:~ wgyp$ open/etc/apache2/

has just changed the read and write permissions of httpd.conf. Find DocumentRoot, change/library/webserver/documents all to the folder you want to point to, and enter sudo apachectl restart on the terminal . Then just write the code in the folder you point to, and you can preview it by typing the localhost+ file name in the browser.

PHP Environment setup 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.