PHP is developed in the macsystem. The simplest example is to download a file from www.apachefriends.orgenxampp-macosx.html, which can be directly developed upon installation. It has obvious advantages and is easy to use. To use MacPorts to configure the PHP development environment (PHP54 + PHPFPM + NGINX + MYSQL55), first install the port:
The simplest method for PHP development in MAC systems is. To use MacPorts to configure the PHP development environment (PHP54 + php fpm + NGINX + MYSQL55), first install the port. Visit: http ://
The simplest method for PHP development in MAC systems is.
To use MacPorts to configure the PHP development environment (PHP54 + php fpm + NGINX + MYSQL55), first install the port. Visit http://www.macports.org/install.php to download the source code: Export.
Installation port:
1. tar xzvf MacPorts-2.1.3.tar.gz Decompression
2. cd MacPorts-2.1.3
3../configure & make & sudo make install
In this way, the port is installed.
4. vi ~ /. Bash_profile
Press the I key to enter the editing mode and paste the following text:
Export PATH =/opt/local/bin: $ PATH
Press ESC to exit the editing mode, press: And then enter wq to save and exit.
Now we can easily use the port.
Install php:
1. port info php lists supported php information. You can select the corresponding version for installation as needed. I select php54.
2. sudo port install php54 php54-fpm php54-mysql php54-mbstring php54-mcrypt php54-sockets can be increased or decreased as needed
3. cd/opt/local/etc/php54/
4. sudo cp./php-fpm.conf.default./php-fpm.conf
5. sudo cp./php. ini-development./php. ini can be changed to php. ini-production as needed.
6. vi ~ /. Add the following content to bash_profile:
# Php-fpm
Alias fpm_start = 'sudo launchctl load-w/Library/LaunchDaemons/org. macports. php54-fpm.plist'
Alias fpm_stop = 'sudo launchctl unload-w/Library/LaunchDaemons/org. macports. php54-fpm.plist'
Alias fpm_restart = 'fpm _ stop; fpm_start'
7. Open a new command window and enter fpm_start and php-fpm to start running. You can run the top command or run ps-e | grep php-fpm.
In this way, php is ready.
Nginx:
1. sudo port install nginx
2. vi ~ /. Add the following content to bash_profile:
# Nginx
Alias nginx_start = 'sudo launchctl load-w/Library/LaunchDaemons/org. macports. nginx. plist'
Alias nginx_stop = 'sudo launchctl unload-w/Library/LaunchDaemons/org. macports. nginx. plist'
Alias nginx_restart = 'nginx _ stop; nginx_start ;'
3. cd/opt/local/etc/nginx/
4. sudo cp fastcgi. conf. example fastcgi. conf and so on. copy the files with the. example suffix and without the. example suffix.
5. Locate sudo vi nginx. conf
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1: 9000. the content is changed to this:
# Pass the PHP scripts to FastCGI server listening on Fig: 9000
#
Location ~ \. Php $ {
Root share/nginx/html;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME/opt/local/share/nginx/html $ fastcgi_script_name;
Include fastcgi_params;
}
In fact, the above # is removed and fastcgi_param SCRIPT_FILENAME/opt/local/share/nginx/html $ fastcgi_script_name is changed;
6. nginx_start can be started.
7. cd/opt/local/share/nginx/html/
8. Add the following content to vi phpinfo. php:
9. Access http: // localhost/phpinfo. php through a browser.
MYSQL:
1. sudo port install mysql55 and then set the database based on the content after installation.
2. vi ~ /. Add the following content to bash_profile:
# Mysql
Alias mysql_start = 'sudo launchctl load-w/Library/LaunchDaemons/org. macports. mysql55-server.plist'
Alias mysql_stop = 'sudo launchctl unload-w/Library/LaunchDaemons/org. macports. mysql55-server.plist'
Alias mysql_restart = 'mysql _ stop; mysql_start'
3. mysql_start
4. Note sudo vi/opt/local/ect/mysql55/my. cnf #! Include/opt/local/etc/mysql55/macports-default.cnf line, plus: [mysqld_safe] socket =/tmp/mysql. sock, otherwise the mysql command can be connected, the tool can not connect.
From: http://www.cnblogs.com/afxcn/archive/2013/06/02/3113934.html
Original article address: Go to: Use MacPorts to configure the PHP development environment (PHP54 + php fpm + NGINX + MYSQL55). Thank you for sharing it with me.