Results 1 to 5 of 5

Thread: phpinfo works, but getting a blank page on an index.php

  1. #1
    Join Date
    Apr 2013
    Beans
    28

    phpinfo works, but getting a blank page on an index.php

    Hello,

    I have a server running Ubuntu with Nginx, php5-fpm and mysql. I created the "phpinfo" file and uploaded it to my server and it works. I can see my phpinfo. however, when I go to run a index.php I get a blank page. Here is my config file. I am running virtual hosts and html files work fine, so I must be missing some kind of setting for the php5. Below is my config file for one of the sites. Does anyone know what I am missing?

    Thanks,
    Dan
    Code:
    # You may add here your
    # server {
    #    ...
    # }
    # statements for each of your virtual hosts to this file
    
    ##
    # You should look at the following URL's in order to grasp a solid understanding
    # of Nginx configuration files in order to fully unleash the power of Nginx.
    # http://wiki.nginx.org/Pitfalls
    # http://wiki.nginx.org/QuickStart
    # http://wiki.nginx.org/Configuration
    #
    # Generally, you will want to move this file somewhere, and start with a clean
    # file but keep this around for reference. Or just disable in sites-enabled.
    #
    # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
    ##
    
    server {
            listen 192.168.1.104:80;
            server_name mysite.com;
            access_log /var/log/nginx/mysite.com_access.log;
            root /var/www/mysite;
            index index.php index.html index.htm index.shtml;
    
    location ~ \.php$ {
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
                    # With php5-fpm:
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    include fastcgi_params;
    try_files $uri $uri/ /index.php;
    
            }
    }
    
        # Make site accessible from http://localhost/
        #server_name myservername.com;
    
        #location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            #try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
        #}
    
        # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
        #location /RequestDenied {
        #    proxy_pass http://127.0.0.1:8080;    
        #}
    
        #error_page 404 /404.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/www;
        #}
    
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #    # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #    # With php5-cgi alone:
        #    fastcgi_pass 127.0.0.1:9000;
        #    # With php5-fpm:
        #    fastcgi_pass unix:/var/run/php5-fpm.sock;
        #    fastcgi_index index.php;
        #    include fastcgi_params;
        #}
    
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny all;
        #}
    #}
    
    
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen 8000;
    #    listen somename:8080;
    #    server_name somename alias another.alias;
    #    root html;
    #    index index.html index.htm;
    #
    #    location / {
    #        try_files $uri $uri/ =404;
    #    }
    #}
    
    
    # HTTPS server
    #
    #server {
    #    listen 443;
    #    server_name localhost;
    #
    #    root html;
    #    index index.html index.htm;
    #
    #    ssl on;
    #    ssl_certificate cert.pem;
    #    ssl_certificate_key cert.key;
    #
    #    ssl_session_timeout 5m;
    #
    #    ssl_protocols SSLv3 TLSv1;
    #    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
    #    ssl_prefer_server_ciphers on;
    #
    #    location / {
    #        try_files $uri $uri/ =404;
    #    }
    #}
    Last edited by sandyd; April 15th, 2013 at 03:29 AM. Reason: code tags pls

  2. #2
    Join Date
    Mar 2007
    Location
    /home/david
    Beans
    194
    Distro
    Xubuntu

    Re: phpinfo works, but getting a blank page on an index.php

    Are you using PHP short tags? i.e,
    Code:
    <? echo "hello world"; ?>
    If so, try adding php after <? like so:

    Code:
    <?php echo "hello world"; ?>
    My setup: MSI E350dM-EE3 motherboard, 4gb ddr3 ram, x2 250gb Seagate Barracuda sata hdds, x2 1tb WD Green sata hdds. Sony SDM-HS95P monitor, Logitech usb mouse, keyboard

  3. #3
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: phpinfo works, but getting a blank page on an index.php

    What does index.php belong to? I ran into issues when I migrated phpbb3 from Apache to Nginx and all I would get was a blank screen (even with nginx setup correctly).

    *shrugs*
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  4. #4
    Join Date
    Apr 2013
    Beans
    28

    Re: phpinfo works, but getting a blank page on an index.php

    I am running phpfox script. I created a "hello world" test page and that works, but not the script /install/index.php hmmmmmm.

  5. #5
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    8,757
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: phpinfo works, but getting a blank page on an index.php

    Have you checked the log files to see what errors PHP has thrown? Usually if you get a blank page the code is broken before you get to the steps that display output. I use Apache, so I don't know where nginx stores its logs, but look in the error log and see what errors are reported.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •