Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted March 3Mar 3 I am switching servers. I've migrated files and databases to the new server, but am getting the Permission denied error. See below An error occurred (500 Error)We're sorry, but a temporary technical error has occurred which means we cannot display this site right now.Permission deniedYou can try again by clicking the button below, or try again later.Try againI've check permissions and they are 755 to all directories. I've got the correct ownership of the files. I got the correct mysql config information in my config file. What else could be the problem? Edited March 3Mar 3 by NAWAC
March 3Mar 3 Community Expert You will want to ensure that the follow directories are writable:applicationsdatastoreplugins (if you're on version 4)uploads and all subfolders of uploadsYou will also want to ensure that your conf_gloabl.php is correct for your new MySQL server and that your MySQL user has full rights to everything.
March 3Mar 3 Community Expert Can you also check your server error log and see if there are any recent messages logged in there?
March 3Mar 3 Author I think it's probably a MySQL connection issue. May be access rights to the database or something.AH01071: Got error 'PHP message: PHP Fatal error: Uncaught IPS\\Db\\Exception: Permission denied in /var/www/vhosts/mywebsite.com/system/Db/Db.php:269\nStack trace:\n#0 /var/www/vhosts/mywebsite.com/system/Db/Db.php(356): IPS\\_Db->_establishConnection()\n#1 /var/www/vhosts/myswebsite.com/system/Db/Db.php(487): IPS\\_Db->checkConnection()\n#2 /var/www/vhosts/mywebsite.com/system/Db/Db.php(972): IPS\\_Db->preparedQuery()\n#3 /var/www/vhosts/mywebsite.com/system/Session/Admin.php(112): IPS\\_Db->replace()\n#4 [internal function]: IPS\\Session\\_Admin->write()\n#5 [internal function]: session_write_close()\n#6 {main}\n thrown in /var/www/vhosts/mywebsite.com/system/Db/Db.php on line 269' I created a simple test file to connect to mysql using the conf_global.php fileinclude('conf_global.php'); $con = mysqli_connect($INFO['sql_host'], $INFO['sql_user'], $INFO['sql_pass'], $INFO['sql_database']); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else { echo "connected"; } exit;and I am getting a similar Permission denied error in my test.php file.AH01071: Got error 'PHP message: PHP Fatal error: Uncaught mysqli_sql_exception: Permission denied in /var/www/vhosts/mywebsite.com/test.php:25\nStack trace:\n#0 /var/www/vhosts/mywebsite.com/test.php(25): mysqli_connect()\n#1 {main}\n thrown in /var/www/vhosts/mywebsite.com/test.php on line 25'I know my conf_global.php file contains the correct information because I can use the same information to log into MySQL at the command prompt without a problem. Some how I can't do it in a PHP script though. Edited March 3Mar 3 by NAWAC
March 3Mar 3 Author So, after some debugging, come to find out the $INFO['sql_host'] needed to be 127.0.0.1 instead of localhost. Which is weird. First time I've seen that on a Linux system. I've seen it on a local Windows PC, but not a Linux system.Is there any reason I can't use 127.0.0.1 for the production server, if that's what it's requiring in order to run the script(s)? Edited March 3Mar 3 by NAWAC
March 4Mar 4 Author So, after some debugging, come to find out the $INFO['sql_host'] needed to be 127.0.0.1 instead of localhost. Which is weird. First time I've seen that on a Linux system. I've seen it on a local Windows PC, but not a Linux system.Is there any reason I can't use 127.0.0.1 for the production server, if that's what it's requiring in order to run the script(s)?After playing around with it, I was finally able to set sql_host to localhost:3306, note I had to include the port for localhost of :3306 to make localhost to work on this server, which is a Plesk server running Almalinux 9, just in case anybody has the same problem. So, in the conf_global.php file looks like 'sql_host' => 'localhost:3306'
March 4Mar 4 Community Expert You can specify the port with a different variable: 'sql_host' => 'localhost', 'sql_port' => 3306,
March 4Mar 4 Author You can specify the port with a different variable: 'sql_host' => 'localhost', 'sql_port' => 3306,Thanks! I did not know that.
Friday at 05:02 PM3 days I encountered the same error when migrating a server.1. Enabled remote access to the database.2. Added IP address 127.0.0.1 to the list of allowed ones.