How to build PHP development environment under MAC?

Source: Internet
Author: User
Tags php development environment oracle vm virtualbox vm virtualbox

Reply content:

It's easiest to put a homestead.
Laravel Homestead

Homestead is a vagrant environment that Laravel provides to developers, of course, the server used to make other PHP frameworks or native PHP code is suitable, regardless of the native environment, can and VirtualHost share directories, including Nginx,redis, Mysql,memcache and other services have been installed for you.

At present, or with vagrant or Docker, such as the best set up services, although the Mac with Apache and PHP, but every time Mac OSX upgrade will automatically upgrade PHP and Apache, sounds good is not, but in fact every time is a nightmare, I installed some extra modules in the native PHP, the upgrade when all to erase, php.ini in the settings are all restored (of course, upgrade the operating system before the php.ini system to help you rename the backup), Apache's settings have been restored, so you have to use all the PHP extension installed once.

And on the machine itself with the environment is not conducive to team development, everyone's development environment PHP, MySQL and other versions have subtle differences, including the operating system Linux and the MySQL version under Windows different processing results are slightly different, I have encountered many times such a pit, So still use Vagrant Virtual host bar, as long as the configuration of an environment, you can vhost as a vagrant box export, distributed to other people in the team, so that everyone to stay in an environment to work, whether he is Mac or Windows. This is even better than setting up a development server in the company, everyone does not affect each other, each environment is consistent and independent, not in the office and not rely on the development of the intranet server to work (of course, I oppose any kind of overtime) / http dancewithnet.com/2010/0 5/09/run-apache-php-mysql-in-mac-os-x/ , this writing is very good, I have taken care of the Mac is actually more than windows to do development worry a lot, in fact, only need the next MySQL on the line, the most important is the Mac above the Linux command to use than the window of those poor command cool too much if you are novice, get started PHP If developed, it is recommended to use homebrew installation
This can reduce the number of compilation problems, reduce the flow of the configuration environment, to the greatest extent possible to avoid the configuration environment is not successful loss of development enthusiasm and learning slack

Chinese reference document: [PHP] Use Homebrew to configure Nginx, PHP, Mysql development environment under Mac
English reference documents: Install Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X Mavericks or Yosemite Come on, I just want to try it today and feel like writing it.
Before with Nginx+liunx more, so the Mac comes with Apache basically no use to me, so decisive plan to install virtual machine run Liunx and then in the installation environment.
You need to:
virtualbox+ Vagrant+centos (or other liunx mirror) +php environment installed things
Basically, VirtualBox is known as the best free virtual machine, and vagrant is used to install and deploy a virtual development environment. Needless to say, nothing more.

For Mao with this, because this is a development artifact Ah!!

distributed to team members through Vagrant encapsulation of a Linux development environment. Members can develop programs on their favorite desktop system (Mac/windows/linux), but the code can be unified in a packaged environment to run, very domineering.

Come on Download VirtualBox:
downloads†"Oracle VM VirtualBox
choose for OS X do not choose the wrong Choose for OS X do not choose the wrong
Download Vagrant
Download-vagrant by Hashicorp
Download the CentOS image
A list of base boxes for Vagrant


The installation is just one step ahead.



Add the CentOS image to the terminal after installation
Let's say that the box directory you downloaded is ~/centos.box
In terminal input $ vagrant box Add Centos65 ~/centos65.box
The centos65 behind add is the name of your named box.
Show success after success Show success after success
Initializing the development environment

Create a development directory (for example: ~/workspace), you can also use the existing directory, switch to the development directory, with the CENTOS65 image to initialize the current directory environment:

$ cd ~/workspace  # 切换目录$ vagrant init centos65  # 初始化$ vagrant up  # 启动环境
Brew Install PHP7
Atom Writing Code
When you start learning, you only need to run PHP hello.php on the command line
or bring your own Web server with PHP
Php-s 0.0.0.0:8090
Or
Php-s 127.0.0.1:8090VAGRANT+VIRTUALBOX+CENTOSMAC integrated software recommendations for fast-build PHP environments can go to see this article, I personally suggest that it is best not to use the system's own PHP environment. I used Xmapp, Ampps, MAMP Pro (charge, can buy), made a comparison, or MAMP PRO most convenient, best operation. Customization is also the best.

=========
Update:2015-11-18 21:56:58
Automatic discovery. Vagrant+boxAfter this magical combination, the decisive recommendation for Mac's children's shoes to use
Use the Tutorial:
Go-in-action/01.2.md at Master Astaxie/go-in-action GitHub Vomiting blood to answer the question. Personally feel very troublesome, from the beginning of learning with IIS to later with Apache, to later began to use the integration environment, really feel, if it is learning and testing, then the integration environment is undoubtedly at the beginning of the convenience of too much.
PHP environment, recommended wamp on Windows, easy to use, with 3 years, and then changed the Mac, a start with the xampp, the real egg pain, a good start, with half a month, but a restart, a must be a document (specifically do not remember) really fucked, There is said to be selinux problem, anyway can not solve. Later change Mamp, use also can. VirtualBox + Vagrant
Using a virtual machine, install a Linux system, and the environment is built on a Linux system.
Installation manual: VirtualBox + Vagrant
  • Related Article

    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.