Media won't upload on Wordpress via EC2 instance - wordpress

I have install Wordpress have it all working on an EC2 instance and RDS.
One small problem I am having is uploading images through the media/image uploader on the wp-admin it keeps saying the following:
'“FC1.jpeg” has failed to upload due to an error
The uploaded file could not be moved to /var/www/html/wp-content/uploads/2012/06.'
I think it's most likely the permissions of the folder, because I used it yesterday and it worked, but after i sort of messed around with the chmod command on ssh.
I know the wp-content folder should be 775 and I have tried that but it doesn't work.
Any help?
Thanks

The permissions you used gave full privileges to the owner so they should work. Check to see who the owner and group are (ls -l on a *nix system).
You will need to know the webserver user and group. Check with your sysadmin (or in /etc/passwd). On *nix systems it is often ww-data or apache.
The owner and group should be set to the webserver. If they are not, run sudo chown webserverUser:webserverGroup.

Related

How to fix incompatibility between mac os permission of files & folders with our hosting server

Every time I upload my theme folder(WordPress) from my Mac OS to my hosting server(CPanel), I have lots of permission errors and I should fix the permissions again on our server.
Is there any way to fix permission on my Mac OS to be compatible with my server permissions (folders:775 & files:644 )?
A quick google search found this at macinstruct.
How to Modify Permissions with chmod
For total control over permissions, you can use two Unix commands - ls and chmod - to display permissions and modify them. Assume you want to find a folder’s current permissions and then change them to 755. This would give you as the owner read, write and execute permissions, and everyone else read and execute permissions.
Here’s how to find a folder’s current permissions and change them:
Open the Terminal application.
Once you direct yourself to where your files/folders are located...
Type ls –l, and then press Return. The symbolic permissions of the files and folders in your home directory are displayed, as shown below.
Type chmod 755 foldername, and then press Return. This changes the permissions of the folder to rwxr-xr-x.
When it comes to using the ls and chmod commands, practice makes perfect. Try modifying the permissions on a couple of sample files. If you need more help, use the man command to display the manual pages for these commands (e.g., man ls).

Wordpress can't write to file

I've moved my wordpress installation from a managed VPS to a new centos server.
Now I've a problem with writing to files directly from the wordpress admin panel.
Folders/files are set with 755/644. User owner is "wwwuser", group is "apache" (I use this one to access to the documentroot via ftp).
I think that the problem is that in /etc/httpd/conf/http.conf I've user and group setted both to "apache", in fact everything works if I change permissions to 775/664, which should mean that when the group owner is setted to apache everything work, right?
So my question is, should I change all permissions to 775 or there's another solution, which doesn't lead to security issues? Is it safe to make all folders and files 775 and 664? What if I change "apache" to "wwwuser" from /etc/httpd/conf/http.conf?
Edit: is it possible that the problem is that in phpinfo, environment pwd is set to /home/wwwuser/test and not to /home/wwwuser/?
I would advise to not change the user Apache is running under (to not edit the Apache config file) but to set apache as the owner of the files.
chown -R apache /path/to/your/app/files
I think it's the easiest solution. If you choose to change the permissions, you shouldn't have to change the permissions for everyone (other): you could change to 774 but I don't see why 775.
By default Apache is running under the apache user on CentOS.
This is a very common problem you are facing right now. Some times files/directories created/uploaded with FTP may have been assign a different users/usergroup. As #Céline Aussourd stated, if you have installed plugin from WordPress then all files and directories will get the default user/usergroup.
Now easiest way to identify which user should be assigned to your files is create a single test file using CPanel file manager called "test.php" and access it from web if it is working then check its user/usergroup and change all your setup files to that user/usergroup all together with
chown -R {user} /path/to/your/worpress/root
Replace {user} with apache web user.
UPDATE: (To install plugin without FTP details)
Please add following line to your wp-config.php after define('WP_DEBUG', false); line.
define('FS_METHOD', direct);
Remove plugin and re-install it, this time it wont ask you for FTP details and will write files directly.
For me, the solution was to add the mod_suexec apache module

openshift wordpress plugin needs to be granted write access, how do this?

I am trying to install CiviCRM in my openshift wordpress 'gear' And I am getting the following when I attempt to run civicrm's installation wizard:
The user account used by your web-server - 542ddc2950044666c40008d9 -
needs to be granted write access to the following directory in order
to configure the CiviCRM settings file:
//var/lib/openshift/542ddc2950044666c40008d9/app-root/data/plugins/files
Does anyone know if what it is asking is possible?
and then how do I go about setting that?
Thanks!
The plugins/files/civicrm directory is where CiviCRM stores its cached templates, file attachments, premium (thank-you gift) images, and more. It'll need to save stuff there regularly, not just at first.
The best thing to do is to log in through SSH like developercorey recommends and:
cd ~/app-root/plugins
chmod 755 files (changing the permissions so the owner can write and everyone can read/execute)
chown 542ddc2950044666c40008d9:542ddc2950044666c40008d9 files (making the user that the web server runs as ("542ddc2950044666c40008d9" as mentioned in the error message) be the owner of the directory
have the installer check again
SSH into your gear using the rhc ssh command
cd ~/app-root/plugins
ls -lah
Look for the "files" directory and see what the user and the permissions are on that folder, you can change with the "chmod" command to allow it to be written to by the web server, but be careful what you do or you could cause a major headache for yourself (like getting your WP blog hacked). Hopefully the instructions for that plugin include setting the permissions to something reasonable when you are done.

Unable to upload themes to my WordPress installation

I am unable to upload themes to my WordPress installation via WordPress admin. I am getting the following error:
The uploaded file could not be moved to /home/debiprasad/webapps/wordpress/wp-content/uploads/2011/09
The permission of wp-contents directory and all sub directories are: 0755. Some people may suggest to make it 0777. This may work, but I don't think this is the correct solution. Because, all the folders should be have permission 0755 and this is secure. 0755 is the default and it works in other installations.
I want to know what's the reason of this error and what is the perfect and secure solution?
Assuming you use Apache, is your uploads folder owned by www-data? (or whatever user apache/php run as?)
If you have access to change ownership, 0755 should work as long as the upload folder (and subdirectories within) are owned by the same "user" that the web server runs as - so in most cases, that'll be www-data.
If this doesn't work, what method do you use to install themes? ftp, ftps or ssh2?

Wordpress permission problems in Webbynode

I am trying to install (copy) Wordpress files in my Webbynode. I can copy the files. But when I try to upgrade automatically I get a lot of permission errors. I only can solve them using chmod 777 in folders and files, what is not secure.
I'd like to know if someone can explain in simple words who needs to be the owners of the files and folders and/or what is the best way to install wordpress in Webbynode in order to not get these errors.
Thank you.
If you have control over your server, which I understand you have with that provider, you can set the owners of the folders to the same user as the one with which Apache is running, so the permissions could be 755 and the rest of the world won't be able to write into them.
To find out which user Apache is running as you can use:
ps aux | grep apache
Sometimes the process is named "apache2", or also "httpd", instead of "apache".

Resources