css (1) jQuery (7) linux (38) mac (70) php (29) python (1) svn/git (9) trac (4) ubuntu (1) virtualbox (6) vista (2) windows (14)

Sunday, 19 June 2011

Nginx PHP FCGI "No input file specified" instead of 404

If you run PHP using fast cgi on nginx, you may have noticed that if you access a php file that doesn't exist it splurts out "No input file specified" this is because nginx is passing back to php which tries to use the file name but since it doesn't exist it throws that error. Not very elegant really.
To resolve it this is my preferred way.

1. Create your custom 404 file, we'll call it 404.html and upload it to your site.
2. Edit your nginx virtual host and add error_page /404.html; into your server block
3. Add fastcgi_intercept_errors on; into the bit before your fcgi_pass
4. Reload the nginx server

What this does is it tells nginx to catch all 4xx and 5xx errors from php and if there is a error_page directive set for that code return that page.

Thursday, 16 June 2011

Slow web interface on xbmc using fedora

I use XBMC as a media player and like to control it with my iPod well I've recently installed Fedora 15 on my desktop and my god was the web interface slow. The solution in my case, disable IPv6 in Fedora.

To do this edit /etc/modprobe.d/blacklist and add blacklist ipv6 then reboot.

Probably my old hardware doesn't like IPv6 :(