How to set your temp directory for Windows OS, PHP version 7/8

Alrighty to anyone using LocalWP, windows OS and PHP version 7/8,

There is an issue where your temp folder is set to C:/Windows/Temp by default.
This folder requires permissions that you usually wouldn’t grant.

The temp folder is essential for us to upload images and use Elementor.

So a simple fix is the following:

  1. Open your site folder
  2. Navigate to your PHP folder → conf → php
  3. Double-click php.ini.hbs
  4. Replace line 5 with this sys_temp_dir=“YOURDRIVE:\YOUR\PATH\TO\SITE\app\public\temp”
  • My path looks like this sys_temp_dir=“B:\WordPress Sites\Stickurs\app\public\temp”
  1. Save the file
  2. Go back to the main directory for your site
  3. Navigate to your public folder → app → public
  4. Create a new folder called “temp”
  5. You’re Done! :slight_smile:

Make sure to restart the site to update your site’s temp directory.

2 Likes

Apologies if this wasn’t the place for this post.

A bit of additional information for anyone who finds this:

The temp directory can be ANYWHERE that your standard user has access to, it doesn’t need to be in your site directory.

Personally, I set sys_temp_dir to DRIVE:\PATH\TO\SITE\app\tmp so it’s storing temporary files in the same place that the WordPress installation is in while still putting it in a sane location.

1 Like

Hi Chizaruu,

I am having the exact same problem of not being able to upload custom icons in Elementor. I followed your steps up to #5 but ran into trouble after that. I do not have a tech background and I am not a developer. I thought step #8 was as simple as adding a new empty folder in my Windows file and labeling it “temp”. But I received the “Missing Temporary Folder” error when I tried to upload custom icon through Elementor again. Can you list the steps in detail as to how to fix this?

Hi @Hedwig

Did you make sure to save that file afterward? You might also need to Stop/Start your Local site to allow it to recompile the changes before moving on to the other steps.

@Chizaruu tagging you if you care to chime in.

Ok, I think I may have identified the problem. Now PLEASE NOTE: I am NOT a developer. I can NOT code or know anything about code. @Chizaruu said to navigate to the php folder and to replace line 5 with this
"sys_temp_dir=“YOURDRIVE:\YOUR\PATH\TO\SITE\app\public\temp”

The problem is that I do not know what to put in for YOURDRIVE:\YOUR\PATH\TO\SITE

Yes, I literally just copied and pasted the way he stated it into my line 5 exactly the way he typed it. Go ahead, you can laugh. I’ll wait.

My orginal line 5 was this
sys_temp_dir=“C:\Windows\TEMP”

I see my drive is C, but I’m confused on the rest. Should I replace line 5 with this
sys_temp_dir=“C:\Windows\TEMP\app\public\temp”

Again, I’m confused about what actually goes in this whole part of the line
YOURDRIVE:\YOUR\PATH\TO\SITE

  1. Can someone please take pity on the amateur here and tell me how I figure this out correctly? LOL! What to actually put in YOURDRIVE:\YOUR\PATH\TO\SITE or at least how to find what to put in there?

  2. And how to create the new temp folder correctly? Again, I just navigated to public folder → app → public and created a new empty folder in Windows

1 Like

It sounds like you’re close, @Hedwig! You should first create the temp folder, then use it as the path. Here’s how:

And how to create the new temp folder correctly? Again, I just navigated to public folder → app → public and created a new empty folder in Windows

That sounds right! You should:

  1. Click “Go to site folder” next to your site name in Local.
  2. Navigate to app → public.
  3. Create a new folder in “public” called “temp”, which is what it sounds like you’ve done.

Can someone please take pity on the amateur here and tell me how I figure this out correctly? LOL! What to actually put in YOURDRIVE:\YOUR\PATH\TO\SITE or at least how to find what to put in there?

You can figure out what that path should be like this:

  1. Click “Go to site folder” next to your site name in Local.
  2. Navigate to app → public → temp.
  3. Right-click the ‘temp’ name in the address bar in the File Explorer and choose “copy address”. You can then paste that into the php.ini file as Chizaruu described above. You will also need to restart your site as Nick mentioned.

1 Like

Ahhh, THANK YOU Nickc! I’m going to try that right now! I have another site I can test it on and several backups of my site just to be safe. Nick-B, THANK YOU for all of your help! I really appreciate it!

Here I go… :smile:

2 Likes

Keep us posted @Hedwig! Thank you for hanging in there :green_heart:

1 Like