I have set up Apache 1.3.31 and PHP 4.3.4 on my Debian unstable box.
Most scripts are run by mod_php (with the user ID of the Apache
process).
I want to run one application under a different user ID, so I have to
use use the CGI interface for this:
<Directory /usr/share/foo>
Options +FollowSymLinks
AllowOverride All
order allow,deny
allow from all
Action php-cgi /cgi-bin/php4
AddHandler php-cgi php
</Directory>
This works fine--scripts below /usr/share/foo are run with php-cgi
interpreter. However, some options need to be changed so that the
application doesn't complain[1], but I can't just edit the system-wide
php.ini.
Basically, I see four approaches:
(1) Use an own php.ini in the current working directory
(2) Set options on the command line
(3) Set path to php.ini via command line
(4) Set the PHPRC evnironment variable to my own php.ini
1. won't work because Apache sets the working directory to
/usr/lib/cgi-bin. (php4 changes that to the location of the script
after startup and reading php.ini.) Perhaps there is a way to tell
Apache not to do that, but I haven't found that option yet.
I haven't succeeded in setting up 2. or 3. so far. Apparently, php4
tries to execute its own binary[2] whenever I change the "Action"
statement to something like this
Actions php-cgi /cgi-bin/php4?-option
.... which is recognized fine by other CGI scripts. The php4 that is
shipped with woody (4.1.2-6woody3) doesn't have this problem.
4. So I tried adding
SetEnv PHPRC /usr/share/foo/php.ini
.... but this didn't work either. Apparently, either Apache or PHP sets
this variable to REDIRECT_PHPRC, and thus, /etc/php4/cgi/php.ini is
read again.
I'd like to do without any wrapper scripts. Installing (and
maintaining) a seaparate php4 installation just for one application is
not an option, either.
Can anyone here provide a aolution or hints?
-Hilko
[1]
ERROR: Your .htaccess is not active - you need to set register_globals = Off!
ERROR: Your .htaccess is not active - you need to set allow_call_time_pass_reference = Off!
ERROR: Your .htaccess is not active - you need to set magic_quotes_gpc = Off!
ERROR: Your .htaccess is not active - you need to set short_open_tag = Off!
ERROR: Your .htaccess is not active - you need to set error_reporting = 2047!
Too many errors to continue.
[2]
Warning: Unexpected character in input: '' (ASCII=15) state=1 in
/usr/lib/cgi-bin/php4 on line 2753
Parse error: parse error in /usr/lib/cgi-bin/php4 on line 2753<!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: Help sought for Apache/PHP setup problem