celiac101

Well-Known Member
Dec 19, 2012
113
4
68
cPanel Access Level
Website Owner
I switched over to PHP-FPM using PHP 7.0x and and Memcached (all sites use https) and I have a few issues:

1) I can't be sure that all of my cron jobs are running correctly. They are in this format in the root cron job /var/spool/cron/root :

SHELL="/bin/bash"
*/5 * * * * /usr/local/cpanel/scripts/dcpumon-wrapper >/dev/null 2>&1

The ones that seem to not work optimize my databases, and include a hook to email me when done, and I seem to have stopped getting the emails:

SHELL="/bin/bash"
22 0 * * 3,5 (mysqlcheck -op -u root database_name_here -pMYPASS 2>&1 | mail -s "optimizeDB Articles Output" [email protected])

It's possible that they are all working, and that I'm not getting email. But is there a format change to cronjobs when switching to PHP-FPM?


2) Most of the time I can't SFTP to the server until I restart the PHP-FPM Apache service. I suspect that this has to do with my resource settings. My server is very busy. What setting should I look to increase in order to be able to connect again with SFTP?


3) I made the switch to PHP-FPM from SUPHP for performance reasons, however, is there a configuration for security settings for PHP-FPM that I need to edit? Are there settings like in SUPHP somewhere?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
Hello,

1. The cron issue does not look to relate to PHP-FPM because none of the cron jobs you mentioned reference a PHP script. Check /var/log/exim_mainlog at the time of those cron jobs to see if you notice any output. Also, ensure the crond service is running:

Code:
service crond restart
2. What error message do you see in /var/log/secure when SFTP access fails?

3. There are no specific settings that you are required to edit for security, but you are welcome to change any PHP settings that better suite your preferences if you feel it's more secure than the default value. We document how to modify the default PHP-FPM configuration settings at:

Configurations Values of PHP-FPM - Version 70 Documentation - cPanel Documentation

Thank you.
 

celiac101

Well-Known Member
Dec 19, 2012
113
4
68
cPanel Access Level
Website Owner
1) Regarding my cron jobs, this format cron is no longer working at all, but it turns out crons in the other format listed above are running. Is there another way to write this type of cronjob so that it will run? I will assume that either the recent major apache update I ran broke this, or my switch to PHP-FPM did:

SHELL="/bin/bash"
22 0 * * 3,5 (mysqlcheck -op -u root database_name_here -pMYPASS 2>&1 | mail -s "optimizeDB Articles Output" [email protected])

2) My FTP client throws an "unknown socket error" and here is what the log records. Again, I must restart the apache PHP-FPM to be able to connect using SFTP. I suspect it is a resource issue, perhaps with my PHP-FPM config settings, but I've tried dozens of different config settings and none seem to fix this issue (no, the link to the cpanel documentation does little to help one figure out the correct config settings, sorry, but that is nearly always the case with links to cpanel documentation--you guys throw these links around, but they rarely contain real world examples of config files for different server configurations, which would be the kind of info that would actually be helpful--but I do appreciate your attempt to help me!):

/var/log/secure:
Mar 22 08:49:58 servername sshd[31108]: Accepted password for username from 123.123.123.123 port 1035 ssh2
Mar 22 08:49:58 servername sshd[31108]: pam_unix(sshd:session): session opened for user username by (uid=0)
Mar 22 08:49:58 servername sshd[31115]: subsystem request for sftp
Mar 22 08:50:13 servername sshd[31115]: Received disconnect from 123.123.123.123: 11: Session closed ok
Mar 22 08:50:13 servername sshd[31108]: pam_unix(sshd:session): session closed for user username
Mar 22 08:50:24 servername sshd[7949]: pam_unix(sshd:session): session closed for user username
 

sparek-3

Well-Known Member
Aug 10, 2002
2,087
243
368
cPanel Access Level
Root Administrator
1) Regarding my cron jobs, this format cron is no longer working at all, but it turns out crons in the other format listed above are running. Is there another way to write this type of cronjob so that it will run? I will assume that either the recent major apache update I ran broke this, or my switch to PHP-FPM did:

SHELL="/bin/bash"
22 0 * * 3,5 (mysqlcheck -op -u root database_name_here -pMYPASS 2>&1 | mail -s "optimizeDB Articles Output" [email protected])
What makes you believe that this format isn't working? Or is it some other format that isn't working? Too many pronouns being used. I don't know what "this" is referring to or what "the other" is referring to.

Encapsulating the command section of this cron in parenthesis is not really necessary, since you're encapsulating all of it. If you were wanting to run two command in sequence and mail out the output of both commands, then the parenthesis would be needed. But in this instance, you're running one command and sending the output of that out through mail.

There's nothing really wrong with the way you have this set up. It's just an unnecessary step. (Other than... you know, putting your MySQL root password there in plain text, conceivably potentially revealing that information in a process list... but that's off this post's intended topic)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
2) My FTP client throws an "unknown socket error" and here is what the log records. Again, I must restart the apache PHP-FPM to be able to connect using SFTP. I suspect it is a resource issue, perhaps with my PHP-FPM config settings, but I've tried dozens of different config settings and none seem to fix this issue (no, the link to the cpanel documentation does little to help one figure out the correct config settings, sorry, but that is nearly always the case with links to cpanel documentation--you guys throw these links around, but they rarely contain real world examples of config files for different server configurations, which would be the kind of info that would actually be helpful--but I do appreciate your attempt to help me!):

/var/log/secure:
Mar 22 08:49:58 servername sshd[31108]: Accepted password for username from 123.123.123.123 port 1035 ssh2
Mar 22 08:49:58 servername sshd[31108]: pam_unix(sshd:session): session opened for user username by (uid=0)
Mar 22 08:49:58 servername sshd[31115]: subsystem request for sftp
Mar 22 08:50:13 servername sshd[31115]: Received disconnect from 123.123.123.123: 11: Session closed ok
Mar 22 08:50:13 servername sshd[31108]: pam_unix(sshd:session): session closed for user username
Mar 22 08:50:24 servername sshd[7949]: pam_unix(sshd:session): session closed for user username
Hello,

Could you open a support ticket for the SFTP issue specifically so we can take a closer look?

Create Support Ticket - Version 68 Documentation - cPanel Documentation

Thank you.
 

celiac101

Well-Known Member
Dec 19, 2012
113
4
68
cPanel Access Level
Website Owner
I will create a ticket and let you know what I find, as the SFTP connection issue is still a problem. I have a busy site, a suspect it is a resource issue.

Also, this type of cron is working...I am not 100% sure why it wasn't directly after I switched to PHP-FPM, but once I increased various resource settings it seems to work fine now.

SHELL="/bin/bash"
22 0 * * 3,5 (mysqlcheck -op -u root database_name_here -pMYPASS 2>&1 | mail -s "optimizeDB Articles Output" [email protected])