dasbose
dasbose

Reputation: 25

Why will HTML files load properly, while PHP files will not?

I have two simple test files, one a basic HTML document that displays a simple message and the other a PHP document that does the same.

If I access the HTML document using a URL like this it displays properly:

sample.com/test.html

If I access the PHP file in a similar manner it also displays properly:

sample.com/test.php

Accessing the HTML file from a subdirectory also works just fine: sample.com/somedirectory/test.html

However, accessing the PHP page in a similar manner does not work:

sample.com/somedirectory/test.php

It produces this error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.` EDIT Here is the HTML code:

<html>
    <body>
        hello world
    </body>
</html>

And the PHP code:

<?php
    phpinfo();
?>

Here's what the server's error log has to say:

[Wed Dec 18 12:58:08 2013] [error] [client 71.222.168.54] File does not exist: /home/username/public_html/500.shtml
[Wed Dec 18 12:58:08 2013] [error] [client 71.222.168.54] SoftException in Application.cpp:256: File "/home/username/public_html/somedirectory/test.php" is writeable by group

Upvotes: 0

Views: 125

Answers (2)

sjagr
sjagr

Reputation: 16512

You have to set the permissions of your PHP files to 644 and folders to 755 because your server has suEXEC enabled.

From the terminal you should run chmod 644 test.php or use any FTP client to set your permissions

Source Source #2

Upvotes: 1

DimeCadmium
DimeCadmium

Reputation: 340

Based on the error File "/home/username/public_html/somedirectory/test.php" is writeable by group your server is using something like suphp, and you need to remove write permissions from group: chmod go-w /home/username/public_html/somedirectory/test.php from command line.

Upvotes: 0

Related Questions