Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


PHP showing up as text
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

PHP showing up as text

DataFrogsDataFrogs Banned
edited November 2012 in General

Fixed thanks to @Jack

«13

Comments

  • Post your Nginx server and site config

  • CiriumCirium Member
    edited November 2012

    NGINX will show the php code in the browser if HTTPD is installed.
    (Doesn't have to be running, just installed.)

    Uninstall apache/httpd if you have it installed then restart nginx and let us know if its working.

    -Cirium

  • DataFrogsDataFrogs Banned
    edited November 2012

    @Cirium
    httpd: unrecognized service

    @gsrdgrdghd

    #

    #

    This is the main Nginx configuration file.

    #

    More information about the configuration options is available on

    * the English wiki - http://wiki.codemongers.com/Main

    * the Russian documentation - http://sysoev.ru/nginx/

    #

    #

    ----------------------------------------------------------------------

    Main Module - directives that cover basic functionality

    #

    http://wiki.codemongers.com/NginxMainModule

    #

    ----------------------------------------------------------------------

    user nginx;
    worker_processes 1;

    error_log /var/log/nginx/error.log;

    error_log /var/log/nginx/error.log notice;

    error_log /var/log/nginx/error.log info;

    pid /var/run/nginx.pid;

    ----------------------------------------------------------------------

    Events Module

    #

    http://wiki.codemongers.com/NginxEventsModule

    #

    ----------------------------------------------------------------------

    events {
    worker_connections 1024;
    }

    ----------------------------------------------------------------------

    HTTP Core Module

    #

    http://wiki.codemongers.com/NginxHttpCoreModule

    #

    ----------------------------------------------------------------------

    http {
    include /etc/nginx/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"';
    
    access_log  /var/log/nginx/access.log  main;
    
    sendfile        on;
    #tcp_nopush     on;
    
    #keepalive_timeout  0;
    keepalive_timeout  65;
    
    #gzip  on;
    
    # Load config files from the /etc/nginx/conf.d directory
    include /etc/nginx/conf.d/*.conf;
    
    #
    # The default server
    #
    server {
        listen       80;
        server_name  _;
    
        #charset koi8-r;
    
        #access_log  logs/host.access.log  main;
    
        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm index.php;
        }
    
        error_page  404              /404.html;
        location = /404.html {
            root   /usr/share/nginx/html;
        }
    
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
    
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
    
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME 
    

    /usr/share/nginx/html$fastcgi_script_name;
    include fastcgi_params;
    }

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

    }

  • Are you sure that Fastcgi PHP is running?

  • @Zen makes no difference
    @StableVDS Not sure anymore...

  • @Zen do you know how to check the status of it? I just am rebooting the server, see if that will help.

  • Rebooted server - still same issue.

  • [root@Pro ~]# service php-fpm status
    php-fpm: unrecognized service

  • Then u don't have php installed...

  • package php-fpm not found.

  • For PHP I ran
    yum install lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy

  • Install it manually.

  • Ran yum install php -y installed it, still same issue.

  • CiriumCirium Member
    edited November 2012

    php and php-fpm are completely different things.

    You need php-fpm which you have not installed.

  • service php5-fpm restart

    if still not found, then your server don't have php installed

    btw, how did you install php anyway?

  • Installing php-fpm now.

  • [root@Pro ~]# service php-fpm start
    Starting php-fpm: [ OK ]
    [root@Pro ~]# service nginx start
    Starting nginx: [ OK ]

    Result: SAME
    http://puu.sh/1s6G0

  • You are likely missing something within your NGINX config or haven't refreshed your browser.

  • Its pissing me off, reinstalling whole VPS.

  • CiriumCirium Member
    edited November 2012

    Within four minutes I managed to get mybb up and running.
    Here is my NGINX config.
    (Edited out some of the useless stuff.)

    server {
    server_name myvpsip;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    root /var/www/html;

    location / {
        index index.php;
    }
    
    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
    }
    

    }

  • FFS, reinstalled now it downloads the php files!!!

  • CiriumCirium Member
    edited November 2012

    Just paste my config inside of yours and see if you get something useful.

    @Zen
    XD

  • Try this :

    # apt-get install -y nginx php5-cgi php5-mysql php5-gd php5-curl php5-imagick php5-memcache php5-xcache php5-sqlite php5-mcrypt zip
    
  • Still nothing.

  • Centos...

  • zserozsero Member
    edited November 2012

    DataFrogs, I'd recommend you to:
    1. reinstall a clean Deb 6 32-bit system
    2. run Minstall
    3. run minAdmin

    Super easy, community tested system in 5 minutes!

  • CentOS 5 & 6 sre so similar when it comes to installing things dude, just try it anyway..

    5 if it matters: http://library.linode.com/web-servers/nginx/php-fastcgi/centos-5

  • for centos, just change apt-get to yum :)

Sign In or Register to comment.