Koozali.org: home of the SME Server

My site stopped running because of PHP versions discrepancy(?) at some moment

Offline leonp

  • **
  • 43
  • +0/-0
Hello, all.
I had everything working in my SME10 installation till some 2-3 days ago - don't know exactly, was on vacation.
I have no custom installations, just pure V10 installation.

What I see is that httpd error log contains:
[proxy:error] [pid 11796] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /var/run/php-fpm/php74-web.sock (*) failed
[proxy_fcgi:error] [pid 11796] [client 208.100.26.244:54278] AH01079: failed to make connection to backend: httpd-UDS

Looking into /var/run/php-fpm/ I see:
-rw-r--r-- 1 root root 3 Mar 22 07:30 php55-fpm.pid
srw-rw---- 1 root www  0 Mar 22 07:30 php55.sock
-rw-r--r-- 1 root root 3 Mar 22 07:30 php56-fpm.pid
srw-rw---- 1 root www  0 Mar 22 07:30 php56.sock
-rw-r--r-- 1 root root 5 Mar 22 09:44 php-fpm.pid
srw-rw---- 1 root www  0 Mar 22 09:44 php.sock

while /etc/httpd/httpd.conf file refers to php74 in many places. In particuler:
        SetHandler "proxy:unix:/var/run/php-fpm/php74-web.sock|fcgi://localhost"

I also looked into /var/log/php and saw directories (ls /var/log/php):
opendocman  php  php55  php56  php70  php71  php72  php73  php74  php80  php81  Primary  web
In each one of the phpXX directories there are log files without errors, stating that the service started:
fpm is running, pid xxxx
ready to handle connections
systemd monitor interval set to 10000ms

Also /etc/php-fpm.d/www.conf file has (among others):
listen.owner = root
listen.group = www
listen.mode = 0660
listen = /var/run/php-fpm/php.sock


And php -v gives:
PHP 5.4.16 (cli) (built: Apr  1 2020 04:07:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.5, Copyright (c) 1999-2015, by Zend Technologies

As i am absolutely newbie in http-php configuration area, I don't know what to do now...
Please, help!
-----------------------------------
UPDATE:
Really accidentally I found in the /etc/systemd/system directory (among others):
php70-php-fpm.service.d 
php73-php-fpm.service.d 
php81-php-fpm.service.d 
php55-php-fpm.service.d 
php71-php-fpm.service.d 
php74-php-fpm.service.d 
php56-php-fpm.service.d 
php72-php-fpm.service.d 
php80-php-fpm.service.d
Here i decided to do:
service php74-php-fpm start
and everything started to work!!!!!!!!!!!

Still any clarifications will be highly appresiated...:-)
« Last Edit: March 22, 2022, 02:01:00 PM by leonp »

Offline ReetP

  • *
  • 3,722
  • +5/-0
SME runs php-fpm now - it is more flexible than the way we used to run php.

Code: [Select]
attempt to connect to Unix domain socket /var/run/php-fpm/php74-web.sock
So it looks like your php74 version stopped. Only your logs will tell you why. You need to go and have a read in your log system.

Code: [Select]
And php -v gives:
That's because the underlying CentOS 7 system still has PHP there but we do not use it for anything.

Quote
As i am absolutely newbie in http-php configuration area,

Don't hack anything about, and start reading so you learn.

Code: [Select]
service php74-php-fpm start
Why would you use service when you now have sytemd?

Information with clues on why it stopped would be here:
Code: [Select]
systemctl status php74-php-fpm
Logs:
Code: [Select]
journalctl -u php74-php-fpm
Or generally:
Code: [Select]
journactl -xe
Restarting would be like this:
Code: [Select]
systemctl restart php74-php-fpm
Most of this is in the wiki so please use it. It will answer many of your questions and educate you as well.

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline leonp

  • **
  • 43
  • +0/-0
Thank you for your help.
- I was not sure if I can use wiki as it states that it is valid till version 9.2 only.
- journalctl -u php74-php-fpm returned the real cause of the problem:
php74-php-fpm.service start operation timed out. Terminating.
Searching the internet found that it takes a lot of time to this service to start from some kernel version.
So, I did:
sudo vi /etc/systemd/system/multi-user.target.wants/php7.2-fpm.service
TimeoutStartSec=300s
TimeoutStopSec=300s
and now it works after reboots.

Offline ReetP

  • *
  • 3,722
  • +5/-0
Thank you for your help.
- I was not sure if I can use wiki as it states that it is valid till version 9.2 only.

What says it is v9.2 only? There may be some old sections but generally you can use it. If there are and they need updating you can help us by opening a documentation bug.

Please provide the information requested or we can't really help you.

Quote
- journalctl -u php74-php-fpm returned the real cause of the problem:
php74-php-fpm.service start operation timed out. Terminating.
Searching the internet found that it takes a lot of time to this service to start from some kernel version.

That nay, or may not be the issue.

Quote
So, I did:
sudo vi /etc/systemd/system/multi-user.target.wants/php7.2-fpm.service
TimeoutStartSec=300s
TimeoutStopSec=300s
and now it works after reboots.

OK, so you edited a php7.2-fpm.service file, which is the wrong file because you don't know what you are doing, but that fixed php74-php-fpm ? Really?

Are you sure it is a problem with the kernel, and why? What spec is your machine? CPU/RAM?

Please be methodical and DON'T jump to conclusions, and if you are inexperienced DON'T just go hacking around files.

Yes, SME is CENTOS 7 underneath BUT it has a lot of special effects in there and your changes are likely to get overwritten. There is a right place to amend this, but it is NOT where you did it or how you should do it.

Please answer the questions and we can try and look at it properly.

Thanks.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline leonp

  • **
  • 43
  • +0/-0
1. About wiki - may be I do not know where to search, but https://wiki.koozali.org/Php-fpm contains:
"This contribs allow you to run php-fpm for php version from 5.6 to 7.3 on CentOS 6 (SME9)."

2. About the solution I did - sorry, copying from the source in the internet I forgot to correct 72 to 74. This was the file I corrected:
 /etc/systemd/system/multi-user.target.wants/php7.4-fpm.service
Sorry again.
This correction I found in https://www.linode.com/community/questions/17135/php-fpm-is-failing-after-reboot-with-error-502-why

3. "What spec is your machine? CPU/RAM?"
This is Intel(R) Pentium(R) CPU G2030 @ 3.00GHz with 2 cores and 2GB RAM running as virtual machine with 120GB disk.
This is pure SME10 installed from scratch about 2-3 months ago.

Finally, I understand that what I did is not in the correct place and may be not correct at all. I just wanted to move somehow the situation forward.
I will be very thankful if you will be able to point me what is the correct way to do this.

Online TerryF

  • grumpy old man
  • *
  • 1,821
  • +6/-0
3. "What spec is your machine? CPU/RAM?"
2GB RAM

This, with just 2gb of mem are asking for issues, the cpu etc is getting a bit long in the tooth as well..

Throw another 2gb in and it will help a lot..
--
qui scribit bis legit

Offline ReetP

  • *
  • 3,722
  • +5/-0
Quote
"This contribs allow you to run php-fpm for php version from 5.6 to 7.3 on CentOS 6 (SME9)."

You aren't running SME 9. I don't think you have (hope you haven't) the contrib for smeserv-php-fpm installed.

https://wiki.koozali.org/PHP

Quote
and 2GB RAM

If you had read around here you will have discovered with Clamav you really need 4Gb.

That will probably fix your startup issues with no need for a template.

Quote
I understand that what I did is not in the correct place and may be not correct at all. I just wanted to move somehow the situation forward.

Less haste, more speed.

Rushing into 'fixes' for problems you don't understand  and don't even know how to fix, will lead you to disaster.

If you want advice on fixes then ask your question, answer ours, and be patient.

So the likely issue is lack or RAM (why I asked)

That can cause slow boot plus other issues.

Sme doesn't use multi-user-target which is why it is dangerous to follow other peoples random guides.

It uses sme-server-target, but in any event both use symlinks to /usr/lib/systemd/system/blah.

But those unit files also have an override in say php74-php-from.service.d

It is likely that any 'fix' would go there, but in your case fix the real issue which is RAM.

I suggest you remove your hack.

Also have a read of this for some general advice in reporting issues to help us help you.

Make sure you read the xy problem page too!

https://forums.koozali.org/index.php/topic,54724.0.html

Let us know if the RAM helps.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline leonp

  • **
  • 43
  • +0/-0
- I did not use contrib for smeserv-php-fpm, but when I understood that the problem is in php-fpm, I went to wiki with this question (php-fpm) and that was what I found.

- I never encountered this statement about 4GB, but this is definitely my fault. REALLY SORRY!!!
The source of this issue comes from my previous installation of version 9 which worked many years smoothly with these 2GB RAM. I didn't check the requirements to the machine when updating to V10. My fault totally.
Unfortunately, this computer has 4GB RAM totally and is running another VM too, so I need to install additional RAM, which can't be done too fast. But I promise to do this at the first opportunity...:-)

THANK YOU VERY MUCH

-

Offline Jean-Philippe Pialasse

  • *
  • 2,747
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
vm : check also you have not set balooning on ram, centos7 /sme10 won’t behave great with this option. they run better with static amount of ram.