Re: Adding a single php file to .htaccess.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24 Aug 2008, at 16:27, Ashley Sheridan wrote:
By your own definition, this will not work on 1% of the Linux servers, and don't forget that Linux is not the only operating system that is capable of running a PHP server...

"and will also work everywhere else"

Windows will have no problem with this, nor will any other platform that don't try to use the #! line - the PHP interpreter knows to ignore this line.

The only places it won't work is on servers that try to use the #! line but where env is not in /usr/bin, which will (AFAIK) only be the case when it's been moved manually (i.e. I don't know of any distribution stupid enough to move it.

The 1% was plucked out of the air, and I'd be willing to bet it's closer to 0.00001%, but there's no way to know. The point is that it's as portable as it can be. If you used the Apache config or .htaccess to achieve this you're cutting out portability to the vast array of alternative HTTP servers, so an env-based #! line *is* the best option for portability.

-Stut

--
http://stut.net/

From: Stut <stuttle@xxxxxxxxx>
Date: 24 August 2008 16:16:36 BST
To: "Dotan Cohen" <dotancohen@xxxxxxxxx>
Cc: php-general. <php-general@xxxxxxxxxxxxx>
Subject: Re:  Adding a single php file to .htaccess.


On 24 Aug 2008, at 16:09, Dotan Cohen wrote:
2008/8/24 Stut <stuttle@xxxxxxxxx>:
If you use env then it should be pretty portable. The only other way to do
it would be to specify each script individually

Yes, this is what I want to do, specify each file individually.

or with a regex

No!!! (then I'd have two problems :))

if that's
possible in httpd.conf or .htaccess using a Files section to tell Apache to
execute it with PHP. I don't see that as any more portable.

If would keep the php file portable.

I'm confused. A #! line does not harm the portability of a PHP script in any way whatsoever, and if you use the env version rather than an absolute path then it should work out of the box on 99% of Linux servers and will also work everywhere else because that line will be ignored by the PHP interpreter.

In what way do you think it harms the portability of the PHP file itself?

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux