ainoy31 Posted October 14, 2008 Share Posted October 14, 2008 Is there any way to get $HTTP_SERVER_VARS['PATH_TRANSLATED'] to work with the apache 2.0 filter like it does with the cgi? I have searched the web and some suggest going back to using apache 1.3.x. Others suggest using 'SCRIPT_FILENAME' but no luck. $WEB_ROOT = substr(ereg_replace("[\x5c\]"."[\x5c]","\x5c",$HTTP_SERVER_VARS['PATH_TRANSLATED']), 0 , -strlen( $HTTP_SERVER_VARS['SCRIPT_NAME'])); Much appreciation. AM Quote Link to comment https://forums.phpfreaks.com/topic/128399-solved-path_translated-and-apache-2x/ Share on other sites More sharing options...
Daniel0 Posted October 14, 2008 Share Posted October 14, 2008 The PHP manual has this to say about it: 'PATH_TRANSLATED' Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping. Note: As of PHP 4.3.2, PATH_TRANSLATED is no longer set implicitly under the Apache 2 SAPI in contrast to the situation in Apache 1, where it's set to the same value as the SCRIPT_FILENAME server variable when it's not populated by Apache. This change was made to comply with the CGI specification that PATH_TRANSLATED should only exist if PATH_INFO is defined. Apache 2 users may use AcceptPathInfo = On inside httpd.conf to define PATH_INFO. Also, please note that $HTTP_SERVER_VARS is deprecated in place of $_SERVER. Quote Link to comment https://forums.phpfreaks.com/topic/128399-solved-path_translated-and-apache-2x/#findComment-665250 Share on other sites More sharing options...
ainoy31 Posted October 14, 2008 Author Share Posted October 14, 2008 I have tried this in the httpd.conf file: <Files ~ "\.php$"> AcceptPathInfo On </Files> No luck. My page crashes. Thanks. AM Quote Link to comment https://forums.phpfreaks.com/topic/128399-solved-path_translated-and-apache-2x/#findComment-665310 Share on other sites More sharing options...
ainoy31 Posted October 14, 2008 Author Share Posted October 14, 2008 I have also tried just AcceptPathInfo on and no luck Quote Link to comment https://forums.phpfreaks.com/topic/128399-solved-path_translated-and-apache-2x/#findComment-665346 Share on other sites More sharing options...
ainoy31 Posted October 14, 2008 Author Share Posted October 14, 2008 Sorry. This is for my last comment. The AcceptPathInfo on goes in the httpd.conf file. Quote Link to comment https://forums.phpfreaks.com/topic/128399-solved-path_translated-and-apache-2x/#findComment-665347 Share on other sites More sharing options...
ainoy31 Posted October 17, 2008 Author Share Posted October 17, 2008 If anyone is interested, here is the solution to the apache 2 and PATH_TRANSLATED issue. I created a file called jushack.php with the content of: <? if (strlen($JDOCROOT = @getenv("JDOCROOT"))) { $_SERVER["DOCUMENT_ROOT"] = $JDOCROOT; apache_setenv("DOCUMENT_ROOT", $JDOCROOT, 1); } $HTTP_SERVER_VARS['PATH_TRANSLATED'] = $HTTP_SERVER_VARS['SCRIPT_FILENAME']; ?> Save this file to your webroot. Then in the file httpd-vhosts.conf of apache I added these lines of code: <VirtualHost *:80> ServerAdmin webmaster@**the url of the website goes here like mywebsite.com DocumentRoot c:/core/webhosts/mywebsite.com/htdocs/ <Directory /> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> php_value auto_prepend_file "/core/webhosts/jushack.php" ServerName mywebsite.com ServerAlias mywebsite.com </VirtualHost> Hope is helps some of you guys out. Quote Link to comment https://forums.phpfreaks.com/topic/128399-solved-path_translated-and-apache-2x/#findComment-668309 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.