Fix: WordPress Temporary Directory on cPanel Server Print

  • 0

To fix the WordPress Temporary Directory with wp-config, you can follow these steps:

  • Open the wp-config.php file located in the root directory of your WordPress installation.

  • Find the line that defines the WP_TEMP_DIR constant. It may look like this
define('WP_TEMP_DIR', '/path/to/temp/directory');
  • Replace the path with the absolute path to a directory on your server that is writable by the web server. You can use the ABSPATH constant to specify the path to your WordPress installation directory. For example:
define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp/');
  • This will create a temporary directory inside the wp-content directory of your WordPress installation.
  • Save the changes to the wp-config.php file.

  • Check that the directory you specified has the correct permissions set so that the web server can write to it. You can use the chmod command to set the correct permissions, for example:
chmod -R 755 /path/to/temp/directory

This will set the directory to be readable, writable, and executable by the owner, and readable and executable by everyone else.

Once you have completed these steps, WordPress will use the temporary directory you specified in wp-config.php for temporary files.

---

If the issue is not yet solved with the previously given instructions, try executing the following command to restart the PHP-FPM services:

/scripts/restartsrv_cpanel_php_fpm
/scripts/restartsrv_apache_php_fpm

Run the following commands to create a scheduled cronjob which will execute every 6 hours:

echo '0 */6 * * * root /scripts/restartsrv_cpanel_php_fpm > /dev/null 2>&1
0 */6 * * * root /scripts/restartsrv_apache_php_fpm > /dev/null 2>&1

@reboot root /scripts/restartsrv_cpanel_php_fpm > /dev/null 2>&1
@reboot root /scripts/restartsrv_apache_php_fpm > /dev/null 2>&1' > /etc/cron.d/ReinitPHPFPM

Feel free to contact us, if you need further help!


Was this answer helpful?

« Back

Send Message