PHP Connection to Database Failing

Overview
So all of my mysqli connections to the database are failing. They won’t go through.

Details
Everything works fine on my Windows computer where the webserver is run through wamp. On my Linux VPS, however, most of my mysql statements don’t go through. While I’m able to pull some information out, a lot of it doesn’t work. According to my error.log, it’s because it doesn’t have permissions.

[php][Mon Jun 13 16:22:35 2016] [error] [client 75.83.167.113] PHP Fatal error: Call to a member function fetch_assoc() on a non-object in /var/www/html/dynasty/assets/config/properties.php on line 10
[Mon Jun 13 16:23:21 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:23:22 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Winsane.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:23:22 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/eminems.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:23:22 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Bank.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:23:23 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Bank.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:24:25 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:24:25 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:24:26 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Winsane.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:24:27 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/eminems.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:24:28 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Bank.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:24:29 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Bank.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:25:32 2016] [error] [client 75.83.167.113] PHP Warning: fopen(installdone.txt): failed to open stream: Permission denied in /var/www/html/dynasty/assets/config/install/install.php on line 577, referer: http://149.56.128.248/assets/config/install/install.php?install=6
[Mon Jun 13 16:25:32 2016] [error] [client 75.83.167.113] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/html/dynasty/assets/config/install/install.php on line 578, referer: http://149.56.128.248/assets/config/install/install.php?install=6
[Mon Jun 13 16:25:32 2016] [error] [client 75.83.167.113] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/html/dynasty/assets/config/install/install.php on line 579, referer: http://149.56.128.248/assets/config/install/install.php?install=6
[Mon Jun 13 16:25:52 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:25:52 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:25:52 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:25:53 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Winsane.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 16:28:40 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 17:05:21 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Fudges.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 17:05:21 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Fudges.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 17:05:21 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 17:05:22 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 17:05:22 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/eminems.png denied, referer: http://149.56.128.248/?base=main
[Mon Jun 13 17:05:22 2016] [error] [client 75.83.167.113] (13)Permission denied: access to /assets/img/GD/Characters/Wincake.png denied, referer: http://149.56.128.248/?base=main[/php]

How do I enable these permissions then? I currently have MySQL, PHP, and Apache installed on my webserver. In fact, it’s up and running right now, though any MySQL statements fail.

Well, Xari, it is a permission issue on the folders in your /assets/etc folder. Basically, when you set up a server, most of the folders have permission for the programs running it to access all of the folders. But, sometimes is not set up correctly by default. Here is a link to one explaination: https://wiki.apache.org/httpd/13PermissionDenied

That link is based on your error #13 you posted. Windows computers are different than Apache servers. To fix it, you most
likely just need to use your FTP client and right-click on each folder you are getting the error on and set the permissions
correctly. Set it to 644 first and see if that fixes it. On some FTP clients, you can do it on the top folder and let it drop-down
to the children folders. On folders that you need to write files into, you may need to set it to 755 to be able to do that.

The permissions are basically set up to three main levels. No-access, access-depending-on-items and full-access.
You really want the middle one. This can allow visitor to save items or read items or alter items or delete items. It also
has settings for allowing just users assign to the group access. So, you can allow just your programs to access these
folders or allow limited use of access by others. Here is a link to a full list of possible permissions and what they mean:
http://linuxcommand.org/lts0070.php
Look down this page a little and you can see a lot of samples like 644 and what they mean. I think it will help you and if you
are controlling a web server, it is a must learn item. Good luck, hope this helps!

Sponsor our Newsletter | Privacy Policy | Terms of Service