Local Community

Unable to upload media files on Windows when using Apache

If I build a site using Apache instead of Nginx, I can’t upload a file to the media library. The error is indicated in the title : A temporary folder is missing

Issue Summary

Can’t load images or plugins. See png
Folder-Missing-error-2022-06-09_12-49-03

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?
    Only sites that have Apache as the web server

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    Yes.

Replication

Describe the steps that others can take to replicate this issue. If you have screenshots that can help clarify what is happening, please include them!

  • Created new wordpress 6.0 site (atest3) using Apache/PHP8/Maria on Win 10 machine
  • Launched atest3 site as admin
  • went to media > Upload image or plugins> Upload plugin
  • Get error Missing a temporary folder. See attached png.
    Folder-Missing-error-2022-06-09_12-49-03

Local doesn’t set temp folder on PC in either php.ini.hbs or wp-config PC.

  • Just in case I created 3 folders. …\Local Sites\atest\app\public\wp-content > tmp, temp, temporary > Failed
  • Tried to add line in wp-config > Failed

This error does not appear when using Nginx.

System Details

  • Which version of Local is being used?
    Tried on all versions. Local Current = 6.4

  • What Operating System (OS) and OS version is being used?

    • Windows 10 Professional
  • Attach the Local Log. See this Help Doc for instructions on how to do so:

Security Reminder

Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hello,

You have to open php config file, which is place in ‘your-path’/conf/php/php.ini

Next just copy and paste this lines of code underneath all

sys_temp_dir = ‘your-path’\Local Sites_apache_tmp\

upload_tmp_dir = ‘your-path’\Local Sites_apache_tmp\

1 Like

Thanks Simon,

I’ll give this a try.
Since my Jun 9 post I’ve moved offline dev to DevKinsta.

James

timg

Hello there, Kazi! :wave:

I’m happy to help you work through this issue - can you share the following so I can try to replicate it on my end?

  • Your Local configuration details for this site
  • The size of the image you’re attempting to upload
  • The Local logs

Here is a help doc walking through how to obtain the Local logs:

Thank you!

:woman_technologist:t3: Sam

Hi there, Mam!
I have provided the Information which you want. The order of the information is:

  1. Image file which is (35.7 kb).
  2. The local log.
  3. Local configuration details screenshot.

Tanvir
local-lightning.log (87.1 KB)

When importing media I get “missing temp file”. After following a tutorial and editing wp_config.php, that should fix the problem it does not fix the problem.

Same here, seems to be an issue with apache for me. Using Nginx servers seems to work. But that isn’t a solution for me.

Hello @ComradeNova and @Tris! I found a similar topic posted previously. Have you given this a try? Missing a temporary folder 2 - #2

Hello and i have tried doing the second option and it does not work.

Hi all,

I’ve merged several threads that were describing this issue - shoutout to @Nick-B for helping us tie these together!

I was able to do some troubleshooting and found that this is Windows specific, and like mentioned, only happens when using Apache. I have created a bug for our engineering team to take a look at, and I will keep this thread updated when we have the fix. Thanks for bearing with us!

2 Likes

@austinwendt This is my suggest to solve this bug.

i think localwp install incorrect PHP’s tmp directory. it is used to upload a file to this folder to process next work.

so please make sure it must have php’s tmp directory

Bug Summary

When creating an apache website in both php 7.4.1 and php 8.0 it doesn’t have an TEMP environment setting thus I can’t upload anything to it via the wordpress uploader. Like plugins, images, etc.

Steps to reproduce

Create new server with either PHP 7.4.1 or PHP 8.0, Apache 2.4.43 and MySQL 8.0.16 (don’t think database matters here). login, try to upload a file.

Environment Info

Describe your environment.

  • What Operating System are you using?
    Windows 10 pro
  • What versions of site software (Nginx, Apache, PHP, MySQL) is used?
    Apache 2.4.43, PHP 7.4.1 and PHP 8.0, MySQL 8.0.16
  • What version of Local is installed?
    Version 6.4.1+5978 (latest at time of writing)

Supporting info

Please provide your Local Log. See this Community Forum post for instructions on how to do so:

local-lightning.log (155.7 KB)

So i’ve run into the rabbit hole even though I’m definitely not webmaster or php dev. The issue seems to stem that the apache webserver does not include the environment variable for local storage. Manually setting it to C:\Users[username]\AppData\Local\Temp seems to work. But I have to set it for each server. Much rather change the default apache service to make sure it also passes the correct temp folder.

I also haven’t found a way to make the [username] part dynamic so everyone who wants to work locally has to fix it themselves

Apache defaults to C:/Windows which, as far as I can find is the default variable for windir and systemroot, not temp

1 Like

i am also facing this bug in window 10 with webserver is apache, i cant install any plugins that installing the plugin file from my pc
please fix it soon

Hi @hiepvq and @Tris! This is a known bug that our engineering team is aware of and will be working to resolve. We have previously merged several threads into this bug and will provide some updates there when this is resolved! Unable to upload media files on Windows when using Apache - #10 by Nick-B

1 Like

Hello @Tilt & all!

Happy to report that this bug has been addressed in the latest Beta version of Local. :tada:

You are welcome to download and test Local Beta 6.5.1 - more details can be found below:

Please watch for the latest version of Local dropping very soon with this fix!

Thank you,

Sam :woman_technologist:t3:

2 Likes