Re: Automatically adding #! to all PHP scripts
| From: | Jesse Santana | Date: | Thu, 05 Jul 2007 19:45:36 +0000 |
| Subject: | Re: Automatically adding #! to all PHP scripts | ||
| References: | 1 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-18109@lists.php.net to get a copy of this message | ||
Keith,
That's exactly what my testing has shown but I was hoping someone out
there had found a solution that I hadn't thought of. The PHP scripts I am
referring to are spread out all over my /home NFS share. Most of these
scripts belong to different departments with different webmasters most of
which do not like other people touching their code. I guess I'll just
have to inform them of the shebang requirement and see what they think.
Thank you for the input.
Jesse
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
Keith Roberts <keith@karsites.net>
07/05/2007 12:04 PM
Please respond to
Keith Roberts <keith@karsites.net>
To
php-install@lists.php.net
cc
Subject
Re: [PHP-INSTALL] Automatically adding #! to all PHP scripts
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
------------------------------------------------------------