FastCGIExternalServer demystified

« 1 2 3 4 5 6 7 8 9View All»

First Failure

Now that we’re all set, you can try to request http://fcgi.test.local in your browser.
This will most likely result in an error message:

No input file specified

Don’t worry, we’re going to deal with this problem later. For the moment, just request http://fcgi.test.local/index.php from your browser. You should see the familiar page with all the information PHP spits out when requested to do so.
Actually, it’s almost the familiar page. Most notably, the section “Apache Environment” should be missing. If you still see the Apache environment, you’re not running via FastCGI and you should check your setup before proceeding.

If everything worked as expected, you may now think “Hey cool. That was simple.”. Unfortunately it isn’t and I’ll show you why.

Remember the little line in our virtual host configuration, that enabled the external processing, supposedly of PHP scripts? I’ll repeat it here for clarity:

FastCGIExternalServer /srv/www/fcgi -host 127.0.0.1:9000

Remember also that I said this will cause all files residing in (or below, for that matter) that path will be processed by the external FCGI server? Unfortunately this is true to the word. Every file in or below that path will be processed by the external server. No matter whether it’s a PHP script (what we want) or a JavaScript file, a CSS file or some kind of graphics format. Everything will be processed by — well, thrown at — the external server.

Obviously, the PHP interpreter knowns nothing about interpreting JavaScript, CSS, GIF, JPG, you-name-it. You can easily test this by putting a GIF or JPG file into the directory and requesting it from withing your browser. The output will look something like this:

cougar_341

If you want to test for yourself, just copy any graphics file to the document root of your testing vhost and request it from within your browser. Clearly not what we want. But how to get to the desired result? That’s where the brain mangling starts.


This entry was posted in PHP, Software, the ugly truth and tagged , , . Bookmark the permalink.

One Response to FastCGIExternalServer demystified

  1. Pingback: External FastCGI With Apache « IT Know-It-All

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>