[英]php file not loading correctly displaying blank page
I have a php file called Choice.php and it is suppose to display html contents. 我有一个名为Choice.php的php文件,它假定显示html内容。 I am running it on a linux server.
我在Linux服务器上运行它。 I set the permissions to 700 and when I try to access the choice.php file by url I get a blank page.
我将权限设置为700,当我尝试通过url访问choice.php文件时,我得到了一个空白页。 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). 文件需要具有
other
权利,才能通过网络服务器(即,使用url)访问other
/ world
。 The reason for this is both so that the webserver can read the given file, and so it's accessible to the web. 这样做的原因既是为了使Web服务器可以读取给定的文件,也可以通过Web访问它。 When using
700
it's only accessible for the owner of the file. 使用
700
,仅文件所有者可以访问。 644
is what you want for (most) files, and 755
for directories. 644
是您想要的(大多数)文件, 755
是目录。
Proper rights would be ( tim
being my user name): 正确的权限是(
tim
是我的用户名):
$ 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 在Tuxfiles.org上查看Linux文件权限
You might want to check your Apache and PHP configuration on your Linux server, as it seems to be bad. 您可能要检查Linux服务器上的Apache和PHP配置,因为这似乎很糟糕。 It works 100% fine on my Debian LAMP install.
在我的Debian LAMP安装上,它可以100%正常运行。 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.
尝试更改权限,直到它适合您为止。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.