Reputation: 11780
I have installed WordPress on my VPS server. (Centos, Linux, apache). But after installing, WordPress is not able to create files.
If I set the permissions for WordPress directory and its subfolders as 777 everything is working fine. But I know setting 777 is very dangerous.
What permissions should I set? or how can I fix this?
I used this command to set permissions
chmod 777 wordpress_folder -R
Upvotes: 0
Views: 3109
Reputation: 695
I normaly login in via SSH and than run the following comands find public_html/ -type f -exec chmod 644 {} + find public_html/ -type d -exec chmod 755 {} + and all sorted.
Upvotes: 0
Reputation: 499
You don't specified your PHP Handler(I guess is mod_php or CGI) because this handlers do not run files as owner.
I had this problems few years ago with mod_php & CGI as handlers with: WordPress and SMF forum.
I recommend you to use suPHP or FastCGI as handler(you are on VPS and this handlers are known as 'Low Memory Usage') and avoid problems with folder permissions with some CMS.
suPHP & FastCGI - Run as file owner, so no folder permission problems with WordPress.
with suPHP or FastCGI when you must upload pictures in your WordPress website isn't required ftp login for upload(and this is a big + for you and your editors/users).
Upvotes: 0
Reputation: 652
It is very dangerous indeed to use 777. The last digit means that anybody is allowed to read, write and execute your files.
The proper way to do it is to do a chown -R apache:apache wordpress_folder
and then make sure that none of the files have 777.
This way the files will be owned by the user which runs the web server and so the webserver will be allowed to write stuff.
Upvotes: 0
Reputation: 21
In you wordpress directory, run the following commands:
find . -type d -exec chmod 775 {} \;
find . -type f -exec chmod 664 {} \;
Whereas the first command will modify all your directories to 775 and the second command will modify all your files to 664. This should do the trick.
Upvotes: 2