Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Apache2 I configured PHP as CGI in a virtual host:

SetEnv PHPRC "/usr/local/php5.3"
ScriptAlias /php5.3 "/usr/local/php5.3/bin"
Action application/php5.3 /php5.3/php-cgi
AddType application/php5.3 .php

Everything works fine. Now I have some issues with the standard version of the GD because it restricts me in settings several hinting and anti-aliasing stuff for fonts. Therefore I want to modify the GD source and create a new shared library. Since I don't want a modifed library in my system I want only PHP to use that library.

My question now: How can I change the Apache configuration in a way that PHP uses a certain new version of the library?

Something like this does not work:

ScriptAlias /php5.3 "LD_LIBRARY_PATH=/path/to/my/lib:$LD_LIBRARY_PATH /usr/local/php5.3/bin"
share|improve this question

Can you replace the php-cgi with a shell-script wrapper that sets the environment you need, then executes the real php-cgi binary?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.