[PHP] Build a PHP operating environment under CentOS

There are test machines allocated in the company, and all the development code runs in the test machine. Because the company's test machine room is rented out, it is necessary to build a development environment on the newly applied test machines. The development environment should be as compatible as possible. The environment on the above is the same, including the directory path of the code, the process user who runs the program, the directory of the log, etc. The linux version of my test machine is still centos6.5, and the lnmp environment is mainly the following commands.

yum clean all
yum makecache
yum update
//Install nginx
yum install nginx
//Install php php-fpm and necessary extensions, gd library, mysql extension (php-mysql is installed after mysql, mysqli, pdo are all installed), pdo extension, mbstring extension, redis extension
yum install php php-fpm php-devel php-pear php-gd php-pdo php-mbstring php-mysql php-redis
//I don’t know why there is no memcache extension in the above form. Use the following command to install it. You need the php-devel installed above, which will generate a .so file, create a new configuration file for memcahce extension, and add this so
pecl install memcache

The advantage of modifying the session storage and processing mechanism is that it can solve the session sharing mechanism when there are multiple machines.
Modify the default session processing mechanism, change from file to memcache, use the following command to search for the configuration location of the session, in addition to the php.ini, it may also be overwritten in www.conf under php-fpm, and comment out
grep "save_handler" /etc -R
session.save_handler = memcache
session.save_path = "tcp://xxx.sina.com.cn:5xxxx8"

The www.conf under php-fpm has the configuration coverage of the session mechanism, or it is also changed or commented out.
; php_value[session.save_handler] = memcache
; php_value[session.save_path] = tcp://xxx.sina.com.cn:5xxxx8

Configure the error log of php in php-fpm. When a 500 error occurs, it is usually a problem with our php code. Open the error log of php. If the directory path is /var/log/php, after creating a new directory , To modify the owner and group of the directory to the running user of fpm, use the chown command
For example: chown www-data:www-data /var/log/php-fpm
php_admin_value[error_log] = /var/log/php-fpm/www-error.log

If you want to use a higher version of php, you can add the following source, and then write it like this when installing the php software, for example: php71w php71w-fpm, etc.
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

Recommended Posts

[PHP] Build a PHP operating environment under CentOS
Build docker environment under Centos6.5
Build a basic environment for Java development under Centos7
Build a PXC cluster under CentOS8
(1) Centos7 installation to build a cluster environment
Build a python development environment under Ubuntu
CentOS6.7 build LNMP environment
Centos7.6 build LNMP environment
CentOS 7 build LNMP environment
Build a ScaleIO distributed storage cluster under CentOS7
Build LEMP (Linux+Nginx+MySQL+PHP) environment under CentOS 8.1 (detailed tutorial)
Build Dedecms website in LNMP environment under CentOS7
How to build a LAMP environment on centos7.2
[CentOS environment deployment] Java7/Java8 deployment under CentOS
Build OpenV** Server under CentOS7
Use Rancher to build a K8s cluster under CentOS7
CentOS install nginx+tomcat+java+mysql operating environment
Method of setting up PHP operating environment under Ubuntu server
Ubuntu16.04 build php5.6 Web server environment
Build an FTP server under centos7
Build Nginx environment on Linux (CentOS)
FFmpeg environment deployment record under centos7
PPTP environment deployment record under Centos
Build a LAMP development environment on Ubuntu 16.04
Build the C++ compilation environment under ubuntu
Linux environment construction: CentOs + Apache + MySQL + PHP
Docker learning 2- quickly build a centos7-python3.6 environment
Configure Nginx + PHP 7.0 + MySQL environment under Ubuntu 16.04
How to quickly build Nginx server under CentOS
Python3 development environment to build a detailed tutorial
CentOS7 build jenkins
Centos build lnmp
Centos7 build python3.8.5+scrapy+gerapy
Centos7 tutorial to build a master-slave DNS server
CentOS install PHP
Install PHP in yum under CentOS, configure php-fpm service
CentOS uses Nginx to build a download function server
Centos8 implementation steps to build a local web server
SFTP dual-machine high availability environment deployment record under Centos
Environment configuration of JDK, mysql and tomcat under Centos7
CentOS7.3 64 bit, build Zabbix3.4
CentOS build private git
Deploy GitBook under CentOS7
Linux (centos7) build gitlab
Build k8s1.9.9 on centos7
Centos6.9 build rabbitmq 3.6.8 cluster
Install php in centos
Install mysql5.7 under CentOS7
Hadoop environment construction (centos7)
Install CentOS under VMware
Centos7 build Kubernetes cluster
Centos6.9 install npm environment
Jenkins build on centos
Deploy JDK+Tomcat8 under CentOS
Install mysql under Centos 7
Configure lamp under centos6.8
Build Hadoop in CentOS
A centos initialization script
Install Jenkins under Centos 7
Redis3 installation under Centos7
Centos7 build DNS service