How do I know which linux user Wordpress uses for plugin installation

梦想与她 提交于 2019-11-29 00:59:08

问题


I'm trying to setup Wordpress to be able to install plugins via SFTP (SSH) on a Centos 6 VPS.

I've been able to modify wp-config so it uses the right credentials with user as my SFTP user.

Now I have a permission related problem, as if I do a chmod 777 on my wp-content folder I'm able to install, but with the normal permissions it can't create folders.

I'm using Nginx and all my wp-content files and folders are owned by user and I've tried setting the group to nginx but it doesn't work.

I also tried setting the user as nginx but still no luck.

UPDATE : I found out wordpress was using apache as user but I want to change this to my user instead. How can I do this ?


回答1:


On your production server, in your WordPress index.php file, at the top, you can temporarily put echo(exec("whoami"));die();

Then browse to your WordPress site and see what user was running. On Ubuntu, mine was www-data.

This was useful for me for: Can I install/update WordPress plugins without providing FTP access?




回答2:


The Wordpress user is also the web server user, so this should work:

ps -ef | grep http

or

ps -ef | grep apache




回答3:


Well it's not about /wp-content file permissions, so just leave the WordPress directory directory /wp-content permissions as 0755.

The fix that is required here has to be initiated within apache2.conf file; there we need to change "AllowOverride" directive for our /www/html/ directory from "AllowOverride None" to "AllowOverride All"

Follow the complete procedure here How to deal with GCP WordPress error "This page isn’t working example.com is currently unable to handle this request. HTTP ERROR 500

With this we tell a web server to allow a use of .htaccess file.




回答4:


So it clearly says that a group has no W access.

You can do: chmod -R g+w /your/plugins/dir

And then, nginx group will be able to write there.



来源:https://stackoverflow.com/questions/13186546/how-do-i-know-which-linux-user-wordpress-uses-for-plugin-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!