I have a php file called Choice.php and it is suppose to display html contents. I am running it on a linux server. I set the permissions to 700 and when I try to access the choice.php file by url I get a blank page. I cant seem to figure out why this is the case. Any suggestions?
<?php
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n";
echo " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "\n";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
echo "<head>\n";
echo " <meta http-equiv=\"Content-Type\" content=\n";
echo " \"text/html; charset=us-ascii\" />\n";
echo "\n";
echo " <title>Choose</title>\n";
echo "</head>\n";
echo "\n";
echo "<body>\n";
echo " <form action=\"index.php\" method=\"post\" enctype=\n";
echo " \"application/x-www-form-urlencoded\">\n";
echo " <h1>Choose</h1>\n";
echo "\n";
echo " <p><input type=\"radio\" name=\"Radio\" value=\"1\" /><font size=\"5\"\n";
echo " color=\"#0033CC\">Instant Psychology</font><br />\n";
echo " <br />\n";
echo " <input type=\"radio\" name=\"Radio\" value=\"2\" /><font size=\"5\"\n";
echo " color=\"#CC0000\">Instant Geography</font><br />\n";
echo " <br />\n";
echo " <input type=\"radio\" name=\"Radio\" value=\"3\" /><font size=\"5\"\n";
echo " color=\"#660033\">Instant Gastronomy</font><br />\n";
echo " <br />\n";
echo " <input type=\"submit\" name=\"Submit\" value=\"Go\" /></p>\n";
echo " </form>\n";
echo "</body>\n";
echo "</html>\n";
echo "\n";
?>
A file needs to have read rights for other
/ world
to be accessible by through a webserver (ie by use of url). The reason for this is both so that the webserver can read the given file, and so it's accessible to the web. When using 700
it's only accessible for the owner of the file. 644
is what you want for (most) files, and 755
for directories.
Proper rights would be ( tim
being my user name):
$ ls -l Choice.php
-rw-r--r-- 1 tim tim 0 19.04.13 06:14 Choice.php
Take a look at Linux file permissions at Tuxfiles.org
You might want to check your Apache and PHP configuration on your Linux server, as it seems to be bad. It works 100% fine on my Debian LAMP install. Check your error log file to see if it shows anything regarding the page and time accessed. Try changing the permissions around, until it works for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.