Learn about Centmin Mod LEMP Stack today
Register Now

Wordpress wordpress pages showing php code instead of content.

Discussion in 'Blogs & CMS usage' started by harryneopotter, Jan 29, 2016.

Tags:
  1. harryneopotter

    harryneopotter Member

    70
    3
    8
    Aug 16, 2015
    Ratings:
    +8
    Local Time:
    1:52 AM
    Nginx 1.9.3
    MariaDB 10.0
    As the title says, only code is showing, no content. Happened suddenly, no changes on the server. Any possible causes ? Any pointers where to look ?

    Also, the admin area is working fine.
     
  2. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
    never had that happen on nginx/php-fpm and wouldn't out of the blue

    post your full nginx vhost config file for /usr/local/nginx/conf/conf.d/domain.com.con.conf and (/usr/local/nginx/conf/conf.d/domain.com.con.ssl.conf if using SSL)

    only thing i can think of is you introduced a misconfigured rewrite rule somewhere

    php version ? any wp plugins for caching ?
     
  3. harryneopotter

    harryneopotter Member

    70
    3
    8
    Aug 16, 2015
    Ratings:
    +8
    Local Time:
    1:52 AM
    Nginx 1.9.3
    MariaDB 10.0
    Here is the vhost config file code :
    PHP:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html

    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name domain.com;
    #            return 301 $scheme://www.domain.com$request_uri;
    #       }

    server {
      
    server_name domain.com www.domain.com;

    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;

      # limit_conn limit_per_ip 16;
      # ssi  on;

      
    access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=60m;
      
    error_log /home/nginx/domains/domain.com/log/error.log;

      
    root /home/nginx/domains/domain.com/public;

      
    # prevent access to ./directories and files
      
    location ~ (?:^|/)\. {
       
    deny all;
      }

    include /
    usr/local/nginx/conf/wpsupercache_domain.com.conf;

      
    location / {

      
    # Enables directory listings when index file not found
      #autoindex  on;

      # for wordpress super cache plugin
      
    try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;

      
    # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;

      
    }

    location ~* /(wp-login\.php) {
        
    limit_req zone=xwplogin burst=1 nodelay;
        
    #limit_conn xwpconlimit 30;
        #auth_basic "Private";
       # auth_basic_user_file /home/nginx/domains/domain.com/htpasswd_wplogin;  
        
    include /usr/local/nginx/conf/php-wpsc.conf;
    }

    location ~* /(xmlrpc\.php) {
        
    limit_req zone=xwprpc burst=45 nodelay;
        
    #limit_conn xwpconlimit 30;
        
    include /usr/local/nginx/conf/php-wpsc.conf;
    }

      include /
    usr/local/nginx/conf/wpsecure_domain.com.conf;
      include /
    usr/local/nginx/conf/php-wpsc.conf;
      include /
    usr/local/nginx/conf/staticfiles.conf;
      include /
    usr/local/nginx/conf/drop.conf;
      
    #include /usr/local/nginx/conf/errorpage.conf;
      
    include /usr/local/nginx/conf/vts_server.conf;
    }
    PHP 5.6.16, supercache plugin.

    Havent touched anything since last week or so .. this issue cropped up just a few hours ago. No idea how and why.
     
  4. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
    what's output for
    Code:
    php -i | grep short_open_tag
    and contents of /usr/local/nginx/conf/php-wpsc.conf

    using wp permalinks ? what format ?

    also update to php 5.6.17
     
  5. harryneopotter

    harryneopotter Member

    70
    3
    8
    Aug 16, 2015
    Ratings:
    +8
    Local Time:
    1:52 AM
    Nginx 1.9.3
    MariaDB 10.0
    Code:
    php -i | grep short_open_tag
    
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/apc.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0
    short_open_tag => On => On
    
    Code:
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass   127.0.0.1:9000;
        #fastcgi_pass   unix:/tmp/php5-fpm.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
        fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/;
    
    # might shave 200+ ms off PHP requests
    # which don't pass on a content length header
    # slightly faster page response time at the
    # expense of throughput / scalability
    #sendfile on;
    #tcp_nopush off;
    #keepalive_requests 0;
    
    fastcgi_connect_timeout 60;
    fastcgi_send_timeout 180;
    fastcgi_read_timeout 180;
    fastcgi_buffer_size 512k;
    fastcgi_buffers 512 16k;
    fastcgi_busy_buffers_size 1m;
    fastcgi_temp_file_write_size 4m;
    fastcgi_max_temp_file_size 4m;
    fastcgi_intercept_errors on;
    
    # next 3 lines when uncommented / enabled
    # allow Nginx to handle uploads which then
    # passes back the completed upload to PHP
    #fastcgi_pass_request_body off;
    #client_body_in_file_only clean;
    #fastcgi_param  REQUEST_BODY_FILE  $request_body_file;
    
    #new .04+ map method
    fastcgi_param HTTPS $server_https;
    
    # comment out PATH_TRANSLATED line if /usr/local/lib/php.ini sets following:
    # cgi.fix_pathinfo=0
    # as of centminmod v1.2.3-eva2000.01 default is set to cgi.fix_pathinfo=1
    
    fastcgi_param  PATH_INFO          $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
    
    fastcgi_param  QUERY_STRING       $query_string;
    fastcgi_param  REQUEST_METHOD     $request_method;
    fastcgi_param  CONTENT_TYPE       $content_type;
    fastcgi_param  CONTENT_LENGTH     $content_length;
    
    fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
    fastcgi_param  REQUEST_URI        $request_uri;
    fastcgi_param  DOCUMENT_URI       $document_uri;
    fastcgi_param  DOCUMENT_ROOT      $document_root;
    fastcgi_param  SERVER_PROTOCOL    $server_protocol;
    fastcgi_param  REQUEST_SCHEME     $scheme;
    fastcgi_param  HTTPS              $https if_not_empty;
    
    fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
    fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
    
    fastcgi_param  REMOTE_ADDR        $remote_addr;
    fastcgi_param  REMOTE_PORT        $remote_port;
    fastcgi_param  SERVER_ADDR        $server_addr;
    fastcgi_param  SERVER_PORT        $server_port;
    fastcgi_param  SERVER_NAME        $http_host;
    
    # Set php-fpm geoip variables
    fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
    fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
    fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
    fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
    fastcgi_param GEOIP_REGION $geoip_region;
    fastcgi_param GEOIP_CITY $geoip_city;
    fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
    fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
    fastcgi_param GEOIP_LATITUDE $geoip_latitude;
    fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
    
    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param  REDIRECT_STATUS    200;
    
                       }
    Permalinks are set to post name (as suggested by wpsuper cache)

    Should I upgrade now ?
     
  6. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
    possibly why APC Cache is outdated and known to cause problems these days run centmin.sh menu option 12 submenu option 1 to install Zend Opcache

    although problems don't cause php code to be served instead of rendered
     
  7. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
    also ensure you're on latest centmin mod 123.08stable at least

    Upgrading Centmin Mod Code to Latest Version



    Upgrading Centmin Mod involves 2 parts.
    1. Upgrading the actual Centmin Mod code outlined at Upgrade Centmin Mod - CentminMod.com LEMP Nginx web stack for CentOS This is heart of Centmin Mod where the code is the engine that runs centmin.sh shell based menu and all the automation you're accustomed to.
    2. Upgrade software that Centmin Mod installed or manages. For this part following outline at Upgrade - How to upgrade Centmin Mod | Centmin Mod Community
    So essentially, you can upgrade from .07 to .08 in place, but not everything is upgraded as some things like server initial environment setup isn't changed i.e. how swap, tmp setup and allocation are created etc. The main parts from part 2 above are what in place upgrades do i.e. Nginx and PHP-FPM compilation and config/settings parameters and MariaDB version from 5.5 to 10.0.x. If you want the full environment changed including tmp and swap setup to .08's configuration, then you would need a fresh OS install and fresh .08 initial install. You can think of it like upgrading Windows 7 to Windows 8. An in place upgrade will upgrade code but won't change your computer environment from when you installed Windows 7 i.e. disk configuration and partition sizes won't change from when you initially installed Windows 7. Only way to change that would be fresh Windows 8 install.
     
  8. harryneopotter

    harryneopotter Member

    70
    3
    8
    Aug 16, 2015
    Ratings:
    +8
    Local Time:
    1:52 AM
    Nginx 1.9.3
    MariaDB 10.0
    Done. Need to restart anything ? Site still not working :/
     
  9. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
  10. harryneopotter

    harryneopotter Member

    70
    3
    8
    Aug 16, 2015
    Ratings:
    +8
    Local Time:
    1:52 AM
    Nginx 1.9.3
    MariaDB 10.0
    already on 08

    Code:
    Centmin Mod 1.2.3-eva2000.08 - http://centminmod.com
    --------------------------------------------------------
                       Centmin Mod Menu
    
     
  11. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
  12. harryneopotter

    harryneopotter Member

    70
    3
    8
    Aug 16, 2015
    Ratings:
    +8
    Local Time:
    1:52 AM
    Nginx 1.9.3
    MariaDB 10.0
    restarted both nginx/php fpm .. still nothing.
     
  13. harryneopotter

    harryneopotter Member

    70
    3
    8
    Aug 16, 2015
    Ratings:
    +8
    Local Time:
    1:52 AM
    Nginx 1.9.3
    MariaDB 10.0
    centminmod was installed for this site just a couple of week ago, so should be pretty new already.
     
  14. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
    in the last week alone i've made over a dozen updates to 123.08stable at Commits · centminmod/centminmod · GitHub
     
  15. harryneopotter

    harryneopotter Member

    70
    3
    8
    Aug 16, 2015
    Ratings:
    +8
    Local Time:
    1:52 AM
    Nginx 1.9.3
    MariaDB 10.0
    says "current branch already upto date"
     
  16. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
  17. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
    once on latest centmin mod code, try updating to php 5.6.17 with zend opcache
     
  18. harryneopotter

    harryneopotter Member

    70
    3
    8
    Aug 16, 2015
    Ratings:
    +8
    Local Time:
    1:52 AM
    Nginx 1.9.3
    MariaDB 10.0
    updating to new branch now (123.08stable)
     
  19. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
  20. eva2000

    eva2000 Administrator Staff Member

    28,984
    6,579
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,766
    Local Time:
    6:22 AM
    Nginx 1.13.x
    MariaDB 5.5
    Also try purging wp super cache cache too in wp-admin