Re: Windows PHP/Apcahe config question - #! vs. extensions in registry
<jeff@evansdata.com> wrote in message
news:1102641174.903636.298610@z14g2000cwz.googlegr oups.com...[color=blue]
> I am developing in PHP on a Windows environment but deploying to a *nix
> flavor.
>
> I would like to use the extension recognition in Apache in my local
> environment for cgi, and have set the "ScriptInterpreterSource" value
> to "registry" in my Apache config. That said, I need the "#!" line in
> my scripts so when I upload them to their "live" directory, the server
> can find the php executable.
>
> When I try to run a script locally that has the "#!" line first,
> however, I am given this output and warning:
>
> #!/usr/bin/php4
> "Warning: Cannot modify header information - headers already sent by
> (output started at..." etc.
>
> It seems Apache gleefully delivers the first "#!" line as content. Is
> there any way, other than stripping this line, to avoid this? Or do I
> need to go back to the old Unix style config, "ScriptInterpreterSource
> script"?
>
> -Jeff[/color]
Use an auto_prepend file and an auto_append file. In the former, turn on
output buffering with a call to ob_start(). In the latter, strip off the #!
line from the captured output with preg_replace() and echo it.
Both settings are in php.ini. |