2011-04-07 26 views
0

我用我的MacBook Pro(OSX 10.6.7)作爲開發服務器使用此配置CI + OSX 10.6.7 +的nginx + PHP,CGI渲染輸出問題

nginx 0.8.54_0 
php5 @5.3.6_0+fastcgi 
fcgi @2.4.0_3 
spawn-fcgi @1.6.3_0 

我的CI是1.7.2和1.7.3

我的目錄stucture是這樣

my document root is /Users/nuri/Sites 
my CI system located in /Users/nuri/frameworks/CI/system 
my CI application located in /Users/nuri/project/apps1/application 

問題是nginx的訪問任何CI控制器 我測試使用Apache從MAMP打包合作的時候沒有返回/打印任何東西ntrollers工作正常

樣本訪問的index.php /歡迎

從CI日誌文件,Nginx的似乎在這種狀態下

DEBUG - 2011-04-07 20:39:36 --> Config Class Initialized 
DEBUG - 2011-04-07 20:39:36 --> Hooks Class Initialized 
DEBUG - 2011-04-07 20:39:36 --> URI Class Initialized 
DEBUG - 2011-04-07 20:39:36 --> Router Class Initialized 
DEBUG - 2011-04-07 20:39:36 --> Output Class Initialized 
DEBUG - 2011-04-07 20:39:36 --> Input Class Initialized 
DEBUG - 2011-04-07 20:39:36 --> Global POST and COOKIE data sanitized 
DEBUG - 2011-04-07 20:39:36 --> Language Class Initialized 
DEBUG - 2011-04-07 20:39:36 --> Loader Class Initialized 
DEBUG - 2011-04-07 20:39:36 --> Helper loaded: form_helper 
DEBUG - 2011-04-07 20:39:36 --> Helper loaded: url_helper 
DEBUG - 2011-04-07 20:39:36 --> Database Driver Class Initialized 
與Apache訪問時

,日誌說是停止:

DEBUG - 2011-04-07 20:40:09 --> Config Class Initialized 
DEBUG - 2011-04-07 20:40:09 --> Hooks Class Initialized 
DEBUG - 2011-04-07 20:40:09 --> URI Class Initialized 
DEBUG - 2011-04-07 20:40:09 --> Router Class Initialized 
DEBUG - 2011-04-07 20:40:09 --> Output Class Initialized 
DEBUG - 2011-04-07 20:40:09 --> Input Class Initialized 
DEBUG - 2011-04-07 20:40:09 --> XSS Filtering completed 
DEBUG - 2011-04-07 20:40:09 --> XSS Filtering completed 
DEBUG - 2011-04-07 20:40:09 --> Global POST and COOKIE data sanitized 
DEBUG - 2011-04-07 20:40:09 --> Language Class Initialized 
DEBUG - 2011-04-07 20:40:09 --> Loader Class Initialized 
DEBUG - 2011-04-07 20:40:09 --> Helper loaded: form_helper 
DEBUG - 2011-04-07 20:40:09 --> Helper loaded: url_helper 
DEBUG - 2011-04-07 20:40:09 --> Database Driver Class Initialized 
DEBUG - 2011-04-07 20:40:09 --&gt; Session Class Initialized <-------- missing this line below <<< 
DEBUG - 2011-04-07 20:40:09 --&gt; Helper loaded: string_helper 
DEBUG - 2011-04-07 20:40:09 --&gt; Session routines successfully run 
DEBUG - 2011-04-07 20:40:09 --&gt; User Agent Class Initialized 
DEBUG - 2011-04-07 20:40:09 --&gt; Controller Class Initialized 
DEBUG - 2011-04-07 20:40:09 --&gt; Final output sent to browser 
DEBUG - 2011-04-07 20:40:09 --&gt; Total execution time: 0.0582 

我試圖製作陷阱 我發現CI + nginx「沒有處理」任何東西 from system/codeigniter/Cod eIgniter.php開始行

$CI = new $class(); 

它做工精細與Apache,至少我可以print_r的的$ CI值

請,迫切需要幫助從這裏專家

我的nginx服務器配置爲

server { 
     listen  8080; 
     server_name jupiter; 

     index index.php index.html index.htm; 
     root /Users/nuri/Sites; 
     access_log /tmp/jupiter.access.log webalizer; 
     error_log /tmp/jupiter.error.log debug; 

     client_max_body_size  5m; 
     client_body_buffer_size 256k; 

     #error_page 404 /index.php; 

     # redirect server error pages to the static page /50x.html 
     # 
     error_page 500 502 503 504 /50x.html; 
     error_page 404 /40x.html; 
     location = /50x.html { 
      root /opt/local/html; 
     } 

     location = /40x.html { 
      root /opt/local/html; 
     } 

     location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { 
      access_log  off; 
      expires   30d; 
      #expires max; 
      add_header Pragma public; 
      add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 
      break; 
     } 

     location ^/project/apps1/ { 
      if (!-e $request_filename) { 
        rewrite ^/project/apps1/(.*)$ /project/apps1/index.php/$1 last; 
       } 
     } 


     location /project/apps1/index.php { 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_param SCRIPT_FILENAME /Users/nuri/Sites/project/apps1/index.php; 
      include  /opt/local/etc/nginx/fastcgi_params;    
     } 

     location ~ \.php$ { 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
      include  /opt/local/etc/nginx/fastcgi_params;    
     } 

     # deny access to .htaccess files, if Apache's document root 
     # concurs with nginx's one 
     # 
     location ~ /\.ht { 
      deny all; 
     } 
    } 
+0

它在生產服務器,這是使用FreeBSD的 7.2 的PHP 5.2.12 產卵 - fcgi的精-1.6.3 nginx-0.7.65 是否在我的mac + nginx-0.8.x中使用了php fastcgi版本? – 2011-04-08 04:33:53

+0

我想我已經解決了它。 問題似乎是Macports php5 + fastcgi 我重新編譯PHP 5.3.6從源文件選項「--enable-CGI」 和CI工作正常就像在我的freebsd框。 – 2011-04-09 04:34:07

回答

1

在Ubuntu上,這條線解決了這個問題對我來說:

sudo apt-get install php5-cgi php5-dev php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ps php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc php5-xsl php5-common php5-mysql 

最有可能不是最好的方式,但它看起來像一個這樣的軟件包可以解決問題;)