[Solution] Temporary directory /tmp is not present or writable

Fresh install on:

4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64 GNU/Linux
CPU: Intel Xeon E312xx (Sandy Bridge) Intel Xeon E312xx (Sandy Bridge) (1 1 cores)

Memory: 2 GB

Version: 7.3.13
Memory Limit: 512 MB

Type: mysql
Version: 10.1.41 

When attempted to load Nextcloud in browser (Firefox, Linux, current) this error is returned:

Internal Server Error

The server was unable to complete your request.
If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.
Technical details
[Lists remote address & Request ID]

The tmp directories in first the NC base directory and then in the …/data directory:

drwxr-xr-x  3 www-data www-data  4096 Dec 19 08:47 themes
drwxrwxr-x  2 www-data www-data  4096 Jan 14 15:23 tmp
drwxr-xr-x  2 www-data www-data  4096 Dec 19 08:48 updater


-rw-r-----  1 www-data www-data 57259 Jan 15 11:13 nextcloud.log
-rw-r--r--  1 www-data www-data     0 Jan 14 08:30 .ocdata
drwxrwxr-x  2 www-data www-data  4096 Jan 14 16:40 tmp

After attempting to access NC in browser log:tail returns these errors:

Error PHP is_writable(): open_basedir restriction in effect. File(/tmp) is not within the allowed paths): 2020-01-15T10:04:09+00:00
(/usr/share:/usr/share/php5:/dev/urandom:/var/www/clients/client1/web62/web/nc) at /var/www/clients/client1/web62/web/nc/lib/private/ TempManager.php#260                                                                                                   
Warning   no app in context   Temporary directory /tmp is not present or writable 2020-01-15T10:04:09+00:00  

Both tmp directory are writable and in the configured paths (if I’m reading this correctly).

What am I missing?

It says you:

And confirms:

You need to review your PHP ini config, to add the folder /tmp in the directive open_basedir.

2/ your folder tmp into the data directory is different than /tmp :wink:

3/ restart your web server, or php instance


1 Like

Hi Paka,

as 42IO said, the error message is referring to your open_basedir parameter from your php.ini.

This is the explanation for open_basedir

; open_basedir, if set, limits all file operations to the defined directory

So you can either just put a semicolon in front of the parameter, or you need to add the correct folder paths, for it to work correctly.

Please make sure to either reload or restart your Apache, after you made changes to your php.ini

1 Like

Yes, restart your web service (perhaps, it’s Apache, or nginx, or whatever…) :stuck_out_tongue:
( I forgot this point)

Thanks both to CFelix and 42IO!

Turns out it was an ownership issue. The thought woke me in the middle of the night.

The install directions had ownership set for all files and directorys as:

chown -R www-data:www-data

I should have mentioned the service being used utilizes ISPConfig for management although I personally work a great deal from the command line.

ISPConfig allocates an owner ID to each domain. web01 … web78, etc.

So i reset ownership to the corresponding ID used for the domain (let’s say ‘web112’):

chown -R web112:www-data nextcloud

Nextcloud loaded right up in the browser.

Again thanks to both of you for your time and feedback. :smile:

1 Like