View previous topic :: View next topic |
Author |
Message |
technetx -
Joined: 27 Oct 2008 Posts: 15
|
Posted: Sun Nov 09, 2008 8:38 pm Post subject: $PHP_SELF |
|
|
If you're having trouble with Abyss and PHP_SELF, change the "type" in your host to "Standard" instead of "PHP Style".
I was wondering why a bunch of scripts were duplicating URLs.... "/page.php?var=xxx" would end up being "/page.php/page.php?var=xxx". If you see this happening in your scripts, the only way it seems to solve it is:
1) change your php host setting to "Standard"
or 2), change every single line of code in all your scripts where you use $PHP_SELF.
I think I'll go with the first one for now ;) |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Nov 09, 2008 10:05 pm Post subject: |
|
|
It's actually supposed to be $_SERVER['PHP_SELF'] |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
technetx -
Joined: 27 Oct 2008 Posts: 15
|
Posted: Sun Nov 09, 2008 10:26 pm Post subject: RE: PHP_SELF |
|
|
Hi Trust,
I was using the constant in the example, but it does it both with $PHP_SELF and $_SERVER['PHP_SELF']. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Nov 09, 2008 11:00 pm Post subject: |
|
|
What's the full PHP version you're using? |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
technetx -
Joined: 27 Oct 2008 Posts: 15
|
Posted: Sun Nov 09, 2008 11:28 pm Post subject: |
|
|
PHP 5.2.6
Windows Vista
Abyss X2 |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Nov 09, 2008 11:29 pm Post subject: |
|
|
Can you post the code so that we may check it for any errors? Thank you!
The PHP version you're using should be set to Standard under "Scripting Parameters" for Type. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
technetx -
Joined: 27 Oct 2008 Posts: 15
|
Posted: Sun Nov 09, 2008 11:41 pm Post subject: |
|
|
Here's a simple one named test.php
If you have type set to "PHP Style"
<?php
echo $PHP_SELF."<br>";
echo $_SERVER['PHP_SELF']."<br>";
echo $SCRIPT_NAME."<br>";
?>
<p> </p>
<p>This is a <a href="<?=$PHP_SELF?>">link</a></p>
The output will be /test.php/test.php for all echo except $SCRIPT_NAME.
Setting type to "Standard" and it'll echo correctly. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
technetx -
Joined: 27 Oct 2008 Posts: 15
|
Posted: Sun Nov 09, 2008 11:48 pm Post subject: |
|
|
Note: Abyss and PHP 5.2.6 runs perfect using PHP Style... with only $PHP_SELF broken on hundreds of different scripts.
I haven't found any other errors. This is at least on Windows. Haven't tested Abyss on anything else but Vista and PHP 5.2.6 running external dedicated MySQL/FreeBSD on Dell Edge Servers.
Seems to be a good solid alternative to Apache on Linux and also Apache on Windows so far. Still have more testing to go, but getting pretty comfortable with Abyss ;) |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
DonQuichote -
Joined: 24 Dec 2006 Posts: 68 Location: The Netherlands
|
Posted: Mon Nov 10, 2008 11:41 pm Post subject: Known bug |
|
|
It is a known (and irritant) bug of PHP. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
technetx -
Joined: 27 Oct 2008 Posts: 15
|
Posted: Tue Nov 11, 2008 1:33 am Post subject: |
|
|
Hi,
Is it a known bug of PHP or a know bug of "standard" vs. "php style" in Abyss on Windows?
I can't duplicate the bug running Apache on Win (same version of PHP) or Apache on *nix (same version of PHP).
Not placing blame here, I'm just trying to find all these bugs before using Abyss on a production box.
Would you happen to know what the difference is between "standard" and "php style"? I can't find any documentation... I'm trying to see if this setting would have any other negative effects for coding purposes.
Thanks! |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
DonQuichote -
Joined: 24 Dec 2006 Posts: 68 Location: The Netherlands
|
Posted: Wed Nov 12, 2008 12:03 am Post subject: |
|
|
I have the same bug on Xubuntu 8.04. I read somewhere that there is a patch for it, but I write my code to run on all versions of PHP5 (you never know what server the code has to run on) and therefore take this bug into account, even if it is solved on my PC. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
cornelis -
Joined: 08 Feb 2009 Posts: 1 Location: holland
|
Posted: Sun Feb 08, 2009 12:33 pm Post subject: PHP_SELF dows not work properly |
|
|
Hi,
I have upgraded to Abyss 2.6 and PHP 5.2.8 on Windows XP and discovered problem with the PHP_SELF variable. The following programm deliveres the following output:
example error.php ::
<?php
echo($_SERVER['PHP_SELF']);
?>
output :
/error.php/error.php
It should be :
/error.php
I have tried to find the host setting, but cannot find it. Need some hint to resolve this problem.
Greetings
Cornelis |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
admin Site Admin
Joined: 03 Mar 2002 Posts: 1295
|
Posted: Sun Feb 08, 2009 4:17 pm Post subject: Re: PHP_SELF dows not work properly |
|
|
cornelis,
Please ensure that the PHP interpreter is declared in Abyss Web Server with its Type set to "Standard" and not to "PHP Style".
Actually, starting from PHP 5.2.4, PHP interpreters no more need the "PHP Style" workaround and will act as any "Standard" CGI interpreter. _________________ Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Lawrence -
Joined: 16 Jan 2003 Posts: 207 Location: Brisbane, AU
|
Posted: Tue Jun 23, 2009 6:26 am Post subject: |
|
|
Ahoy admin/aprelium.
The PHP installation instructions still say that PHP-Style should be chosen, not Standard.
This has recently caused me some grief. If I might be so bold, I'd like to suggest the docs be changed to reflect this change and prevent others from suffering so terribly as I have. =) |
|
Back to top |
![ICQ Number ICQ Number](templates/subSilver/images/lang_english/icon_icq_add.gif) |
![](templates/subSilver/images/spacer.gif) |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Jun 23, 2009 7:10 am Post subject: |
|
|
Lawrence wrote: | Ahoy admin/aprelium.
The PHP installation instructions still say that PHP-Style should be chosen, not Standard.
This has recently caused me some grief. If I might be so bold, I'd like to suggest the docs be changed to reflect this change and prevent others from suffering so terribly as I have. =) |
Only PHP5 requires you to select Standard for Type. That guide is for PHP4.
http://www.aprelium.com/abyssws/php5win.html |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Lawrence -
Joined: 16 Jan 2003 Posts: 207 Location: Brisbane, AU
|
Posted: Tue Jun 23, 2009 10:35 am Post subject: |
|
|
That just means other errors need to be corrected. The page I linked includes PHP5 in its instructions.
that page wrote: | In the Interpreter field, press Browse..., go to the directory where you have installed PHP and click on php.exe if you have installed PHP 4 or php-cgi.exe if you have installed PHP 5. |
that page wrote: | If you plan to install PHP 5 on Windows, we highly recommend using our preconfigured PHP 5 package. |
that page wrote: | Set Type to PHP Style. |
You're right that there are other special instructions for PHP5, but they are not found at the bottom of the page I linked, nor are they mentioned during the PHP-install page that is. |
|
Back to top |
![ICQ Number ICQ Number](templates/subSilver/images/lang_english/icon_icq_add.gif) |
![](templates/subSilver/images/spacer.gif) |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Jun 23, 2009 6:19 pm Post subject: |
|
|
I agree, Aprelium should fix that. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
SCM -
Joined: 14 Aug 2009 Posts: 1
|
Posted: Fri Aug 14, 2009 6:19 pm Post subject: abyss and php on linux does has same issue |
|
|
I have followed the php installation instructions and also followed the instructions set out here but it makes no deference, im running the latest update to php on a fedora 9 box with the latest abyss version. no matter what i do i always get "domain/index.php/index.php" this is driving me nutty, if i dident already have a site in the apache web, i would just use apache and forget all about abyss all togeather. as it stands im now thinking ill have to set up another box as abyss seems to me to be completely unreliable to run php |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
DonQuichote -
Joined: 24 Dec 2006 Posts: 68 Location: The Netherlands
|
Posted: Sat Aug 15, 2009 3:45 pm Post subject: |
|
|
Gee, did we not mention that this is a bug in PHP? Go on, install apache, spend 5 years to learn to administer it, and you will still see the same bug. It is in PHP, not in the Abyss.
This function works around that bug:
Code: | function PhpSelf()
{$strResult = $_SERVER['PHP_SELF'];
if((strlen($strResult) % 2)==0):
$strHalf = substr($strResult, 0 , strlen($strResult)/2);
if($strResult == $strHalf . $strHalf):
$strResult = $strHalf; // No idea what happens here? There is a bug in PHP that can cause the PHP_SELF to be duplicate.
endif;
endif;
return $strResult; } |
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
dannydesiliva -
Joined: 23 Sep 2009 Posts: 1
|
Posted: Wed Sep 23, 2009 7:46 am Post subject: Slideshow problems due to PHP_SELF = REDIRECT_URL assignment |
|
|
I wasn't able to start a slideshow or browse to the next image whenever I accessed a random image from my gallery startpage.
I've looked into the code and found the following cause:
In init.inc.php the variable PHP_SELF is assigned as
Code:
$PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
Problem is that on my provider's server (Apache 1.3.19, PHP 4.1.2), REDIRECT_URL always points to the php script URL INCLUDING the HTTP-GET variables. SCRIPT_NAME has the correct value but never gets used because REDIRECT_URL is already defined.
Example:
$PHP_SELF = /pixies/displayimage.php?album=random&cat=&pos=-26
instead of the desired
$PHP_SELF = /pixies/displayimage.php
(I've checked other servers on the web and they don't include the HTTP-GET variables in the REDIRECT_URL string. Lucky them.)
Could someone explain the reason why REDIRECT_URL is being used for PHP_SELF and not just SCRIPT_NAME?
I thought that REDIRECT_URL is just for error handling purposes.
Any insight is greatly appreciated!
Cheers,
onkeljossip (a very happy coppermine user) |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
satishbhawra51 -
Joined: 11 Oct 2009 Posts: 2
|
Posted: Mon Oct 12, 2009 12:21 am Post subject: |
|
|
If you're having trouble with Abyss and PHP_SELF, change the "type" in your host to "Standard" instead of "PHP Style". _________________ web information | best hosting |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
pankajnagarkoti87 -
Joined: 13 Oct 2009 Posts: 1
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
anybody -
Joined: 17 Mar 2008 Posts: 90
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Toasty -
Joined: 21 Feb 2008 Posts: 298 Location: Chicago, IL
|
Posted: Sat Jul 17, 2010 10:42 pm Post subject: |
|
|
register_globals does not need to be enabled for $PHP_SELF to work. I've always had register_globals off (on PHP 5.16 through 5.3.2), and I use that variable without issue. _________________ Audit the secure configuration of your server headers! |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
simon1 -
Joined: 07 Jan 2013 Posts: 1
|
Posted: Mon Jan 07, 2013 1:13 pm Post subject: |
|
|
TRUSTAbyss wrote: | Lawrence wrote: | Ahoy admin/aprelium.
The PHP installation instructions still say that PHP-Style should be chosen, not Standard.
This has recently caused me some grief. If I might be so bold, I'd like to suggest the docs be changed to reflect this change and prevent others from suffering so terribly as I have. =) |
Only PHP5 requires you to select Standard for Type. That guide is for PHP4.
http://www.aprelium.com/abyssws/php5win.html |
Hey Trust ,as technetx said change all the script line by line ......is it possible ???
because if i have large website and having huge amount of code then i cannot change whole script line by line ...so let me know is there any procedure from with i can change all the code automatically by once ..
thanks in advance to all ..... |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
aprelium-support -
Joined: 20 Feb 2009 Posts: 356
|
Posted: Tue Jan 08, 2013 11:16 am Post subject: |
|
|
simon1,
Are you sure you are affected by that issue? What scripts are you running? Are they written by you or some kind of opensource scripts? _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|