Re: Automatically adding #! to all PHP scripts

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



Hi Jesse. It seems that you have a chicken-and-egg problem here. In order for php to process the auto_prepend_file it has to be in php mode already. And to get into php cgi mode
you need the #!/path/to/php-cgi at the top of the script.

So I guess each php file *MUST* start with the #!/path/to/php-cgi to make the script use the php intepreter.

Once the php-cgi script is active, the I guess you can use the auto_prepend_file feature in your php.ini file.

Do you have alot of files to add the #!/path/to/php-cgi to?
Are they all under the same sub directory?

All I can suggest is writing another script to parse all your php scripts you want to add the #!/path/to/php-cgi to, at the start of each of those php scripts.

You might be able to write a bash shell script to do this, or even another php script.

You might find this link on advanced BASH scripting usefull:

http://www.tldp.org/LDP/abs/html/


HTH

Keith


On Tue, 3 Jul 2007, Jesse Santana wrote:

To: php-install@xxxxxxxxxxxxx
From: Jesse Santana <jsantana@xxxxxxxxx>
Subject:  Automatically adding #! to all PHP scripts

I have just finished installing Apache 2.2.4 and PHP 5.2.2 on a Solaris 10 machine. I've compiled PHP to run as a CLI to take advantage of Apache's suexec feature. Everything appears to work just fine but requires me to add in a #!/usr/local/php5/bin/php to all my PHP scripts in order to get
them to execute properly.  Is there a way to get this added into my PHP
scripts automatically?  A php.ini variable perhaps?

Jesse Santana
Project Lead - Enterprise Services Group
Information Technology Services
California State University, Long Beach
1250 Bellflower Blvd.
Long Beach, CA  90840
Office: (562)985-8511
Fax:     (562)985-8855


------------------------------------------------------------
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

This email address is challenge-response protected with
http://www.tmda.net
------------------------------------------------------------

[Index of Archives]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [Postgresql]     [PHP Books]     [PHP Databases]     [PHP SOAP]
  Powered by Linux