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