jeudi 5 février 2015

Necessary user, group and permissions for core updates


What user, group and permissions of files and folders I need for core updates?


Test setups


I tried everything the manual recommended me to. Here are some test setups I used, the setup was recursively used on the WordPress installation.



  • Case A: The owner has read/write permissions.

  • Case B: The owner and group have read/write permissions.


Every permission case above was tried with the following user and group setup.



  1. Owner: Apache | Group: Apache

  2. Owner: Apache | Group: FTPuser

  3. Owner: FTPuser | Group: FTPuser

  4. Owner: FTPuser | Group: Apache


Test results




  • 1A:



    Could not create directory.





  • 1B:



    Could not create directory





  • 2A:



    Could not create directory.





  • 2B:



    The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php





  • 3A:



    Warning: touch(): Unable to create file /home/FTPuser/domains/http://ift.tt/1CYtemE because Permission denied in /home/FTPuser/domains/http://ift.tt/1KqJ6yR on line 155
    Warning: unlink(/home/FTPuser/domains/http://ift.tt/1CYtemE): No such file or directory in /home/FTPuser/domains/http://ift.tt/1KqJ6yR on line 457
    Download failed.: Destination directory for file streaming does not exist or is not writable.





  • 3B:



    Warning: touch(): Unable to create file /home/FTPuser/domains/http://ift.tt/1CYtemE because Permission denied in /home/FTPuser/domains/http://ift.tt/1KqJ6yR on line 155
    Warning: unlink(/home/FTPuser/domains/http://ift.tt/1CYtemE): No such file or directory in /home/FTPuser/domains/http://ift.tt/1KqJ6yR on line 457
    Download failed.: Destination directory for file streaming does not exist or is not writable.





  • 4A:



    Warning: touch(): Unable to create file /home/FTPuser/domains/http://ift.tt/1CYtemE because Permission denied in /home/FTPuser/domains/http://ift.tt/1KqJ6yR on line 155
    Warning: unlink(/home/FTPuser/domains/http://ift.tt/1CYtemE): No such file or directory in /home/FTPuser/domains/http://ift.tt/1KqJ6yR on line 457
    Download failed.: Destination directory for file streaming does not exist or is not writable.





  • 4B:



    The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php





These updates always have been a big issue for WordPress, I would like to clarify this let's find a general solution! The installation is hosted on a CentOS 6.6 server running with DirectAdmin.


EDIT:


The custom configuration at wp-config.php I used for these tests, contain the following:



$root='public_html';
define('FTP_USER','username');
define('FTP_PASS','password');

$addr=$_SERVER['SERVER_ADDR'];
$name=$_SERVER['SERVER_NAME'];
$host=$_SERVER['HTTP_HOST'];
$https=$_SERVER['HTTPS'];
$protocol=(!empty($https)&&$https!=='off'||$_SERVER['SERVER_PORT']===443)?'https://':'http://';
$abspath=(strpos(getcwd(),'/wp-admin')!==FALSE)?substr(getcwd(),0,strrpos(getcwd(),'/wp-admin')):getcwd();
$relpath=substr($abspath,strrpos($abspath,$root)+strlen($root));
define('WP_HOME',$protocol.$host.$relpath);
define('WP_SITEURL',$protocol.$name.$relpath);
define('FS_CHMOD_DIR',(02755&~umask())); //FOR CASE A
define('FS_CHMOD_FILE',(0664&~umask())); //FOR CASE A
define('FS_CHMOD_DIR',(02775&~umask())); //FOR CASE B
define('FS_CHMOD_FILE',(0664&~umask())); //FOR CASE B
define('FS_METHOD','ftpext');
define('FTP_BASE',$abspath);
define('FTP_HOST',$addr);




Aucun commentaire:

Enregistrer un commentaire