首先,对不起我的英语,也抱歉问一个在整个网络上都有答案的问题。 我已经阅读了很多关于这个问题的帖子,但我仍然找不到解决办法。
我是一名网页开发者,最近从Windows 7换到了Ubuntu。我做了一个网站(它在线并且可以正常工作),我设置了LAMP以继续进行开发。
我创建了一个test.php文件:<?php phpinfo(); ?>
并将其放置在/var/www/html
目录下,它显示了有关php的所有信息,我非常高兴:“好的,一切都完成了,明天我会努力工作。”
但是我将整个网站放在了/var/www/html
目录下,而不是一个文件夹中,index.php文件位于/var/www/html
,但猜猜看:浏览器根本不加载我的任何.php文件,它一直在思考中。
我做了以下操作:
我重新启动了Apache:/etc/init.d/apache2 restart
我再次尝试了test.php文件,它正常工作。
我在/var/www/html
中放了一个.html文件,也正常工作。
我查找了/etc/apache2/sites-enable/000-default.conf
,它说:
DocumentRoot /var/www/html
我查找了/etc/apache2/mods-enabled/dir.conf
,它说:
DirectoryIndex index.html index.cgi index.pl index.php ...
编辑*
我认为这可能与phpmyadmin有关,就像我无法连接到数据库一样。但是当我尝试加载页面时,屏幕上没有任何内容...我不确定。我可以访问
localhost/phpmyadmin
的URL,并且我已经按照以下方式编辑了connection.php文件:<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_rakstadconnection = "localhost";
$database_rakstadconnection = "rakstadclandb";
$username_rakstadconnection = "root";
$password_rakstadconnection = "admin";
$rakstadconnection = mysql_connect($hostname_rakstadconnection, $username_rakstadconnection, $password_rakstadconnection) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_query("SET NAMES 'utf8'");
?>
数据库的名称是正确的,就像用户名和密码一样。
http://i89.photobucket.com/albums/k220/Haddex/Capturadepantallade2014-06-09112609_zpsc45ddb72.png
http://i89.photobucket.com/albums/k220/Haddex/Capturadepantallade2014-06-09112120_zps0b9e15f7.png
*编辑2:这可能是因为我将一个网站从Windows迁移到Linux吗?我使用了Dreamweaver。*编辑3:我将#更改为/*,但没有效果。错误日志文件显示:
[Mon Jun 09 17:08:13.627881 2014] [:error] [pid 1517] [client 127.0.0.1:46663] PHP Warning: require_once(/var/www/html/Connections/rakstadconnection.php): failed to open stream: Permission denied in /var/www/html/index.php on line 1
[Mon Jun 09 17:08:13.627933 2014] [:error] [pid 1517] [client 127.0.0.1:46663] PHP Fatal error: require_once(): Failed opening required 'Connections/rakstadconnection.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/index.php on line 1
我正在阅读错误日志,但是...我应该在我的index.php文件中添加一个Linux路径吗?我不这么认为。
谢谢。
/* 这个 */
或者//这个也可以
来进行注释。 - Duncubuntu/var/log/apache2/error.log
中遇到了一个PHP错误。 - squareborg//
或/* */
作为注释符号,你说你总是这样做,但在这种情况下你用了#
,我甚至不知道那曾经是一个可接受的注释标记。 - squareborg