Resolved - File permission after changing PHP | Plesk Forum
  1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

Resolved File permission after changing PHP

Discussion in 'Plesk 12.x for Linux' started by Jim, Apr 17, 2017.

  1. Jim

    Jim Basic Pleskian

    8
    70%
    Joined:
    Jun 18, 2015
    Messages:
    36
    Likes Received:
    0
    In the hosting settings, I changed the PHP support from Run PHP as CGI Application to Apache module and all the sudden I have file permission issues in WordPress. I added pasacln to apache :
    Code:
    sudo /usr/sbin/usermod -a -G apache pasacln
    but I still have the file permission issue. If I switch back to PHP as CGI Application, then permission issue is resolved.

    Can someone suggest a way to fix this?

     
  2. UFHH01

    UFHH01 Plesk addicted! Plesk Guru

    44
    64%
    Joined:
    Jun 11, 2013
    Messages:
    5,804
    Articles:
    1
    Likes Received:
    1,297
    Location:
    Hamburg / Germany
    Hi Jim,

    pls. correct your command to: => psacln

    ... and pls. consider as well to add
    Code:
    sudo /usr/sbin/usermod -a -G nginx psacln
     
  3. Jim

    Jim Basic Pleskian

    8
    70%
    Joined:
    Jun 18, 2015
    Messages:
    36
    Likes Received:
    0
    thanks but it says "user 'psacln' does not exist"

    when I login using FTP it own/group for the files is "my_ftp_user psacln"
     
  4. UFHH01

    UFHH01 Plesk addicted! Plesk Guru

    44
    64%
    Joined:
    Jun 11, 2013
    Messages:
    5,804
    Articles:
    1
    Likes Received:
    1,297
    Location:
    Hamburg / Germany
    ups... sorry... my fault... I just copied YOUR command, without thinking about it.

    The CORRECT command is certainly:

    Code:
    usermod -aG psacln nginx
    ... where the FIRST is always the GROUP and the second one is always the USER. ;)
     
  5. Jim

    Jim Basic Pleskian

    8
    70%
    Joined:
    Jun 18, 2015
    Messages:
    36
    Likes Received:
    0
    is this the only command I should run? just for nginx and no apache one?
     
  6. UFHH01

    UFHH01 Plesk addicted! Plesk Guru

    44
    64%
    Joined:
    Jun 11, 2013
    Messages:
    5,804
    Articles:
    1
    Likes Received:
    1,297
    Location:
    Hamburg / Germany
    Hi Jim,

    there is "normally" no need to add the apache - system - user to the group psacln, but it won't do any harm to your system, if you do that. ;)
     
  7. Jim

    Jim Basic Pleskian

    8
    70%
    Joined:
    Jun 18, 2015
    Messages:
    36
    Likes Received:
    0
    Thanks, I added the command but I still have the permission issue
    WordPress keeps asking me for ftp credentials and in some plugins I get can't write to file errors

    if I switch back to PHP as CGI Application, then permission issue is resolved.

    I want to be able to work with Apache module and not the PHP as CGI Application
     
  8. UFHH01

    UFHH01 Plesk addicted! Plesk Guru

    44
    64%
    Joined:
    Jun 11, 2013
    Messages:
    5,804
    Articles:
    1
    Likes Received:
    1,297
    Location:
    Hamburg / Germany
    Best Answer
    Hi Jim,

    pls. feel free to enable the ( old ) PHP - handlers ( which is not recommended anymore, because of several vulnerabilities! ), which are disabled by default now.


    First, REREAD your PHP - handler, which are installed on your server ( logged in as user "root" over SSH ):
    Code:
    plesk bin php_handler --reread
    Second, pls. LIST your PHP - handler on the command line:
    Code:
    plesk bin php_handler --list
    Third, pls. ENABLE possible handler, which are in the state "disabled":
    Code:
    EXAMPLES ( !!! )
    
    plesk bin php_handler --enable -id module
    
    plesk bin php_handler --enable -id plesk-php71-cgi

    => You are now able to use the "mod_php" ( module ) version, and as well the CGI - version of the corresponding PHP - version. ;)
     
    Last edited: Apr 18, 2017
    Jim likes this.
  9. Jim

    Jim Basic Pleskian

    8
    70%
    Joined:
    Jun 18, 2015
    Messages:
    36
    Likes Received:
    0
    @UFHH
    Thanks, I didnt know PHP module is risky. The only reason I wanted to use it was to use APC. I installed APC using your instructions here but when I go to mysite.com/apc.php It says that APC is not installed. If I switched to Apache Module then it says APC is installed. We cant use APC when we have run php as fastcgi application?
     
  10. UFHH01

    UFHH01 Plesk addicted! Plesk Guru

    44
    64%
    Joined:
    Jun 11, 2013
    Messages:
    5,804
    Articles:
    1
    Likes Received:
    1,297
    Location:
    Hamburg / Germany
    Hi Jim,

    did you know, that each PHP - version has it's OWN modules? To install APCu for your vendor PHP version, you would certainly use for example:

    Code:
    pecl install apcu

    But if you use for example the additional PHP - version Plesk-PHP 7.1 for your (sub)domain, then you have to use:

    Code:
    /opt/plesk/php/7.1/bin/pecl install apcu




    The "mod_php" - version is from your VENDOR and depending to your operating system and possible manual additionals, you will find this version at "/etc/php" or "/etc/php5". But when you use one of the Plesk PHP versions, the paths are:

    Code:
    /opt/plesk/php/5.2/
    /opt/plesk/php/5.3/
    /opt/plesk/php/5.4/
    /opt/plesk/php/5.5/
    /opt/plesk/php/5.6/
    /opt/plesk/php/7.0/
    /opt/plesk/php/7.1/
     
Loading...