Jump to content


Photo

$_SERVER['PATH_INFO'] switched off


  • Please log in to reply
6 replies to this topic

#1 rossh

rossh
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 20 September 2006 - 03:55 PM

Hi i'm tring to sort out my URL's using $_SERVER['PATH_INFO'] but it seems to be switched off, is configurable in php or apache and if i request that it be switched on will i get refused for security issues etc.?  Also is there a way of telling it's switched off.  I read somewhere you can use print_r ($_SERVER);, when i tried this PATH_INFO was not in the output.

If the hosting service won't switch it on is there an alternative?

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 September 2006 - 04:02 PM

Not all server variables will be available. Some server variables are only available for certain servers. Such as if you are using IIS server you can grab the username that is logged onto the workstation that is browsing the site, However you cant do this if you are using Apache server.

However having a quick look over at php.net on the PATH_INFO variable I found this:

'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.

NOTE the text in red.

#3 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 20 September 2006 - 04:02 PM

Are you running Apache 2? From what I've read you might have problems using $_SERVER['PATH_INFO'] with Apache 2.



PHP.net says:

Apache 2 users may use AcceptPathInfo = On inside httpd.conf to define PATH_INFO.


Dont know what that means, but maybe you should have a look into it if you want to.



Orio.

EDIT- wildteen88 as faster :PP
Think you're smarty?

(Gone until 20 to November)

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 September 2006 - 04:06 PM

Come to think of ity ou can probably add AcceptPathInfo On to htaccess file in root of your websites document root.

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 20 September 2006 - 04:10 PM

This might help good luck.

<?php

//my current url
$path=$_SERVER['SERVER_NAME'];
echo $path;


//my computer ip address
$path=$_SERVER['SERVER_ADDR'];
echo $path;

//my internet ip
$path=$_SERVER['REMOTE_ADDR'];
echo $path;

//my current folder i am in
$path=$_SERVER['DOCUMENT_ROOT'];
echo $path;
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 rossh

rossh
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 20 September 2006 - 07:53 PM

Thanks for getting back to me guys, i tried to include the line in .htaccess but no joy.  I checked Apache and it is version Apache/2.0.53 so you might have something there.

Thanks

Ross

#7 Destruction

Destruction
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 20 September 2006 - 08:07 PM

There's actually a function for this too I believe.  Try looking up pathinfo(); in the manual...it may be what you're looking for.

Dest




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users