purpose
In order to deploy the following Laravel herein, this began to install PHP.
Setting PHP source
See if there is Centos source PHP.
yum list php*
Check PHP version.
yum info php.x86_64
FIG seen carrying the PHP source version is too low, a higher version.
Set high version of the PHP source.
rpm -ivh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum list php* #更新源并查看现在的PHP源
Now has php72 version installed.
yum install -y php72w-fpm php72w-fpm php72w-cli.x86_64 php72w-common.x86_64 php72w.x86_64 php72w-dba.x86_64 php72w-devel.x86_64 php72w-embedded.x86_64 php72w-enchant.x86_64 php72w-gd.x86_64 php72w-imap.x86_64 php72w-interbase.x86_64 php72w-intl.x86_64 php72w-ldap.x86_64 php72w-mbstring.x86_64 php72w-mysqlnd.x86_64 php72w-odbc.x86_64 php72w-opcache.x86_64 php72w-pdo.x86_64 php72w-pdo_dblib.x86_64 php72w-soap.x86_64 php72w-xml.x86_64 php72w-xmlrpc.x86_64 php72w-mbstring.x86_64 php72w-mcrypt.x86_64 php-posix
After successful installation, see php
php -v
Let's create a new website site.
service php-fpm start # 启动php
systemctl enable php-fpm # 设置开机启动项
ps -ef | grep php # 查看是否正常启动
Set SELinux
vi /etc/selinux/config
SELINUX=permissive
Restart the virtual machine is not set SELinux, nginx php-fpm have access permission issues.
mkdir -p /var/www/Test
cd /var/www/Test
vi index.php
index.php
<?php
phpinfo();
?>
nginx config configuration site
cd /etc/nginx/conf.d
vi devtest.plat.goods
server {
listen 80;
server_name devtest.plat.goods;
root "/var/www/Test";
index index.html index.htm index.php;
location ~ (.+\.php)(.*)$ {
fastcgi_split_path_info ^(.+\.php)(.+)$;
fastcgi_pass unix:/var/run/php-fpm/php7-fpm.sock; #用unix套接字通讯
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
}
Configure php-fpm
vi /etc/php-fpm.d/www.conf
listen = /var/run/php-fpm/php7-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
service php-fpm restart
service nginx reload
service nginx status
Physical host virtual machine access the site, you need to configure the physical machine hosts
C: \ Windows \ System32 \ the Drivers \ etc \ hosts
192.168.10.18 devtest.plat.goods