Re: Automatically adding #! to all PHP scripts

From: Date: Tue, 03 Jul 2007 22:02:46 +0000
Subject: Re: Automatically adding #! to all PHP scripts
References: 1  Groups: php.install 
Request: Send a blank email to php-install+get-18106@lists.php.net to get a copy of this message
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 ------------------------------------------------------------

« previous php.install (#18106) next »