Author Topic: Install php 7.2.4 and php-fpm on centos web panel  (Read 17459 times)

0 Members and 1 Guest are viewing this topic.

Offline
***
Install php 7.2.4 and php-fpm on centos web panel
« on: March 30, 2018, 10:47:33 AM »
Quote
mkdir bullten
cd bullten
wget http://am1.php.net/distributions/php-7.2.4.tar.gz
tar zxvf php-7.2.4.tar.gz
cd php-7.2.4

Quote
./configure --with-bz2 \
   --prefix=/usr/local/php \
   --with-apxs2=/usr/local/apache/bin/apxs \
   --with-curl \
   --with-libdir=/usr/lib64 \
   --with-config-file-path=/usr/local/php \
   --with-config-file-scan-dir=/usr/local/php/php.d \
   --with-iconv \
   --with-gd \
   --with-jpeg-dir=/usr/local/php \
   --with-png-dir \
   --with-freetype-dir=/usr/local/php \
   --with-kerberos \
   --enable-fpm \
   --enable-mbstring \
   --with-mhash \
   --with-mysqli \
   --with-sqlite3 \
   --with-mysqli=mysqlnd \
   --with-mysql-sock=/var/lib/mysql/mysql.sock \
   --with-xsl \
   --with-pspell \
   --with-openssl \
   --with-gettext \
   --with-pcre-regex \
   --with-libxml-dir=/usr/local/php \
   --with-pdo-mysql \
   --with-pic \
   --with-pear=/usr/local/php/pear \
   --with-gmp \
   --enable-zip \
   --with-zlib \
   --enable-inline-optimization \
   --enable-mbregex \
   --enable-opcache \
   --enable-fpm \
   --enable-posix \
   --enable-calendar \
   --enable-bcmath \
   --enable-exif \
   --enable-phar \
   --enable-ftp \
   --enable-pdo \
   --enable-soap \
   --enable-sockets \
   --enable-intl \
   --with-xmlrpc \
   --without-pdo-sqlite
   
Quote
make && make install

Quote
rm -rf /usr/local/php/php.d/ioncube.ini
rm -rf /usr/local/php/php.ini
cp php.ini-production /usr/local/php/php.ini
rm -rf /usr/local/bin/php
ln -s /usr/local/php/bin/php /usr/local/bin/php
cp /root/bullten/php-7.2.4/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

Quote
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
nano php-fpm.conf

uncomment below lines
Quote
pid = run/php-fpm.pid
error_log = log/php-fpm.log

Quote
cd php-fpm.d
cp www.conf.default yourdomain.com.conf
nano yourdomain.com.conf

change to yourusername and edit other lines as needed.

Quote
user = yourusername
group = yourusername

Quote
mkdir -p /usr/local/php/log/


edit your vhost file and add the below lines just below scripalias

Quote
<LocationMatch "^/(.*\.php(/.*)?)$">
        ProxyPass fcgi://127.0.0.1:9000/home/yourusername/public_html/$1
    </LocationMatch>


nano /usr/local/apache/conf/httpd.conf
uncomment the below line
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

service php-fpm start
service php-fpm restart
service php-fpm status
service php-fpm stop






Offline
***
Re: Install php 7.2.4 and php-fpm on centos web panel
« Reply #1 on: June 09, 2018, 05:06:16 PM »
Thanks for the good information

Offline
***
Re: Install php 7.2.4 and php-fpm on centos web panel
« Reply #2 on: June 10, 2018, 03:43:04 PM »
Guys, this is important:

# don't
<IfModule mod_proxy.c>
  ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/
</IfModule>

# do this instead
# Use SetHandler on Apache 2.4 to pass requests to PHP-PFM
<FilesMatch \.php$>
  SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>



You can read more detail at this link :
https://ma.ttias.be/apache-2-4-proxypass-for-php-taking-precedence-over-filesfilesmatch-in-htaccess/

I got the issue with Nextcloud, could not login in Sync Client, and the app rejected to upload files (error: Unknown protocol "'", connection closed) , buy doing these steps you can fix the issues
« Last Edit: June 10, 2018, 04:25:33 PM by locvfx »