Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Issues After Switch to PHP-FPM

Discussion in 'General Discussion' started by celiac101, Mar 15, 2018.

Tags:
  1. celiac101

    celiac101 Well-Known Member

    Joined:
    Dec 19, 2012
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    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" myemail@gmail.com)

    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?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
  3. celiac101

    celiac101 Well-Known Member

    Joined:
    Dec 19, 2012
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    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" myemail@gmail.com)

    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
     
  4. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,596
    Likes Received:
    60
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    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)
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
  6. celiac101

    celiac101 Well-Known Member

    Joined:
    Dec 19, 2012
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    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" myemail@gmail.com)
     
  7. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    372
    Likes Received:
    20
    Trophy Points:
    93
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @celiac101

    Once you open the ticket could you please update the thread with your ticket ID so we can track the ticket's progress?


    Thank you!
     
Loading...

Share This Page