Install MySQL
Installing MySQL is simple, I use the CentOS system installation MySQL can be installed with the Yum command
[HTML]View PlainCopyPrint?
- Yum install-y mysql-server mysql-devel MySQL
Yum install-y mysql-server mysql-devel MySQL
Install PHP
The trouble with installing PHP is the configuration of the options when configure
If PHP version is 5.2.x also need to install PHP-FPM
First download the PHP-FPM code, unzip the PHP source after the patch
Add--enable-fpm option to./configure
If PHP is more than 5.3.x version, you do not need to patch PHP source code, just need to add--enable-fpm on the./configure.
Since I am a 64-bit system when installing MySQL, the *.so file will be in the Lib64 folder, which needs to be indicated in the./configure lib64,--with-libdir=lib64
[HTML]View PlainCopyPrint?
- ./configure --prefix =/usr/local/php--enable-fpm --with-mysql =/usr --with-pdo-mysql =/usr --with-libdir = lib64 --with-mysqli=/usr/bin/mysql_config
./configure--prefix=/usr/local/php--enable-fpm--with-mysql=/usr--with-pdo-mysql=/usr--with-libdir=lib64-- With-mysqli=/usr/bin/mysql_config
Here, by the way, if you can install the MySQL driver for PHP without using the Libmysql driver that comes with MySQL, you can also use PHP's own driver
If you use the MySQL driver, you need to add the option when you/configure.
--WITH-MYSQL=/USR (Note If the system is 64-bit and you need to add--with=libdir=64)
If you use your own MySQL driver, you can use the following options
--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
The full order is
[HTML]View PlainCopyPrint? ./configure--prefix=/usr/local/php--enable-fpm--with-mysql=mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql= Mysqlnd
When you are finished compiling
Make
Make install
At this time, we can see the PHP installed in the directory/usr/local/php, but it is not possible to use the PHP command, you need to set the PATH environment variable
Vi/etc/profile
At the end of the file, add
Export php_path=/usr/local/php
Export path= $PATH: $PHP _path/bin: $PHP _path/sbin
Save after adding, enter the command to take effect
Source/etc/profile
Installing Nginx
Installation Nginx is simple, you can use Yum install Nginx, you can also use Nginx source code to compile the installation
From the official download Nginx source code
Unzip and go to the folder
./configure--prefix=/usr/local/nginx
Make
Make install
We'll also see the nginx installed under the/usr/local/nginx.
Set the next PATH environment variable
Vi/etc/profile
At the end of the file, add
Export Nginx_path=/usr/local/nginx
Export path= $PATH: $NGINX _path/sbin
Save after adding, enter the command to take effect
Source/etc/profile
Configure Nginx
Nginx needs to use FASTCGI to parse PHP program, use Nginx before need to open PHP-FPM program
php-fpm
The nginx.conf configuration is as follows:
Location/{
Index index.html index.php;
Root/opt/web/php/test;
}
#error_page 404/404.html;
# REDIRECT Server error pages to the static page/50x.html
#
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}
Location ~ \.php$ {
Root/opt/web/php/test;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
From: nginx PHP mysql installation and deployment
Nginx PHP mysql Installation and deployment