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.

SOLVED PHP-FPM and PHP user

Discussion in 'EasyApache' started by Nicola Urbinati, Mar 28, 2017.

Tags:
  1. Nicola Urbinati

    Joined:
    Feb 1, 2017
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    Hi,

    I am running last 11.62.17, on Cloudlinux 7.3

    I configured EasyApahce4 to use PHP-FPM, but I see a strange behavour in a Wordpress site hosted on the server.
    • I had many problems installing plugins (mostly those that create files out of the plugins directory, as it turned out)
    • I saw that images uploaded to WP media library were not showed (nor in media library, nor on the frontend)
    Troubleshooting, I had to put directories' permissions to 777 to even create dirs and files.
    Going deep in my troubleshooting, I saw the problem was not the permissions, but the owner of the dirs/files, as Wordpress tried to use nobody:nobody instead of user:user (the owner of the homedir and the hosted site).

    I am afraid it has to do with PHP-FPM settings non properly done, as I see no confg file for the domain and in the default one the listening user:group is nobody:nobody.

    Don't even know if this is the right path to solve this, as I can't see how to properly set PHP-FPM settins.

    Any help?

    Thank you.
     
  2. Anoop P Alias

    Anoop P Alias Well-Known Member

    Joined:
    Mar 31, 2015
    Messages:
    65
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Kochi,Kerala,India
    cPanel Access Level:
    Root Administrator
    Looks like your file has bad ownership!. PHP-FPM pool run with user creds.

    Run in the document root the following commands

    find ./ -type f -exec chmod 644 {} \;
    find ./ -type d -exec chmod 755 {} \;
    chown -R cpaneluser:cpaneluser *

    That should solve all your issues.
     
  3. Nicola Urbinati

    Joined:
    Feb 1, 2017
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    Hi!

    I that's what I did to see the uploaded images (I had to upload the plugins manually as the Wordpress installer couldn't work).
    Any new uploaded image comes with nobody:nobody owner anyway...

    How can I check the FPM user?
     
  4. Nicola Urbinati

    Joined:
    Feb 1, 2017
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    PS: I think there's some settings to do in the pool.d/<domain>.conf file, like user/group settings, or listening user/group, but I can't find the <domain>.conf file, just default.conf and a test one.
     
  5. Nicola Urbinati

    Joined:
    Feb 1, 2017
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    PS 2: I use php7.0 if that's a clue.
     
  6. Anoop P Alias

    Anoop P Alias Well-Known Member

    Joined:
    Mar 31, 2015
    Messages:
    65
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Kochi,Kerala,India
    cPanel Access Level:
    Root Administrator
    You don't seem to be running php-fpm. Put a phpinfo file in the doc_root and see what SAPI it shows.It must be FPM/FastCGI

    I think you are running php as cgi .
     
    cPanelMichael likes this.
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,086
    Likes Received:
    1,288
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you let us know the specific steps you took to enable PHP-FPM for this domain name? Are you able to upload a PHPINFO file to the account to confirm which handler is enabled, as referenced in the previous post?

    Thank you.
     
  8. Nicola Urbinati

    Joined:
    Feb 1, 2017
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    Hi,

    Here is the list of packages I'm provisioning through EasyApahce4:
    • apache24
    • apr
    • apr-devel
    • apr-util
    • apr-util-devel
    • config
    • config-runtime
    • cpanel-tools
    • devel
    • documentroot
    • libmcrypt
    • libtidy
    • mod_bwlimited
    • mod_cgid
    • mod_deflate
    • mod_env
    • mod_expires
    • mod_ext_filter
    • mod_headers
    • mod_hostinglimits
    • mod_mpm_event
    • mod_proctitle
    • mod_proxy
    • mod_proxy_fcgi
    • mod_proxy_http
    • mod_remoteip
    • mod_security2
    • mod_ssl
    • mod_unique_id
    • modsec-sdbm-util
    • php-cli
    • php70
    • php70-libc-client
    • php70-pear
    • php70-php-bcmath
    • php70-php-calendar
    • php70-php-cli
    • php70-php-common
    • php70-php-curl
    • php70-php-devel
    • php70-php-exif
    • php70-php-fileinfo
    • php70-php-fpm
    • php70-php-ftp
    • php70-php-gd
    • php70-php-imap
    • php70-php-ioncube6
    • php70-php-litespeed
    • php70-php-mbstring
    • php70-php-mcrypt
    • php70-php-mysqlnd
    • php70-php-opcache
    • php70-php-pdo
    • php70-php-posix
    • php70-php-sockets
    • php70-php-tidy
    • php70-php-xml
    • php70-php-zip
    • php70-runtime
    • profiles-cpanel
    • tools

    And here's the info.php: [Removed] (cgi indeed, I didn't check as phpinfo was disabled for security and I was quite sure to have selected the right modules in EA4)
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,086
    Likes Received:
    1,288
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    PHP-FPM is enabled on a per-domain basis. You can browse to "WHM >> MultiPHP Manager" and select the domain name you'd like to enable PHP-FPM on.

    Thank you.
     
  10. Nicola Urbinati

    Joined:
    Feb 1, 2017
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Website Owner
    I thougth I did it, but it showed FPM as disabled, probably didn't work properly the first time and I got it as done.
    Now I am sure it's enabled (and shows in phpinfo).

    .... and images are working wonderful now, thank you!
     
    cPanelMichael likes this.
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,086
    Likes Received:
    1,288
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    I'm happy to see it's working well. Thank you for updating us with the outcome.
     
Loading...

Share This Page