1

I recently purchased a GoDaddy hosting package and uploaded all of my website files written primarily in PHP from scratch. But when I try going to my site, it only loads the head portion of the file then throws a 500 error in the inspection panel. Some Googling around told me that there's not a lot of information to be had from a 500 error and to check my cPanel logs.

The cPanel logs:

[Mon Sep 11 09:38:33.529493 2017] [autoindex:error] [pid 22333:tid 140627618502400] [client xx.xx.xx.xx:53218] AH01276: Cannot serve directory /home/mrzander/public_html/: No matching DirectoryIndex (index.html.var,index.htm,index.html,index.xhtml,index.wml,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.php4,index.php3,index.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directive
[Mon Sep 11 09:26:18.658155 2017] [autoindex:error] [pid 22417:tid 140627555563264] [client xx.xx.xx.xx:52447] AH01276: Cannot serve directory /home/mrzander/public_html/: No matching DirectoryIndex (index.html.var,index.htm,index.html,index.xhtml,index.wml,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.php4,index.php3,index.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directive
[Mon Sep 11 08:38:29.568926 2017] [autoindex:error] [pid 9707:tid 140627871168256] [client 158.69.2.15:37794] AH01276: Cannot serve directory /home/mrzander/public_html/: No matching DirectoryIndex (index.html.var,index.htm,index.html,index.xhtml,index.wml,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.php4,index.php3,index.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directive
[Mon Sep 11 04:46:46.503303 2017] [autoindex:error] [pid 6487:tid 140627702421248] [client 69.58.178.58:50763] AH01276: Cannot serve directory /home/mrzander/public_html/: No matching DirectoryIndex (index.html.var,index.htm,index.html,index.xhtml,index.wml,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.php4,index.php3,index.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directive

Other StackEchange sites mentioned editing various conf files, but I don't have access to those (httpd.conf, apache2.conf, etc.; I just have access to an .htaccess file in the public_html folder.

Is there something I need to do with the .htaccess file to resolve this error?

EDIT: Forgot to add something. The actual index.php for the website is located in a public folder within the public_html, so when someone goes to mysite.com, it directs them to mysite.com/public/index.php. Earlier today, I added an index.html to the public_html folder just to see if it would survive the error; it did not.

EDIT2: The .htaccessfile

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
ErrorDocument 404 /404.html
ErrorDocument 403 /403.html
DirectoryIndex index.php index.html public/index.php  

EDIT3: New Logs

[Mon Sep 11 20:16:48.016315 2017] [core:alert] [pid 23998:tid 140627618502400] [client 172.6.118.47:49812] /home/mrzander/public_html/.htaccess: Illegal option noindexes
[Mon Sep 11 20:16:48.016158 2017] [core:alert] [pid 23998:tid 140627618502400] [client 172.6.118.47:49812] /home/mrzander/public_html/.htaccess: Illegal option noindexes
[Mon Sep 11 20:15:49.343249 2017] [rewrite:error] [pid 25357:tid 140627702421248] [client 172.6.118.47:49809] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /home/mrzander/public_html/403.html
[Mon Sep 11 20:15:49.343177 2017] [rewrite:error] [pid 25357:tid 140627702421248] [client 172.6.118.47:49809] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /home/mrzander/public_html/
[Mon Sep 11 20:15:44.029303 2017] [rewrite:error] [pid 8377:tid 140627733890816] [client 172.6.118.47:49807] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /home/mrzander/public_html/403.html
[Mon Sep 11 20:15:44.029232 2017] [rewrite:error] [pid 8377:tid 140627733890816] [client 172.6.118.47:49807] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : /home/mrzander/public_html/
11
  • At first blush I would assume that you do not have a default page as defined by the DirectoryIndex directive which defines that index.html, index.htm, default.html, etc. are there default files for any directory. This is typically defined in your site configuration files, however, this directive can be used in your .Htaccess file too. Some installs install PHP after Apache and fail to fully configure the system. You may need to add index.php. See: httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryindex
    – closetnoc
    Commented Sep 12, 2017 at 0:24
  • What command would you recommend adding to the .htaccess file? I tried a combo of DirectoryIndex disabled, DirectoryIndex index.html index.php, and DirectoryIndex public/index.php to no avail per the link you provided.
    – MrZander
    Commented Sep 12, 2017 at 1:08
  • You mentioned being redirected to mysite.com/public/index.php? This is not good! In fact, it is very poor!! I used to be a web host and one of the original registered ISPs so I have experience providing services to customers. Have you called GoDaddy on any of this? I would recommend making a quick list of concerns and talking to them first. When you enter example.com, there should not be a forward to any sub-directory at all. This is telling me that GoDaddy has some strange configuration issues. I suggest starting there. Ask for a supervisor if necessary.
    – closetnoc
    Commented Sep 12, 2017 at 1:18
  • I moved index.php out of the public folder and put it in the public_html folder, and 86ed the redirect, so going to mysite.com leads directly to index. But I'm still having the same issue with only the head loading and nothing else but a 500 error. I'll give them a call and see what the deal is. I also posted my .htaccess file as a last ditch effort for answers. Maybe you can set me straight.
    – MrZander
    Commented Sep 12, 2017 at 2:26
  • 1
    Pay attention to the last 4 lines you posted from the log file. You may need options FollowSymLinks at the least.
    – closetnoc
    Commented Sep 12, 2017 at 4:18

2 Answers 2

3

So I finally reached out and contacted GoDaddy support. After an hour, we determined there might be an error in my code. And after a little bit of digging and testing with some basic files, he was right.

I added the following to my index.php file...

error_reporting(E_ALL);
ini_set('display_errors', 1);

AND LOW AND BEHOLD:

Fatal error: Uncaught Error: Call to undefined function mysqli_fetch_all() in /home/[redacted]/public_html/private/database.php:147 Stack trace: #0 /home/[redacted]/public_html/public/layouts/navigation.php(4): MySQLDatabase->fetchAllSubjects() #1 /home/[redacted]/public_html/index.php(49): include('/home/mrzander/...') #2 {main} thrown in /home/[redacted]/public_html/private/database.php on line 147

Which explains why the header was loading and nothing else, and why the server was throwing a 500 error. I had completely ignored the possibility of an error because mysqli_fetch_all() worked on my local machine without any trouble.

So the lesson learned here is, if you're getting a 500 error, it could potentially be a problem with your code. I'm going to fix this today and everything should be okay. Thanks to everyone who helped out.

1
  • the error_report(E_ALL); solved my problem.. none of the web host manager could resolve it.. but only the error.. we can't sentence if we can't find the guilty!..
    – MFarooqi
    Commented Jun 21, 2018 at 14:24
1

It seems that in the public_html folder there is no index.html or index.php (or other). Are you sure after the upload there is at least a file name index.php? Can you check in ftp or file manager and see if the file is really there?

4
  • I added an index.html to the public_html folder just to be sure and still no dice. I added a bit of extra info I forgot to mention into my question.
    – MrZander
    Commented Sep 12, 2017 at 1:00
  • I read your note. So now we know is not the missing index file. I can think it could be a mistake in the redirect, like it redirect to a non existing folder? What did you exactly write in the .htaccess to redirect? Commented Sep 12, 2017 at 1:16
  • It would probably just be easier if I showed you. See EDIT2.
    – MrZander
    Commented Sep 12, 2017 at 2:27
  • It looks a little bit strange to me, try this to reach the index.php in the public directory (when the public directory is in the public_html). The file .htaccess is placed in the public_html folder: RewriteEngine On RewriteRule ^$ /public [L] DirectoryIndex index.html index.php Commented Sep 12, 2017 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.