SOLVED Error wordpress - "file.png” has failed to upload. Missing a temporary folder.

Operating System & Version
Linux hospedagem.stetnet.com.br 3.10.0-1160.24.1.el7.x86_64 #1 SMP Thu Apr 8 19:51:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
cPanel & WHM Version
v98.0.8

renato.figueiredo

Registered
Oct 11, 2021
3
0
1
Brazil
cPanel Access Level
Root Administrator
Hi dears

I'm having problems uploading files on wordpress.

When collecting logs with the command:
tail -f /etc/apache2/logs/error_log

It seems to me that it's something with file permissions in the /tmp folder.
logs:
[Mon Oct 11 15:43:04.210050 2021] [access_compat:error] [pid 30622] [client 104.131.60.249:56142] AH01797: client denied by server configuration: /home/irpp/public_html/xmlrpc.php
Failed to start up concurrent users module!
[Mon Oct 11 15:43:04.314329 2021] [cgi:error] [pid 27400] [client 177.55.50.106:50766] AH01215: PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php74, referer: https://www.foo.bar.com.br/wp-admin/media-new.php (fake url for my security)
[Mon Oct 11 15:43:07.748386 2021] [cgi:error] [pid 30810] [client 192.99.10.170:48414] AH01215: PHP Warning: Unknown: open(/tmp/sess_uhrphunbgg7a3g46iucn9fl6c2, O_RDWR) failed: Read-only file system (30) in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php56
[Mon Oct 11 15:43:07.748641 2021] [cgi:error] [pid 30810] [client 192.99.10.170:48414] AH01215: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php56
[Mon Oct 11 15:43:11.560325 2021] [cgi:error] [pid 30810] [client 192.99.10.170:48414] AH01215: PHP Warning: Unknown: open(/tmp/sess_p85hibut76tblie2ohd7f6etp6, O_RDWR) failed: Read-only file system (30) in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php56
[Mon Oct 11 15:43:11.560574 2021] [cgi:error] [pid 30810] [client 192.99.10.170:48414] AH01215: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php56
Unable to create lock file: Read-only file system


I've tried several wordpress tutorials that ask you to specify the path with the command below in a php configuration file and create the /temp folder:
define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');

can someone give me a light at the end of the tunnel

Regards,
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,496
1,009
313
cPanel Access Level
Root Administrator
Hey there! From that output, it looks like /tmp has went read-only. Can you try running this on the machine?

Code:
chmod 1777 /tmp
to see if that resolves the issue? If not, you can try running the securetmp script as outlined here:


If that still does not resolve the issue, you may want to speak with your hosting provider or datacenter to have them check the system, but you may need to reboot the machine in order to ensure everything is mounted properly.
 
  • Like
Reactions: renato.figueiredo

renato.figueiredo

Registered
Oct 11, 2021
3
0
1
Brazil
cPanel Access Level
Root Administrator
If I run the script, I get the return with a possible problem because of an error: Read-only file system:
Cpanel::Exception::TempFileCreateError/(XID vjwusz) The system failed to create the temporary file “/var/tmp/31269._USR_LOCAL_CPANEL_SCRIPTS_SECURETMP__.tmp.21b31aaf” because of an error: Read-only file system
at /usr/local/cpanel/Cpanel/Rand.pm line 103.
Cpanel::Rand::get_tmp_file_by_name("/var/tmp/31269._USR_LOCAL_CPANEL_SCRIPTS_SECURETMP__", "tmp", 1, 0) called at /usr/local/cpanel/Cpanel/TempFile.pm line 243
Cpanel::TempFile::_dir_or_file(Cpanel::TempFile=HASH(0xb7fbc8), 1) called at /usr/local/cpanel/Cpanel/TempFile.pm line 86
Cpanel::TempFile::dir(Cpanel::TempFile=HASH(0xb7fbc8)) called at /usr/local/cpanel/scripts/securetmp line 492
main::test_loopback_device("/dev/loop1") called at /usr/local/cpanel/scripts/securetmp line 509
main::check_loop_device() called at /usr/local/cpanel/scripts/securetmp line 69

if i run chmod 1777 /tmp:
chmod: changing permissions of “/tmp”: Read-only file system

In this case, the hosting provider is us, but we are facing this difficulty.

Any other ideas what we can do?