For Programmers: Free Programming Magazines  


Home > Archive > PHP Installation > July 2007 > Re: [PHP-INSTALL] Automatically adding #! to all PHP scripts









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-INSTALL] Automatically adding #! to all PHP scripts
Keith Roberts

2007-07-03, 7:02 pm

Something like this may do it.

***********
from php.ini

auto_prepend_file string

Specifies the name of a file that is automatically parsed
before the main file. The file is included as if it was
called with the include() function, so include_path is used.

The special value none disables auto-prepending.
***********

So if you add:

#!/usr/local/php5/bin/php

to a file called, say, cgi_start.php

then set that in php.ini with:

auto_prepend_file cgi_start.php


According to the php docs, that should be included at the
start of each file automatically. Never tried it, as I have
no need for it at the moment.

If you are running php as a CLI interpreter, you should
check out the section in the manual on security, when you
have time.

IV. Security
22. Introduction
23. General considerations
24. Installed as CGI binary
25. Installed as an apache module
26. Filesystem Security
27. Database Security
28. Error Reporting
29. Using Register Globals
30. User Submitted Data
31. Magic Quotes
32. Hiding PHP
33. Keeping Current

Also, you might want to look at the apache manual about
using suexec as well.

Kind Regards

Keith Roberts


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
------------------------------------------------------------
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com