[cgiwrap-users] Re: cgiwrap and php?
Brought to you by:
nneul
From: Nathan N. <nn...@um...> - 2000-09-28 12:50:16
|
nicholas cole wrote: > > I've been on cgiwrap's mailing list looking around, and > since i'm just f'n confused about this, i thought i'd ask > you this as a start.. > > can php work with cgiwrap without putting a #! in the > script? > > personaly i don't have any problem putting a #! in my php > scripts, but i have customers that come in with php apps > that have shitloads of individual php scripts, just way too > many to add a #! to.. > > -- > nicholas cole I vaguely remember someone having mentioned making that work. It would be a relatively easy fix in any case - just add some code to cgiwrap before the exec to automatically exec a script using a particular command. Although, I would suggest something like: if ( regular-exec-fails with a file-not-found error or similar ) { check filename if ( filename ends with .php ) { exec same command using php as interpreter } elsif ( filename ends with .pl ) { exec with perl... } else { generate error message } } Unfortunately, that probably would not take into account that scripts without a #! are automatically fed to /bin/sh. You could just do that check+exec before the regular exec, but then there would be no way for a user to run a script using #! that ran with a different perl or different php unless they did some sort of exec in the script itself. I suppose if you had to, you could have cgiwrap open and read the first couple of bytes of the script and only apply the extension/exec check if the script didn't have a #!. -- Nathan ------------------------------------------------------------ Nathan Neulinger EMail: nn...@um... University of Missouri - Rolla Phone: (573) 341-4841 CIS - Systems Programming Fax: (573) 341-4216 |