Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload with php in Linux, the tmp_name is empty

I am trying to upload a video using PHP 6.0, Ubuntu 14.04.5 LTS 32 bit, but I can not upload. Tmp_name is empty. All possible problems have been resolved.

In php.ini, I configured correctly:

Php_value upload_max_filesize
Php_value post_max_size

In function tmp_error The result was error 6.

Value: 6; Missing a temporary folder. Introduced in PHP 5.0.3.

Referred site: https://www.php.net/manual/en/features.file-upload.errors.php

Permissions granted on Linux:

Sudo chown -R www-data: www-data / tmp
Sudo chown -R www-data: www-data uploads

Sudo chmod 777 / tmp
Sudo chmod 777 uploads

Please someone could help me.

like image 331
PHP Developer Avatar asked Mar 03 '26 15:03

PHP Developer


1 Answers

Solution to the problem:

Access the file /etc/php5/cli/php.ini

In php.ini find the lines that contains:

Memory_limit

Upload_max_filesize

Post_max_size

Change the default values, for example:

Memory_limit = 100M

Upload_max_filesize = 100M

Post_max_size = 100M

Find the line containing:

Upload_tmp_dir

Change the value to:

Upload_tmp_dir = /tmp

4th Change permissions

Sudo chown -R www-data:www-data /tmp Sudo chown -R www-data:www-data uploads

Sudo chmod 644 /tmp Sudo chmod 644 uploads

Repeat steps through in the file:

/etc/php5/apache2/php.ini

6th Restart Apache

If you are using Ubuntu or Debian Sudo /etc/init.d/apache2 restart

If you are using RedHat, Fedora or CentOS Service httpd restart

Thanks very much

like image 70
PHP Developer Avatar answered Mar 05 '26 03:03

PHP Developer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!