Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a problem my test server loads html files fine but when I try to open a file like index.php it says The website encountered an error while retrieving http://localhost/. It may be down for maintenance or configured incorrectly. I have PHP5 installed but I don't see why this isn't working, is it an outdated PHP problem?

[Wed Sep 25 16:53:10 2013] [error] [client 127.0.0.1] PHP Warning:  require_once(/home/callum/public_html/Includes/Connection.php): failed to open stream: Permission denied in /home/callum/public_html/index.php on line 8
[Wed Sep 25 16:53:10 2013] [error] [client 127.0.0.1] PHP Fatal error:  require_once(): Failed opening required '/home/callum/public_html/Includes/Connection.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/callum/public_html/index.php on line 8
[Wed Sep 25 16:54:51 2013] [error] [client 127.0.0.1] PHP Warning:  require_once(/home/callum/public_html/Includes/Connection.php): failed to open stream: Permission denied in /home/callum/public_html/index.php on line 8
[Wed Sep 25 16:54:51 2013] [error] [client 127.0.0.1] PHP Fatal error:  require_once(): Failed opening required '/home/callum/public_html/Includes/Connection.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/callum/public_html/index.php on line 8

site config

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/callum/public_html/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/callum/public_html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>
share|improve this question
    
Look at /var/log/apache2/error.log: vi /var/log/apache2/error.log and post it. –  Manolo Sep 25 '13 at 16:00
    
Added the error log –  Callum Sep 25 '13 at 16:04

2 Answers 2

It is a permissions issue. Just change the permissions:

sudo chmod 0644 /home/callum/public_html/Includes/Connection.php

and try again.

share|improve this answer
    
Didn't work, it made it worse. Said forbidden so I changed back to 0755 –  Callum Sep 25 '13 at 16:10
    
Ok. Go to your php.ini file: cd /etc/php5/apache2/php.ini and comment the line include_path.... Restart the server and try again. –  Manolo Sep 25 '13 at 16:13
    
It was already commented ; UNIX: "/path1:/path2" ;include_path = ".:/usr/share/php" –  Callum Sep 25 '13 at 16:17
    
Add the apache site configuration to your question: vi /etc/apache2/sites-available/000-default.conf or the name of your site configuration. –  Manolo Sep 25 '13 at 16:28
    
Added the sites config –  Callum Sep 25 '13 at 16:34

Instead of this:

require_once(DIR."/Includes/Connection.php");

Use this:

require_once("Includes/Connection.php");
share|improve this answer
    
Nope still get this failed to open stream: Permission denied –  Callum Sep 25 '13 at 17:04
    
Is the error the same at /var/log/apache2/error.log? –  Manolo Sep 25 '13 at 17:10
    
I've fixed it now, sorry for any inconvenience. THe problem is that the file access wasn't set. –  Callum Sep 25 '13 at 17:13
    
Could you specify? –  Manolo Sep 25 '13 at 17:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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