XF 1.5 An exception occurred: Permission denied in ../Zend/Db/Adapter/Mysqli.php


I'm trying to install XF 1.5 on a test server to prepare for an upgrade. I did this via a restore of the live database and filesystem.

When I browse to the site/curl the site, I get the following error:

An exception occurred: Permission denied in /server/rootdir/library/Zend/Db/Adapter/Mysqli.php on line 333
  1. Zend_Db_Adapter_Mysqli->_connect() in Zend/Db/Adapter/Abstract.php at line 315
  2. Zend_Db_Adapter_Abstract->getConnection() in XenForo/Application.php at line 730
  3. XenForo_Application->loadDb()
  4. call_user_func_array() in XenForo/Application.php at line 973
  5. XenForo_Application->lazyLoad() in XenForo/Application.php at line 1004
  6. XenForo_Application::get() in XenForo/Application.php at line 1632
  7. XenForo_Application::getDb() in XenForo/Model.php at line 161
  8. XenForo_Model->_getDb() in XenForo/Model/DataRegistry.php at line 138
  9. XenForo_Model_DataRegistry->_getMultiFromDb() in XenForo/Model/DataRegistry.php at line 97
  10. XenForo_Model_DataRegistry->getMulti() in XenForo/Dependencies/Abstract.php at line 147
  11. XenForo_Dependencies_Abstract->preLoadData() in XenForo/FrontController.php at line 127
  12. XenForo_FrontController->run() in /server/rootdir/index.php at line 13
I've made sure all the software versions match the prod server, and the xenforo_requirements.php file says everything is OK.

I've double and triple checked the linux and database permissions. data and internal_data are both 0777, and I can access mysql from the command line using the same details in config.php. I've even changed them as a test, updated the config.php values and entered new details in, and used the root credentials as a test, but nothing. The mysql datadir also has the right permissions and user. This is an Amazon Linux 2 server and selinux is disabled.

I manage the server myself so I have root access.

The weird thing is I also completely removed and reimported the database, and this error still appears when the database did not even exist, which suggests to me it's something to do with the filesystem.

I'm stumped at this point. What could I be overlooking or what other troubleshooting steps could I run?


XenForo moderator
Staff member
Typically, when it's a permission denied issue, the factors which resolve this are all server related, such as chmod, chown, selinux, and security mechanisms like mod_sec, etc.

It's worth double checking all of those.