Search code examples
phppathfastcgiabsolute-path

URL path not working, absolute path does


I switched hosting providers and now have the following problem.

A function, imagecreatefromjpeg(), is trying to read a file from its URL path (http://mydomain.com/contents/category/certificate/1/template.jpg). This function was working on old setup but fails with the following error on the newer setup.

(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
Premature end of script headers: index.php

The problem went away once I replaced the URL path with absolute path of the same file.

The differences I can see are

  1. the new setup is using nginx as Apache's reverse proxy.
  2. the PHP version on new setup is 5.3.3, older setup had 5.3.14

We've tried many things but can't understand how to make URL paths work on the newer setup. Can anybody help?


Solution

  • Are you sure you configured your nginx webserver accordingly ? Here are some good tutorials that can explain some of the more relevant nginx and php fastcgi process manager common pitfalls:

    1. Ars Technica: Web Served part 1: Setting up a web server

    2. Ars Technica: Web Served part 3: Installing PHP Fastcgi Process Manager

    3. Nginx common pitfalls

    I linked these resources because it seems as if you have a missconfiguration of your rewrite engine. In any case, please provide better context !