Created
May 27, 2019 19:05
-
-
Save Faks/2a446a35234e674048c828ffbf534ef7 to your computer and use it in GitHub Desktop.
CentOS 7, nginx, PHP 7.1 Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step by step installation guide for nginx + PHP 7.1 on CentOS 7 | |
1. Add and enable Remi repos | |
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm | |
yum install yum-utils | |
yum-config-manager --enable remi-php71 | |
2. Install php 7.1 and required modules | |
yum install php71-php-fpm | |
php71-php-mysqlnd | |
php71-php-mcrypt | |
php71-php-mbstring | |
php71-php-pecl-memcached | |
php71-php-pecl-apcu | |
php71-php-gd php71-php-imap | |
php71-php-ldap | |
php71-php-odbc | |
php71-php-snmp | |
php71-php-soap | |
php71-php-tidy | |
php71-php-xmlrpc | |
php71-php-pecl-zip | |
php71-php-gd | |
php71-php-process | |
php71-php-intl | |
3. Change php-fpm configuration | |
a) Open: /etc/opt/remi/php71/php-fpm.d/www.conf | |
b) Change socket path. | |
Comment "listen = 127.0.0.1:9000" | |
and after that line insert: | |
"listen = /var/run/php71.sock" | |
c) Change Unix user/group of processes to nginx | |
user = nginx | |
group = nginx | |
d) Uncomment and change socket owner | |
listen.owner = nginx | |
listen.group = nginx | |
listen.mode = 0660 | |
4. Enable & start service | |
systemctl enable php71-php-fpm | |
systemctl start php71-php-fpm | |
5. Set php-fpm path socket in nginx config | |
fastcgi_pass unix:/var/run/php71-fpm.sock; | |
6. (Optional) Set php 7.1 as default on login | |
Create: /etc/profile.d/php.sh | |
source /opt/remi/php71/enable | |
export X_SCLS="`scl enable php71 'echo $X_SCLS'`" | |
=========================================================== | |
Configuration: | |
/etc/opt/remi/php71/php-fpm.d/www.conf | |
/opt/remi/php56/root/etc/php-fpm.d/www.conf | |
Logs: | |
/var/opt/remi/php71/log/php-fpm/www-error.log | |
/var/opt/remi/php71/log/php-fpm/error.log | |
/opt/remi/php56/root/var/log/php-fpm/error.log | |
/var/log/nginx/access.log | |
/var/log/nginx/error.log | |
YUM repositories | |
/etc/yum.repos.d | |
yum repolist all | |
PHP 5.6 | |
Install: | |
yum install php56-php-fpm php56-php-mysqlnd php56-php-mcrypt php56-php-mbstring php56-php-pecl-memcached php56-php-magickwand php56-php-pecl-apcu php56-php-gd php56-php-imap php56-php-ldap php56-php-odbc php56-php-snmp php56-php-soap php56-php-tidy php56-php-xmlrpc php56-php-gd php56-php-process php56-php-intl | |
systemctl enable php56-php-fpm.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment