failed to open stream: Permission denied for WordPress plugin
I’m installing my website on a new hosting company. All WordPress directories are chmod to 775 and the owner (plus group) is my account username, the same owner as when I create new files manually.
Files created by a a non WordPress related PHP script gets another owner ID, I’m guessing that’s the webbserver? If I manually create a file and want the same script to write in that I also get this permission denied. Should the WordPress installation have the webbserver owner? Can I change this?
On a side note, WordPress also asks for FTP credentials every time a new theme installs or a plugin updates. If I specify
define( 'FS_METHOD', 'direct' ); I get “Installation failed: Could not create directory.” instead.
This is the full message:
Warning: file_put_contents(/home/vhosts/www.website.com/wordpress/wp-content/plugins/myplugin/logfile.log): failed to open stream: Permission denied in /home/vhosts/www.website.com/wordpress/wp-content/plugins/myplugin/myplugin.php on line 24