找不到CodeIgniter和Nginx-Class


CodeIgniter and Nginx - Class not found

我已经使用Apache将CodeIgniter应用程序从本地主机上传到运行Nginx的服务器。

它在我的本地主机和其他使用Apache的服务器上都能很好地工作。

它在一个子域下,一个域和其他子域都在100%运行PHP。

CI中的这个应用程序没有启动,PHP在没有编译的情况下返回

这是我在/var/log/nginx/error.log上看到的内容:

2013/12/05 14:50:31 [error] 20139#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'M_website' not found in /home/webroot/domain.com/cms/system/core/Loader.php on line 303" while reading upstream, client: 84.91.4.220, server: cms.domain.com, request: "GET /websites HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cms.domain.com"

在/home/webroot/domain.com/cms/system/core/Loader.php中找不到类'M_website'

这是我的子域配置。

server
{
    server_name cms.domain.com;
    access_log /var/log/nginx/cms.domain.access.log;
    root /home/webroot/domain.com/cms;
    index index.php index.html index.htm;
    if (!-e $request_filename) {
            rewrite ^.*$ /index.php last;
    }
    # enforce NO www
    if ($host ~* ^www'.(.*))
    {
        set $host_without_www $1;
        rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
    }
    # canonicalize codeigniter url end points
    # if your default controller is something other than "welcome" you should change the following
    if ($request_uri ~* ^(/websites/(/index)?|/index(.php)?)/?$)
    {
        rewrite ^(.*)$ / permanent;
    }
    # removes trailing "index" from all controllers
    if ($request_uri ~* index/?$)
    {
        rewrite ^/(.*)/index/?$ /$1 permanent;
    }
    # canonicalize codeigniter url end points
    # if your default controller is something other than "welcome" you should change the following
    if ($request_uri ~* ^(/websites/(/index)?|/index(.php)?)/?$)
    {
        rewrite ^(.*)$ / permanent;
    }
    # removes trailing "index" from all controllers
    if ($request_uri ~* index/?$)
    {
        rewrite ^/(.*)/index/?$ /$1 permanent;
    }
    # removes trailing slashes (prevents SEO duplicate content issues)
    if (!-d $request_filename)
    {
        rewrite ^/(.+)/$ /$1 permanent;
    }
    # removes access to "system" folder, also allows a "System.php" controller
    if ($request_uri ~* ^/system)
    {
        rewrite ^/(.*)$ /index.php?/$1 last;
        break;
    }
    # unless the request is for a valid file (image, js, css, etc.), send to bootstrap
    if (!-e $request_filename)
    {
        rewrite ^/(.*)$ /index.php?/$1 last;
        break;
    }
    # catch all
    error_page 404 /index.php;
    # use fastcgi for all php files
    location ~ '.php$ {
        fastcgi_split_path_info ^(.+'.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
    }
    # deny access to apache .htaccess files
    location ~ /'.ht
    {
        deny all;
    }
}

为什么会出现问题?

CI文件以开头

<?

而不是

<?php

解决方案

必须编辑/etc/php5/fpm/php.ini并将short_open_tag从关闭设置为On,然后重新启动php-fpm

service php5-fpm restart