Permission problems installing on a hosted server

Hello, I’m trying to install piwik on a hosted server and I stumble upon the following permission problem. The tmp directory is chmod 777, owned by the ftp user, but templates_c and its content is created and therefore owned by the apache user.

is there a way to install piwik without a shell access?

problem writing temporary file 'tmp/templates_c/wrt4a02af62a1e14'

#0 /var/www/vhosts/ Piwik_Smarty->trigger_error('problem writing...')
#1 /var/www/vhosts/ smarty_core_write_file(Array, Object(Piwik_Smarty))
#2 /var/www/vhosts/ smarty_core_write_compiled_resource(Array, Object(Piwik_Smarty))
#3 /var/www/vhosts/ Smarty->_compile_resource('Installation/te...', 'tmp/templates_c...')
#4 /var/www/vhosts/ Smarty->fetch('Installation/te...')
#5 /var/www/vhosts/ Piwik_View->render()
#6 /var/www/vhosts/ Piwik_Install_View->render()
#7 /var/www/vhosts/ Piwik_Installation_Controller->welcome()
#8 [internal function]: Piwik_Installation->startInstallation(Object(Piwik_Event_Notification))
#9 /var/www/vhosts/ call_user_func_array(Array, Array)
#10 /var/www/vhosts/ Event_Dispatcher->addObserver(Array, 'FrontController...')
#11 /var/www/vhosts/ Piwik_PluginsManager->addPluginObservers(Object(Piwik_Installation))
#12 /var/www/vhosts/ Piwik_PluginsManager->loadPlugins()
#13 /var/www/vhosts/ Piwik_PluginsManager->setPluginsToLoad(Array)
#14 /var/www/vhosts/ Piwik_FrontController->init()
#15 {main}

This is not a supported installation method. You need to fix the file ownership and/or permission problems.

The files and directories need to be owned by one user. Either chown the files to be owned by the apache user or use the User directive in your Apache configuration. The latter is typical for shared hosting environments. If you can’t accomplish this without shell access, please consult your sysadmin.

Hi all.
I am having the same problem installing, and get exactly the same results as Steff. I noticed that whenever I refresh the page, the file -“wp4757…” changes.
I’m afraid I did not understand the reply, being a bit un-intelligent about this stuff!
I have CHMOD the tmp directory and its sub folders to 777. Any further help please!!

If I understand your answer correctly, it’s not possible (or at least it’s very cumbersome) to install piwik on a shared hosting environment because the ftp user will always be a different user than the apache one. And changing the User directive in .htaccess is a feature that I have never seen in any shared hosting. This, if not a bug, is a serious limitation of piwik.

I don’t understand why the ownership makes any difference to the software once the tmp/ dir is world writable but I’m not a php expert so I can’t help improve the code. Are there any plans to fix this behaviour and what’s the ETA?


It’s not a Piwik limitation. It’s a limitation of your web hosting provider.

The User directive means Apache serves your pages as if it were you, with your file ownership, your file permissions. It is the “right thing to do” for virtual hosting.

chmod 777 is the wrong approach for a multitude of reasons.

Changing provider is not an option and adding an .htaccess containing:

User MyFTPUser

results in Apache throwing an ‘Internal Server Errror’. I never needed to use the User directive on a hosted server (I installed many services in the past, from the old phpnuke to wordpress) so maybe I’m using the wrong syntax. Is that the correct syntax for the .htaccess directive you mentioned?


You can’t use the User directive in a .htaccess file. (This is by design for security reasons, ie imagine “User root”. )

Ask your sysadmin to add it your virtual host configuration.