This forum is no longer active. Please post your questions to our new community site

Wordpress - Unable to create directory AWS EC2

Subscribe to Wordpress - Unable to create directory AWS EC2 18 post(s), 7 voice(s)

 
Avatar palmercomputer 6 post(s)

Wordpress installed properly by following the NEW AMI Tutorial in Amazon EC2

When trying to IMPORT an existing Wordpress XML file get following error:

Before you can upload your import file, you will need to fix the following error:

Unable to create directory /opt/bitnami/apps/wordpress/htdocs/wp-content/uploads/2009/10. Is its parent directory writable by the server?

How do I fix this?

And, if I need to use SSH to modify some Linux Parameter, I have had zero success in figuring out how to use a Windows PC and Putty to reference the Private Key .pem file to securely connect to the Bitnami Linux Instance.

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Hi,

It is a permissions issue that we need to fix. We will fix this issue in the next version of the Wordpress Stack. This is a good quick guide that I found to connect to Amazon from a Windows machine: http://docs.amazonwebservices.com/AmazonEC2/gsg…

I hope it helps.

 
Avatar lavachair 3 post(s)

I have the same issue – what is the permissions fix? We ran AMI ami-7846ad11 which should be new enough for the fix to already have been there. This is our error:

The uploaded file could not be moved to /opt/bitnami/apps/wordpress/htdocs/wp-content/uploads/2010/08

Our wordpress is already running off the root with permalinks etc. but we can’t upload themes etc. (although we were able to upload a plugin)

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Fixed at http://bitnami.com/forums/forums/wordpress/topi…

 
Avatar g88 2 post(s)

Hello having the same problems as above. Keep getting “The uploaded file could not be moved to /opt/bitnami/apps/wordpress/htdocs/wp-content/uploads/” – permissions have been checked and the php.ini has been edited any suggestions?

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Could you specify the Wordpress version? If you have modified php.ini file, did you try to restart the apache server?

 
Avatar g88 2 post(s)

Im running wordpress 3.1 and the server was restarted..

 
Avatar Beltrán Rueda Administrator 3,714 post(s)

Sorry that is strange, we can not reproduce it. Could you check that the “uploads” folder exists? Maybe the file that you want to upload is big? You can specify the upload file size in the php.ini file. You can find more info at http://wiki.bitnami.com/Applications/BitNami_Wo…

 
Avatar smorris 7 post(s)

I’m running bitnami-lampstack-5.3.6-0-linux-x64-ubuntu-10.04-ebs (ami-276a3862). I did a manual install of wordpress in the base folder (/opt/bitnami/apache2/htdocs). The site works, however something is wrong with the file permissions.

-WordPress can’t save files such as updating the .htaccess when modifying permalinks
-WordPress can’t upload or delete new plugins
-WordPress can’t upload media

I edited the php.ini’s upload_tmp_dir and set it to /tmp, but that didn’t do anything (suggested fix from another thread).
opt, opt/bitnami, wp-content folders all have permissions of 755 when viewing in WinSCP.

htdocs permissions are:
drwxr-xr-x 5 bitnami daemon 4096 2011-08-06 08:24 htdocs

 
Avatar smorris 7 post(s)

Sorry for the double post, I also should have mentioned if I upload an image I get the same error as the original poster.

“xxxxxx.png” has failed to upload due to an error
Unable to create directory /opt/bitnami/apache2/htdocs/wp-content/uploads/2011/08. Is its parent directory writable by the server?

 
Avatar Josué Álvarez Administrator 15 post(s)

Hello smorris,

Could you run the following on your server as root?

chown -R bitnami:daemon /opt/bitnami/apache2/htdocs
find /opt/bitnami/apache2/htdocs -type f | xargs chmod 664
find /opt/bitnami/apache2/htdocs -type d | xargs chmod 775
chmod 664 /opt/bitnami/apache2/htdocs/.htaccess
chmod 664 /opt/bitnami/apache2/htdocs/wp-config.php

This should set the appropiate permissions for your Wordpress installation, let us know if it works.

Regards,
Josué

 
Avatar smorris 7 post(s)

Thanks Josue, I ran the command and it seems to have fixed most of my issues.

-I can upload/delete media with wordpress
-I can update permalinks and wordpress is able to write to .htaccess

-I still can’t update plugins, or add new plugins.
-I still can’t delete plugins

I noticed a warning when configuring WP Super Cache:
Warning! /opt/bitnami/apache2/htdocs/wp-content is writeable!

You should change the permissions on /opt/bitnami/apache2/htdocs/wp-content and make it more restrictive. Use your ftp client, or the following command to fix things: chmod 755 /opt/bitnami/apache2/htdocs/wp-content/

Are these last few issues just a matter of changing some more permissions?
Thanks for your help
-Sam

 
Avatar smorris 7 post(s)

Sorry I spoke too soon…Although WordPress was able to create an .htaccess file and put in content, I’m not able to view other pages with permalinks turned on. When I try to go to another page I get generic 404 error.

“Not Found

The requested URL /css/removing-outlines-on-click/ was not found on this server."

The exact content of the .htaccess is the following:

  1. BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
  2. END WordPress
 
Avatar victoria Administrator 134 post(s)

Regarding the permalink, have you check this link

Also, are you already able to upload plugins? Can go to the /opt/bitnami/apache2/htdocs/ directory and execute ‘ls -la’ ? Which are the permissions for the wp-content folder? Please do the same for the uploads, cache, plugins themes and uploads folder. All of them should have drwxrwxr-x.

Notice that we are setting 775 permissions because previously we changed the owner to bitnami user and daemon group. We change it to the bitnami user so you can access and copy files using scp/ftp tools and we changed it to the daemon group so apache can still have access to the files. That is way you are receiving the warnings about permissions. More details in this link

I’m sorry you’re finding these issues. Have you consider to BitNami Wordpress AMI?

 
Avatar smorris 7 post(s)

Thanks Victoria, I believe I fixed the last few issues I was having. Below are a few links I found useful in case anyone else is having similar problems.

I was able to fix permalinks after I found a thread on the WordPress.org forums. There was an extra “AllowOverride None” in my httpd.conf which was causing my .htacesss to be ignored even after wordpress was able to write the file. (There’s some good troubleshooting steps here: http://wordpress.org/support/topic/pretty-perma…

After doing a bit more research I was also able fix the upload issue. The issue is apparently wordpress is unable to write to the filesystem unless the files are owned by the same user Apache is running under. In my case that meant: chown -R daemon: htdocs (just the main folder, the subs like wp-content still have the owner as bitnami). This seems to have fixed all delete/create/write issues I was experiencing. I’m now able to upgrade plugins, delete plugins, add new plugins, without having WordPress ask for FTP details. (I found this post had some useful information: http://www.chrisabernethy.com/why-wordpress-ask…

My last question is if have daemon as the owner for htdocs does it present any major security risks, or is there a specific reason why it wasn’t like that in the first place? Is having the htdocs folder owned by the Apache user bad practice? I’m just curious, as I don’t much experience with linux security and permissions.

Thanks for your help Victoria, you pointed me in the right direction.

 
Avatar victoria Administrator 134 post(s)

Hi,

Having daemon own the htdocs folder is ok. The user under which apache is running (it can vary in different distributions: daemon, nobody, www-data …) should have access to the htdocs files so he can read it. I think that in a previous post we asked you to change the permissions so htdocs are owned by bitnami but setting the group-owner daemon. This should also work although the folder permissions in that case should have set to 775 instead of 755. That configuration would allow you to use external tools for copying files to your server as bitnami user while apache could still have access to the files. Or there was an error on the permissions, or some of the WordPress plugin that you were installing was checking the permissions and required to have the permissions set as 755. In any case, as you can manage your WordPress plugins from the WordPress admin having only access for the daemon user is enough.

I’m glad you finally got the issue solved!