PHP-FPM Enable

Started by drajvat, December 04, 2018, 05:13:22 AM

Previous topic - Next topic

drajvat

I enabled Apache -> PHP-FPM with version 7.2, however, when I run phpinfo() function it shows CGI/FastCGI version 5.6. So why PHP-FPM not working?

I also have enabled Apache -> PHP-FPM in Webserver domain Conf. Even I tried using nginx only with php-fpm but it gives 404 error. By the way, i am testing this on freshly installed machine.

Please help me to understand it better.

GTMAN

Phpinfo shows you which version the CWP panel is using ...not what users are using.

There are 2 or more versions of PHP running off the server. The one that CWP uses is selected using the PHP Version Switcher. You need to compile a 7.x.x version with FPM selected.

sva260

i can confirm this problem ,
php-fpm don't work automatically , even if rebuild server apache with options FPM

is there any code we put manual in vhosts to make fpm work ?

MAMAC



drajvat

Yes, its not working as documented by CWP. No official reply yet, I am a pro user.

MAMAC

Quote from: sva260 on December 06, 2018, 04:09:28 AM
Quote from: MAMAC on December 05, 2018, 10:13:30 PM
For me its running  https://prnt.sc/lr8v06

can you pls copy vhosts here ?


server {
listen 188.165.216.48:443 ssl http2 ;
server_name name.com  www.name.com;
access_log /usr/local/apache/domlogs/name.com.bytes bytes;
access_log /usr/local/apache/domlogs/name.com.log combined;
error_log /usr/local/apache/domlogs/name.com.error.log error;

ssl_certificate      /etc/pki/tls/certs/name.com.bundle;
ssl_certificate_key  /etc/pki/tls/private/name.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA!RC4:EECDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
ssl_prefer_server_ciphers   on;

ssl_session_cache   shared:SSL:10m;
ssl_session_timeout 60m;

location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|woff|ttf|svg|eot|sh)\$ {
root /home/name/public_html;
expires max;
try_files \$uri \@backend;
}

error_page 405 = \@backend;
error_page 500 = \@custom;
add_header X-Cache "HIT from Backend";
add_header Strict-Transport-Security "max-age=31536000";
add_header X-Content-Type-Options nosniff;
proxy_pass http://188.165.216.48:82;
include proxy.inc;
}

location \@backend {
internal;
proxy_pass http://188.165.216.48:82;
include proxy.inc;
}

location \@custom {
internal;
proxy_pass http://188.165.216.48:82;
include proxy.inc;
}

location ~ .*\.(php|jsp|cgi|pl|py)?\$ {
proxy_pass http://188.165.216.48:82;
include proxy.inc;
}

location ~ /\.ht    {deny all;}
location ~ /\.svn/  {deny all;}
location ~ /\.git/  {deny all;}
location ~ /\.hg/   {deny all;}
location ~ /\.bzr/  {deny all;}

disable_symlinks if_not_owner from=/home/name/public_html;

location /.well-known/acme-challenge {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}
}

Smeklinis

Quote from: drajvat on December 04, 2018, 05:13:22 AM
I enabled Apache -> PHP-FPM with version 7.2, however, when I run phpinfo() function it shows CGI/FastCGI version 5.6. So why PHP-FPM not working?

I also have enabled Apache -> PHP-FPM in Webserver domain Conf. Even I tried using nginx only with php-fpm but it gives 404 error. By the way, i am testing this on freshly installed machine.

Please help me to understand it better.

I have exactly the same problem. I am using apache + php-fpm 7.2.
I think there is problem in permissions - for me seems php-fpm working , but only for root , not for users (i have 3 of them):



Also i can see in CWP dashboard's -Top 5 Process- - when process is running by root it is php-fpm mostly , some times php - and when from other user - php-cgi. And at that time i have big spikes on cpu usage.

I rebuilded all vhosts in Main Conf and Domain Conf.

Here my php info:




MAMAC

Quote from: Smeklinis on December 06, 2018, 07:43:50 PM
Quote from: drajvat on December 04, 2018, 05:13:22 AM
I enabled Apache -> PHP-FPM with version 7.2, however, when I run phpinfo() function it shows CGI/FastCGI version 5.6. So why PHP-FPM not working?

I also have enabled Apache -> PHP-FPM in Webserver domain Conf. Even I tried using nginx only with php-fpm but it gives 404 error. By the way, i am testing this on freshly installed machine.

Please help me to understand it better.

I have exactly the same problem. I am using apache + php-fpm 7.2.
I think there is problem in permissions - for me seems php-fpm working , but only for root , not for users (i have 3 of them):



Also i can see in CWP dashboard's -Top 5 Process- - when process is running by root it is php-fpm mostly , some times php - and when from other user - php-cgi. And at that time i have big spikes on cpu usage.

I rebuilded all vhosts in Main Conf and Domain Conf.

Here my php info:



I must say that i add config in  webservers domain config https://prnt.sc/lrolbl  maybe it can help to u.

Smeklinis

Quote from: MAMAC on December 06, 2018, 08:31:48 PM
I must say that i add config in  webservers domain config https://prnt.sc/lrolbl  maybe it can help to u.

I did that , i am using apache-->>php-fpm. Can you share your php info screen ?


Smeklinis

After several days full of reading and experiments i decided to add new user and domain in CWP (with Apache-->>php-fpm config enabled). And what i get :



So going to compare all configs of domains added before php-fpm update to find a bug.

Smeklinis

Ok
For me php-fpm not worked only on https.

I have added new user and domain in CWP as non SSL and phpinfo shows everything is ok.
What i found: For non SSL version there is /usr/local/apache/conf.d/vhosts.conf and in it is only
IncludeOptional /usr/local/apache/conf.d/vhosts/*.conf
So all vhosts sits in that directory.

For SSL:
/usr/local/apache/conf.d/vhosts-ssl.conf
Here i have all domains in this file, but here is no such line on each domain:

<IfModule proxy_fcgi_module>
      <FilesMatch \.php$>
         SetHandler "proxy:unix:/opt/alt/php-fpm72/usr/var/sockets/USERNAME.sock|fcgi://localhost/"
      </FilesMatch>
   </IfModule>

In /usr/local/apache/conf.d/vhosts/ in each domains vhost (ssl and non ssl) i have that line with php-fpm proxy socket.

I deleted all in vhosts-ssl.conf and put that line in it:
IncludeOptional /usr/local/apache/conf.d/vhosts/*.conf

Restarted Apache.

So now seems php-fpm is working on all domains.

Also i uncommented in httpd.conf LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
But i think this is already done in /usr/local/apache/conf.d/php-fpm.conf

wecreate

Hi there.

My problem is a bit different. FPM works only if I use NOBODY socket, I have no USER.sock file created along with the new accounts. I can create USER.sock file manually, but not sure what kind of permissions should i set, my current attempts did not bring any good results. Any idea how to solve it, or what to do, to create individual sockets for each user I've got with CWP.

<IfModule proxy_fcgi_module>
   <FilesMatch \.php$>
      SetHandler "proxy:unix:/opt/alt/php-fpm72/usr/var/sockets/NOBODY.sock|fcgi://localhost/"
   </FilesMatch>
</IfModule>

Smeklinis

#13
I have in /opt/alt/php-fpm72/usr/etc/php-fpm.d/users/ conf files for each user. Also nobody.conf. For all files permissions is root:root 0644

In users conf i have this:

[USER]
listen = /opt/alt/php-fpm72/usr/var/sockets/USER.sock
listen.allowed_clients = 127.0.0.1

listen.owner = USER
listen.group = nobody
listen.mode = 0660
user = USER
group = USER

;request_slowlog_timeout = 15s
;slowlog = /opt/alt/php-fpm72/usr/var/log/php-fpm-slowlog-USER.log

pm = ondemand
pm.max_children = 4
pm.max_requests = 4000
pm.process_idle_timeout = 15s

;listen.backlog = -1
;request_terminate_timeout = 0s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes

env[HOSTNAME] = $HOSTNAME
env[TMP] = /home/USER/tmp
env[TMPDIR] = /home/USER/tmp
env[TEMP] = /home/USER/tmp
env[PATH] = /usr/local/bin:/usr/bin:/bin

All "USER" is cwp user in lowercase.

In /opt/alt/php-fpm72/usr/etc/php-fpm.d/users.conf i have:
include=/opt/alt/php-fpm72/usr/etc/php-fpm.d/users/*.conf

USER.sock files in /opt/alt/php-fpm72/usr/var/sockets/ have permissions:

Group: nobody [99]
Owner USER [100*]
0660
"USER" is cwp user in lowercase.

studio4host

VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.