On Mac, how does one set up a PHP development environment?

Source: Internet
Author: User
Tags oracle vm virtualbox vm virtualbox
Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming... Reply: installing homestead is the simplest
Laravel Homestead

Homestead is a vagrant environment provided by laravel to developers. of course, it is suitable for servers used for other php frameworks or native php code. it has nothing to do with the local environment and can share directories with virtualhost, services including nginx, redis, mysql, and memcache have been installed for you.

Currently, it is best to use vagrant or docker to set up services. although apache and php are provided on mac, php and apache will be automatically upgraded every time mac osx is upgraded. does it sound good, but in fact, every time it was a nightmare, I installed some additional modules in php on the local machine, and all the modules were wiped during the upgrade, php. the settings in ini are all restored (of course, the php before the OS upgrade. ini system helped you change the name of the backup), apache settings are also restored, so we have to install all the php extensions used.

In addition, the environment configured on the local machine is not conducive to team development. each person's development environment has minor differences in php, mysql, and other versions, different processing results for linux and windows mysql versions are also slightly different. I have encountered such pitfalls many times, so I should use vagrant's virtual host, if you have configured an environment, you can export the vhost as the vagrant box and distribute it to other people in the team so that everyone can work in the same environment, whether it is mac or windows. This is even better than setting up a development server in the company. everyone does not affect each other. every environment is consistent and independent, I don't rely on the internal development server to work when I am not in the office (of course, I am opposed to any form of overtime) http://dancewithnet.com/2010/05/09/run-apache-php-mysql-in-mac-os-x/ This is a good one. I have already done it. The mac is actually much easier to develop than windows. In fact, you only need to use the next mysql, the most important thing is that linux commands on mac are much better to use than window commands. if you are a newbie and start php development, we recommend using homebrew for installation.
This can reduce many compilation problems, reduce the process of configuring the environment, and avoid losing Development enthusiasm and learning due to the unsuccessful configuration environment.

For more information, see [php]. use Homebrew to Configure Nginx, php, and Mysql development environments on mac.
Install Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X Mavericks or Yosemite Come on, I just want to try it today, and I think I should write it myself.
Previously, nginx + liunx was used more often, so the apache that comes with mac is basically useless, so we decided to install the virtual machine to run liunx and then install it in the environment.
You need:
VirtualBox + Vagrant + centos (or other liunx images) + PHP environment installation
Basically, virtualbox is the best free virtual machine, and vagrant is used to install and deploy the virtual development environment. Nothing else.

This is why Mao used it, because it is a developer !!

Use Vagrant to encapsulate a Linux development environment and distribute it to team members. Members can develop programs on their favorite desktop systems (Mac, Windows, and Linux), but the code can run in a unified encapsulated environment, which is very domineering.

Come on, Download virtualbox:
Downloads â € "Oracle VM VirtualBox
Select for OS x. Select for OS x.
Download vagrant
Download-Vagrant by HashiCorp
Download centos image
A list of base boxes for Vagrant


Just install or something.



After installation, add the centos image to the terminal.
Assume that the Directory of the box you downloaded is ~ /Centos. box
Enter $ vagrant box add centos65 ~ /Centos65.box
Centos65 After add is the name of your named box
Show success Show success
Initialize the development environment

Create a development Directory (for example :~ /Workspace), you can also use the existing directory, switch to the development directory, and use the centos65 image to initialize the environment of the current directory:

$ Cd ~ /Workspace # switch directory $ vagrant init centos65 # Initialize $ vagrant up # Start the environment
Brew install php7
Write code with atom
When you start learning, you only need to run the php hello. php command line
Or use php to bring your own web server
Php-S 0.0.0.0: 8090
Or
Php-S 127.0.0.1: 8090 vagrant + virtualBox + centosMac integrated software recommendation for quick php environment construction Let's take a look at this article. I personally suggest that you do not use the built-in php environment. I used XMAPP, AMPPS, and MAMP PRO (for billing purposes, you can buy a group). after comparison, MAMP PRO is the most convenient and best operation. customization is also the best.

==========
Update: 21:56:58
Detected automatically Vagrant + boxAfter this magical combination, we strongly recommend Mac kids shoes.
Tutorial:
Go-in-Action/01.2.md at master · astaxie/Go-in-Action · GitHub Vomit blood to answer this question. I personally feel that I am really troublesome. from the first time I learned how to configure iis, to the later time I configured apache, to the later time I started to use the integrated environment, I really felt that if I was learning and testing, therefore, the integration environment is too convenient at the beginning.
In the php environment, wamp is recommended for windows, which is easy to use. it took three years. later, I changed my mac and started to use xampp. it really hurt me. at the beginning, it took me half a month, however, after a restart, the message "must be a document" (I don't remember it) is "selinux", which cannot be solved anyway. Later, I changed the mamp and used it again. VirtualBox + Vagrant
Use a virtual machine to install a linux system and build the environment in a Linux system.
Installation Manual: VirtualBox + Vagrant

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.