You are Here: FAQ ->Dedicated Servers->Root Server->HowTo...->Article #3


WebHosting 5.0 This article is for 1&1 Linux WebHosting only.


How can I upload files to my server using PHP?


The standard configuration of your server does not permit uploads using PHP. This is for the following reason:

PHP Uploads are saved to the upload-tmp-dir which is defined by the PHP variable.

If the PHP-interpreter runs as root the file will have the same owner as the tmp-directory. The SAFEMODE of PHP allows only access to files which have the same owner as the owner of the running script.

On the Root-Servers PHP is executed as a Apache module thus running as user wwwrun. For this reason the uploaded files are owned by wwwrun as well and cannot be read in safemode. This problem cannot be solved very easily.

If you absolutely require the upload function of PHP you can either switch off the SAFEMODE in /etc/php.ini (unsafe!) or run PHP as a CGI. In that case the execution of CGI's is considerably slower.


Print Article
How useful was this article?
(From 5 = Very Useful to 1 = Not Very Useful at all):
1 2 3 4 5