apache - Resolve chroot problems with php5-fpm -


i using apache (and can't switch nginx or lighttpd because of customers), , many others, have problems following variables:

$_server["script_filename"] $_server["path_translated"] $_server["document_root"] 

because of chroot, variables passed apache's mod_fastcgi php5-fpm screwed , don't match proper ones.
let me show example:

$_server["document_root"] = /home/vhosts/h0001/home/domains/test.com $_server["script_filename"] = /home/vhosts/h0001/php-fpm $_server["path_translated"] = /home/vhosts/h0001/home/domains/test.com/phpinfo.php 

instead of:

$_server["document_root"] = /home/domains/test.com $_server["script_filename"] = /php-fpm $_server["path_translated"] = /home/domains/test.com/phpinfo.php 

so, seems easy do, since need remove "/home/vhosts/hxxxx" variables.

i've thought of using auto_prepend_file directive inside php.ini , add this:

<?php     $_server['script_filename'] = str_replace('/home/vhosts/h0001','',$_server['script_filename'])     $_server['path_translated'] = str_replace('/home/vhosts/h0001','',$_server['path_translated'])     $_server['document_root'] = str_replace('/home/vhosts/h0001','',$_server['document_root']) 

this allow right variables set, have 2 problems it:

  • i can't prepend file since php doesn't work @ ("no input file.") because looks in wrong directory scripts
  • setting alias in virtualhost doesn't seem work because chroot environment takes place on /home/vhosts/hxxxx , various domain docroots /home/vhosts/hxxxx/home/domains/domain.tld/; , alias, apache still giving away wrong paths.

i've seen lot of people dealing with nginx, solving problem (allows editing script_filename , document_root, apache doesn't), , other people solving issue symlinking appropriate directory tree inside chroot around problem. last solution sucks.

another way using this patch, trying it, seems went wrong: trying compile apxs2 -cia mod_fastcgi.c, throws error undefined symbol: fcgi_config_new_static_server, , don't know how fix (compiling static? how apxs2?)

the best solution seems patching php hand, i'm not sure cleanest thing do...!


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -