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