clarkycal

*Help* nginx & PHP

4 posts in this topic

Well, i gave up on Apache as it likes to crash.. So i have been ripping my hair out for the past few hours trying to get php to play nicely with nginx..

So let me tell you how far i have got..

PHP files only work in the root directory, if i go to the /forums then it doesn't work (Message displayed: "No input file specified."). Why doesn't PHP work globally like it does on Apache (By globally i mean you dont have to specify the directories you want php to work on) am i seriously missing something?

Here is my nginx config for one of my servers(don't judge i just started nginx and it's a pain in the a$$) Feel free to try the links out your self, i have 2 info.php files:

cpgaming.co.uk/info.php

cpgaming.co.uk/forums/info.php

 

    server {
        listen 192.168.0.19:80;

        root html\cpgaming.co.uk;
        index index.html index.htm index.php;

        server_name cpgaming.co.uk *.cpgaming.co.uk;

	    location ~ \.php$ {
	        try_files $uri =404;
	        fastcgi_split_path_info ^(.+\.php)(/.+)$;
	        fastcgi_pass 127.0.0.1:9000;
	        fastcgi_index index.php;
	        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	        include fastcgi.conf;
	    }

		location / {
			#try_files $uri $uri/ =404;
			autoindex on;
		}
	}

anyhelp will be great thanks.

 

 

0

Share this post


Link to post
Share on other sites
9 hours ago, Cookie Monster said:

You need to allow_all in nginx to allow further debt of files etc.

http://nginx.org/en/docs/http/ngx_http_access_module.html

@Cookie Monster Thanks for the tip however i went back to Apache2 on Linux VM this time :P

However i thought just moving the forums over would work out of the box as the database is still running (Hasn't been touched) but when you enter the forums i get (See screenshot below)

Untitled.png

Edit: Apache2 log: PHP Fatal error:  Uncaught Error: Call to undefined function IPS\\mb_internal_encoding() in /var/www/virtual/cpgaming.co.uk/forums/init.php:131\nStack trace:\n#0 /var/www/virtual/cpgaming.co.uk/forums/init.php(835): IPS\\IPS::init()\n#1 /var/www/virtual/cpgaming.co.uk/forums/index.php(11): require_once('/var/www/virtua...')\n#2 {main}\n  thrown in /var/www/virtual/cpgaming.co.uk/forums/init.php on line 131

 

 

EDIT2: --FIXED-- i was dumb and didnt use the ips4 check requirement script and i was missing alot of extentions, you may close this thread.

 

Edited by clarkycal
0

Share this post


Link to post
Share on other sites

What do you think? Remember the human.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.