Support the ongoing development of Laravel.io →
posted 10 years ago
Configuration

I'm running a site on Laravel 4.2, deployed to DigitalOcean 1gig server via Laravel Forge on the nginx platform. The domain is pointing to the D/O host via the dns records, A name and CNAME - usual stuff.

I've encountered an issue when I try to load a page that has a .php extension, I'm getting a blank page with a simple, yet infuriating, error message: No input file specified.

I originally had this set up for testing on a small shared server from some leftover hosting and when I hit any page with a php extension, the framework would simply store it in the database and redirect to a whoops page. With this issue occurring on the D/O, I can no longer do that and dead pages will occur when old urls are hit from ye auld Google search results.

Apparently this is a common problem but I've not actually found a resolution on t'web and I've had a good time looking around. There are various suggestions out there, some suggest uncommenting out certain lines in the nginx conf files (#1) whilst others, more Forge related, suggest PHP isn't set up correctly (#2). It's all been set up via Forge and the only thing I've added is environment variables.

I'm not exactly the most knowledgable when it comes to setting up non-Windows servers, hence why I went for the peace of mind using Forge and I'm not familiar at all really with Linux and nginx.

There are a few issues of this occurring to other folk and nobody seems to have a concrete solution to this issue as yet. So I am hoping for anyone who might point me in the right way to resolve this wee niggle. I'll happily post whatever for any Linux/nginx expert if required. As it was working fine on my smaller host, I'm assuming it has to be something with the way Forge has set up the server on Digital Ocean.

#1 http://stackoverflow.com/questions/21377321/nginx-no-input-file-specified-php-fast-cgi #2 http://laravel.io/forum/10-12-2014-laravel-forge-deployment-issue-no-input-file-specified

Last updated 2 years ago.
0

Flippin' typical - bit more Googling around and I've found a solution that when applied, works perfectly.

Basically, in Forge in the site list there's a wee dropdown icon at the bottom, click it and it gives an option to 'Edit Nginx Configuration', up will pop a modal with the config details from the server.

Scroll down to the line that reads... fastcgi_split_path_info ^(.+.php)(/.+)$;

And place this line just above it... try_files $query_string /index.php =404;

I saved it, restarted the server from the server page and job done. :)

Kudos to Mr Bashy: https://laracasts.com/discuss/channels/requests/nginx-on-homestead-error-while-visiting-urls-that-end-with-php-extension

0

slev70 said:

Flippin' typical - bit more Googling around and I've found a solution that when applied, works perfectly.

Basically, in Forge in the site list there's a wee dropdown icon at the bottom, click it and it gives an option to 'Edit Nginx Configuration', up will pop a modal with the config details from the server.

Scroll down to the line that reads... fastcgi_split_path_info ^(.+.php)(/.+)$;

And place this line just above it... try_files $query_string /index.php =404;

I saved it, restarted the server from the server page and job done. :)

Kudos to Mr Bashy: https://laracasts.com/discuss/channels/requests/nginx-on-homestead-error-while-visiting-urls-that-end-with-php-extension

@slev70 this gives you a 404 page but what about launching the site? I agree btw its very hard to find a solution for this problem.

Last updated 10 years ago.
0

@slev70 Thank you jesus for posting this solution! I've got the same issue where we need to maintain exact URL matches after upgrading to Laravel (due to Adwords, not SEO), so we have to spoof the browser. I'm using Forge as the backup install of my app and could not for the life of me get the site to work on any page that ended in .php. Your solution solved the issue and there don't seem to be any side effects.

0

The way I did it for my domain (http://diydifm.com) was in Envoyer set the Project path to "/home/forge/default" (or replace "default" with the project name if specified) and in Forge set the web directory to "/current/public"

Last updated 9 years ago.
0

slev70 said:

Flippin' typical - bit more Googling around and I've found a solution that when applied, works perfectly.

Basically, in Forge in the site list there's a wee dropdown icon at the bottom, click it and it gives an option to 'Edit Nginx Configuration', up will pop a modal with the config details from the server.

Slightly faster fix:

Based on what slev70 had I navigated to the edit page for Nginx Configuration. At the top of this file is the server default settings including the default path.

I found that the default path was not pointing to the correct folder that git would publish to on the digital ocean server. By default it was pointing to:

root /home/forge/default/public;

git is publishing to /home/forge/default

changed root to the following

root /home/forge/default;

saved and did a refresh to the site and my hello world test PHP started loading without issues.

I did not need to make any additional changes.

sebastiantramper liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

slev70 slev70 Joined 28 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.