Jump to content

Recommended Posts

I have compiled Apache 2.2.4 and PHP 5.2.2 on a Solaris 10 machine successfully.  I've compiled PHP as a CLI to take advantage of Apache's suexec feature.  I am now able to successfully run a PHP script as a CLI as long as I add in a #!/usr/local/php5/bin/php line to the beginning of my script.  Since I have a lot of scripts that do not have this shebang entry, I am looking for a way to avoid having to change each and every script.  Does anyone know of a way that I can modify my configuration so that the shebang is automatically inserted when a PHP file is called by Apache?

It would be easy enough to prepend the shebang into all your php files using bash.

 

for f in $(/bin/ls *.php) ; do echo -e '#!/usr/local/php5/bin/php\n'$(cat $f) > $f ; done

 

Getting it to recurse through directories might be a little more work though.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.