昨天我花了 5 个多小时试图找出我的设置有什么问题。在 ci213/application/controllers 和 views 目录中,我有一个简单的 site.php 控制器和 test.php 视图。我不知道为什么该网站无法加载。有人对我接下来可以寻找什么有建议吗?也许记录它工作正常?如果我能得到更好的日志错误,我可以有更多的工作。
我认为它必须与codeigniter有关,因为我在apaches根目录(/var/www)有一个index.php和index.html,在站点根目录(/var/www/vhosts/srp-local)也有一个index2.php /htdocs),当我转到 localhost/index.(php|html) 或 srp-local/index2.php 时,页面会正确加载和显示,因此 php 和 apache 正在工作。
尝试加载该站点时,我得到一个空白页面,因此我认为它必须与 CI 有关。我正在跟踪所有日志文件,唯一获得更新的是站点 access.log 并出现以下错误。
127.0.0.1 - - [23/Mar/2013:09:00:28 -0600] "GET / HTTP/1.1" 500 381 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0"
配置文件
$config['base_url'] = 'http://srp-local/'; # My hosts file is configured for this.
$config['log_threshold'] = 4;
$config['log_path'] = '/var/www/vhosts/srp-local/logs/ci_error.log';
控制器/site.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Site extends CI_Controller
{
public function index()
{
$this->load->view('test');
}
}
意见/test.php
<html>
<head>
</head>
<body>
<?php echo "PHP is working and the 'test' view was loaded"; ?>
</body>
</html>
阿帕奇根
/var/www/vhosts
$ ll
drwxrwsr-x 6 krizzo www-data 4096 Mar 22 10:45 it355
drwxrwsr-x 6 krizzo www-data 4096 Mar 22 17:45 srp-local
htdocs 是 srp-local 的 webroot,它的 index.php 引用到 ci213 文件夹。
/var/www/vhosts
$ ll srp-local/
drwxrwsr-x 2 krizzo www-data 4096 Mar 22 17:06 cgi-bin
drwxrwsr-x 4 krizzo www-data 4096 Mar 22 17:14 ci213
drwxrwsr-x 2 krizzo www-data 4096 Mar 22 17:19 logs
drwxrwsr-x 5 krizzo www-data 4096 Mar 22 17:26 htdocs
所有日志位置/权限
/var/log/apache2/
-rw-rw-rw- 1 www-data adm 0 Mar 23 08:52 php_errors.log
-rw-r----- 1 root adm 12191 Mar 23 09:32 access.log
-rw-r----- 1 root adm 4858 Mar 23 09:32 error.log
/var/www/vhosts/srp-local/logs/
-rw-r--r-- 1 root www-data 3227 Mar 22 19:42 error.log
-rw-rw-r-- 1 krizzo www-data 0 Mar 23 09:37 ci_error.log
-rw-r--r-- 1 root www-data 12983 Mar 23 09:38 access.log
php.ini 文件设置
error_reporting = E_ALL & ~E_DEPRECATED
log_errors = On
error_log = /var/log/apache2/php_errors.log