3

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: http://ca3.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.

Barmar
  • 741,623
  • 53
  • 500
  • 612
PHP Developer
  • 209
  • 1
  • 3
  • 9
  • The spacing in your commands is wrong, it should be `www-data:www-data`. And you shouldn't be changing the ownership of the system's root directory. – Barmar May 02 '17 at 20:43
  • If you truly did `sudo chown -R www-data:www-data / tmp` your Linux system could be severely damaged. – Michael Berkowski May 02 '17 at 20:44
  • Please post the output from `ls -l /` – Michael Berkowski May 02 '17 at 20:45
  • Barmar, sorry! Because o command receive spacing. I no edit my command, but the command is join, like you posted. Thanks! Michael Berkowski, whats directory you need to execute the command "ls -l"? The damaged is about security? Thanks to response! – PHP Developer May 02 '17 at 22:26
  • I'm sorry. I found the problem. I config the /etc/php5/cli/php.ini and forget of config the /etc/php5/apache2/php.ini I need confi the directory /tmp in "upload_tmp_dir" Michael Berlowski, whats permission is the best? Thanks guy to help! – PHP Developer May 02 '17 at 23:34
  • Be sure to use @ in the comments, so we receive notifications and can respond. The way you had listed your `chown` commands with spaces, it appeared that you had set www-data ownership across your entire filesystem at its root `/` but if you typed those commands correctly, there should be no issue. – Michael Berkowski May 03 '17 at 14:13
  • But you should not give www-data ownership of /tmp. If you modified the ownership of `/tmp` you should restore it to `root:root`. – Michael Berkowski May 03 '17 at 14:16
  • Understand. I can modify the www-data to other value? Because it could be severely damaged. Thanks very much to help and answer. – PHP Developer May 03 '17 at 14:36

1 Answers1

1

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

PHP Developer
  • 209
  • 1
  • 3
  • 9