我的是用nginx+php建站的,
nginx安装路径:/usr/local/webserver/nginx/ 
网站根目录:/data0/htdos/www/WebSite
网站代码目录:
drwxrwxrwx 15 root root 4096 Apr 14 20:21 admin
drwxrwxrwx  2 root root 4096 Apr 14 20:18 include
drwxrwxrwx  9 root root 4096 Apr 14 20:16 public
网站首页地址是:http://192.168.15.250/admin/Action/index.php
网站从根目录开始加过x权限的, 且phpinfo()测试页放在网站根目录下是可以显示的,但是打开网站首页地址却只显示部分php源码,真不知道是怎么回事了,劳烦各路大侠献计献策????

解决方案 »

  1.   

    只显示部分php源码是什么意思?
      

  2.   

    就是我上一条里面讲的 打开这个页面 http://192.168.15.250/admin/Action/index.php 应该显示的是首页才是,结果在网页里面只显示了php的源码,但是又不是那个页面全部的源码:没办法截图,我就复制给你好了,就是下面的:
    assign("linkAdmin",$link_admin); $xtpl->assign("linkimages",$link_images); @$xtpl->assign("siteName",$sitename); $xtpl->assign("siteImage",$site_image); $xtpl->assign("adsImage",$ads_image); $xtpl->assign("subTitle","网站"); //测试内容 if($type==1 || $type==2){ //$xtpl->parse("main.left.qxnone"); $xtpl->parse("main.index"); }else{ $xtpl->parse("main.index"); } require "../include/footer.php"; $xtpl->parse('main'); $xtpl->out('main'); //modified by buoren 2010/12/31 ?>只有这些,所以我很郁闷,之前他们搭建的http+php首页都是可以显示的,我不知道我搭建的是哪里出了问题
      

  3.   


    这个我知道的,我打开的是http://192.168.15.250/admin/Action/index.php页面,说的就是这个页面里的源码了,其他页面的都没有包含
      

  4.   


    下面是程序:
    <?
    /*================================
            ×÷Õߣºlc
            ½¨Á¢ÈÕÆÚ£º2011/1/7
            Ö÷Òª¹¦ÄÜ: ÏÔʾÊ×Ò³,¶¨ÒåÈ«¾Ö·¾¶
    ================================
    */
    //http://smmsrv1:20000/YSCMS/default.htm
    require_once "../include/global.php";
    nullAction();      //µ÷ÓÃδµÇ¼·½·¨
    $xtpl = new XTemplate("../templates/index.tpl");
    @session_start();
    $type=$_SESSION['user_type'];
    $xtpl->assign("linkAdmin",$link_admin);
    $xtpl->assign("linkimages",$link_images);
    @$xtpl->assign("siteName",$sitename);
    $xtpl->assign("siteImage",$site_image);
    $xtpl->assign("adsImage",$ads_image);
    $xtpl->assign("subTitle","网站");//²âÊÔÄÚÈÝif($type==1 || $type==2){
            //$xtpl->parse("main.left.qxnone");
            $xtpl->parse("main.index");
    }else{
            $xtpl->parse("main.index");
    }
    require "../include/footer.php";
            $xtpl->parse('main');
            $xtpl->out('main');       //modified by qq 2010/12/31
    ?>
      

  5.   

    php.ini的short_open_tag = On了么?
      

  6.   

    1、文件编码问题例如gbk文件编码包含有utf8的内容
    2、注释中有 /// ?> 或者 /* ?> */ ,和1的乱码内容构成解析错误!
      

  7.   


    如果全部改用gbk编码就没问题了吗?
      

  8.   

    这个问题终于解掉了,跟短标签有关系,但是不是你们说的编码问题,只要确定配置好nginx和php就ok了,我的错误确实是php程序的问题,让人气愤的是,到最后才发现他们写了绝对路径的调用,所以才会导致错误,下面,我贴出我的nginx的配置文件内容:
    user  www www;
    worker_processes  8;error_log  /usr/local/webserver/nginx/logs/error.log;
    pid        /usr/local/webserver/nginx/logs/nginx.pid;worker_rlimit_nofile 65535;events {
        use epoll;
        worker_connections  1024;
    }http {
        include       mime.types;
        default_type  application/octet-stream;    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
        log_format download  '$remote_addr – $remote_user [$time_local]'
                             '"$request" $status $bytes_sent'
                             '"$http_referer" "$http_user_agent"'
                             '"$http_range" "$sent_http_content_range"';
        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 8m;
          
        sendfile on;
        tcp_nopush     on;    keepalive_timeout 60;    tcp_nodelay on;    fastcgi_connect_timeout 30;
        fastcgi_send_timeout 30;
        fastcgi_read_timeout 30;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 128k;    gzip on;
        gzip_min_length  1k;
        gzip_buffers     4 16k;
        gzip_http_version 1.0;
        gzip_comp_level 2;
        gzip_types       text/plain application/x-javascript text/css application/xml;
        gzip_vary on;
        access_log  logs/access.log  main;
        client_header_timeout 3m;
        client_body_timeout 3m;
        send_timeout 3m;    server {
            listen       80;
            server_name  demeter.smm.cn;
            root /data0/htdos/www/WebSite/; 
            access_log  logs/host.access.log;        location / {
                index  index.html index.htm index.php;
            }         error_page   500 502 503 504  /50x.html;
            location ~ .*\.php?$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php; 
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name; 
                include        /usr/local/webserver/nginx/conf/fastcgi_params;
            }        location ~ /\.ht {
                deny  all;
            }
        }