Re: Automatically adding #! to all PHP scripts

From: Date: Thu, 05 Jul 2007 19:02:01 +0000
Subject: Re: Automatically adding #! to all PHP scripts
References: 1 2  Groups: php.install 
Request: Send a blank email to php-install+get-18108@lists.php.net to get a copy of this message
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@lists.php.net From: Jesse Santana <jsantana@csulb.edu> Subject: [PHP-INSTALL] 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 ------------------------------------------------------------

« previous php.install (#18108) next »