Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • IMPORTANT!! I forgot a step in the above!

    You also have to create the “tmp” folder at the location where WordPress is trying to create it! Make sure the owner (you) has permissions to write to it (again, google for more info).

    I had this problem and it took a ton of trying dead ends to finally fix it. In all of my reading on this subject I’ve found that there is no one solution that works and it varies depending upon the hosting arrangement. The one solution often cited is to edit the php.ini in the /etc/ folder, except that this only works if you have access to that directory, for example, because you’re running your own server. However, if you are using shared hosting, php.ini might exist, but you might not be allowed to access and modify it. In this case you create your own user php.ini to add your own directives (assuming you’re allowed by your host to do this. If you’re not, you might need a new host!)

    To find where php.ini is, create a plain text file called phpinfo.php and putting this code into it:

    <?php
    phpinfo();
    ?>

    Upload it to your root directory and then access it by looking at https://mydomain.com/phpinfo.php You should see a long formatted table of all of your server’s php settings, including the location of php.ini. It might turn out that it’s someplace that you can access it, in which case you can proceed to edit the ‘upload_tmp_dir’ line (more below).

    You can also see the setting for ‘upload_tmp_dir’, which, if you’re getting this error, probably has no value. If it *does* have a value then you might want to hunt around for that folder on your own server space and check the permissions for it before trying anything else. (Google “wordpress permissions” for more info. Use the 777 setting temporarily if at all). If it works and you get an “unable to move files to…” error, then you have to fiddle with the permissions on the uploads folder as well.

    Here’s the fix if you don’t have access to the system-level php.ini (hopefully it’s a fix, again, these solutions seem to vary according to service provider and their set up):

    1) Find out where WordPress is trying to create the tmp file. (Courtesy of danoph in this thread):

    If you are using WordPress 2.7 [or later], go to wp-admin/includes/file.php, and after line 260 [seems to be line 257 in 2.9], add this line temporarily:

    echo getcwd();

    This will tell you the current working directory [when you try to upload a file it appears at the top of the upload window]. If there is more than just “/”, you will need to add this to your PHP temporary directory line as well instead of just the usual “/tmp”

    So, I changed my php.ini file from upload_tmp_dir =”/tmp/” to

    upload_tmp_dir ="/usr/home/usernamehere/tmp/"

    2. If you were unable to find a php.ini to edit, you must create one. Using a plain text editor like NotePad, create a file called php.ini.

    3. Put the following code into your new file or edit the line in your existing file: upload_tmp_dir ="/whatever-path-you-got-from-step-one/tmp/"
    If you have an existing php.ini file, the line may be commented out with a preceding semicolon (;), so be sure to remove the semicolon. Save the file.

    3. This is the step that may vary according to service provider and WordPress version. Your service provider may tell you where to put php.ini if you ask, or have PHP documentation in their help files which will say, or you might have to do trial and error. Upload the file into one of the following:

    • wp-admin folder
    • the root folder where you have your WordPress files stored, eg. ‘myblog’ or the ‘public_html’
    • cgi-bin folder (this is the one that worked for my situation)
    • or (heaven forbid) any WordPress folder containing PHP. This seems like overkill but I did see it suggested in one discussion of the issue
    • Hope that helps somebody!

Viewing 2 replies - 1 through 2 (of 2 total)