[PHP] php-cgi limitations
Can anyone offer or point me to a summary of differences between running php as an Apache module vs as a cgi executable? Specifically, I'm wanting to upgrade our servers to php 5 but there is one crucial third-party app we're using that still needs php 4, so I'm hoping I can run just that app under php 4 cgi until the vendor updates to support php 5. Google is unusually laconic on this, but perhaps I just offended it with too many daft queries on the subject... :) -- Max Schwanekamp http://www.neptunewebworks.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP CGI Security
Hi all, ok, I have come up with an architecture to offer PHP to customers as a CGI, and want to get some opinions to make sure I'm not missing any glaring holes... I've decided to use suPHP to fork off PHP CGI scripts as the user and group. It seems to work pretty well, and I have tweaked suPHP (i.e. hacked the source) to force a particular GID as the group that is different than the web server group. I have also forced a chroot to a jailed filesystem in which they have access to the php libraries just like they would on a real system. So here's the gist of it : 1) For arguments sake, lets say that Apache is running as user www and group www. 2) Each user has their own user ID and all files in their directories are group www, allowing apache to serve all of their web data. 3) When suPHP is invoked, it changes the script to user u1234 and group www2, and jails the script to /jail 4) Because the user directories are shared across NFS, the users structure (and all other users structures) are also mounted in the /jail 5) Because the users PHP script is running as user u1234 and group www2, it has no access to any of the other users data. 6) All directories within a users space are in group www and have the group sticky bit turned on, so that any files created will get created with the www group and not the www2 group. This will allow any files the user creates in their own directories to be read by apache. 7) I have created an auto_prepend_file that sets the session.save_path ini variable to a local directory within the users account so that session files are not in a place that can be read by anyone else. 8) Safe mode is disabled to allow users to be able to use PHP scripts that need safe mode to be turned off. 9) In the /jail area, all unnecessary binaries have been removed (things like ifconfig, mount, and dev stuff) to make it more secure, but useful binaries were left for scripts to use (things like ls, rm, etc...) Does anyone see any glaring holes in this model ??? Thanks, Tim. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP CGI Variables
Hi all, ok, I want to re-post this so that more people might see it, cause there has to be an answer somewhere... When using the GCI version of PHP with apache, I need to be able to set some of the php_admin_values that normally get set in the php.ini file on the fly... Since I am not using mod_php, the solutions already given to me of setting php_admin_values in Directory sections or .htaccess files simply doesn't work, cause apache doesn't have any idea what they are. I am trying to avoid having to have separate php.ini files for every virtual host, as I only want to set a few convenience parameters. Besides PHPRC, does the CGI version of the PHP binary read in any other environment variables ? Cause it would be easy enough to set an environment variable to be passed to PHP for those settings. There's got to be someone out there that has done this, or wants to do this. I'm tempted to start looking at the code base and seeing if a simple patch will allow me to do that, but I want to make sure I'm not missing anything... Any PHP Guru's out there ??? Thanks, Tim. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP-CGI: custom 404 error?
I'm running PHP as CGI instead of as an apache module because my hosting 1) suggests it and 2) this way I can compile my own PHP with whatever options I want, including a custom php.ini. Works great except when I load a page that doesn't exist, such as foo.php, I get No input file specified. Instead of the standard 404 error. Is there a way to customize this? I've read about it and the consensus is that you can't. I don't understand why not, though. Wouldn't it be easy to add a custom 404 error page via php.ini or something? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-CGI: custom 404 error?
Jared wrote: foo.php, I get No input file specified. Instead of the standard 404 error. Is there a way to customize this? Easy with Apache [1,2], with en ErrorDocument [1] directive. Ex with this in a .htaccess (the FileInfo Override [3] is required) containing this line: ErrorDocument 404 /Lame_excuses/not_found.html I've read about it and the consensus is that you can't. Upgrade consensus :) Wouldn't it be easy to add a custom 404 error page via php.ini or something? Easy with Apache (.htaccess or httpd.conf). Ok, not via php.ini. Christophe [1] ErrorDocument directive http://httpd.apache.org/docs/mod/core.html#errordocument [2] Using XSSI and ErrorDocument to configure customized international server error responses http://httpd.apache.org/docs/misc/custom_errordocs.html [3] AllowOverride directive http://httpd.apache.org/docs/mod/core.html#allowoverride -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP cgi
There used to be a way that stripped something from a PHP binary that drastically reduced the size of the cgi file. For the life of me, I can't remember and can't find it on google anywhere. Anyone know what it is? TIA, Steve
Re: [PHP] PHP cgi
* Thus wrote Steve Douville: There used to be a way that stripped something from a PHP binary that drastically reduced the size of the cgi file. For the life of me, I can't remember and can't find it on google anywhere. Anyone know what it is? You're looking for the 'strip' command Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP cgi
Found lots of stuff under google PHP Obfuscate. Unless you have compiler, php is source, and obfuscators seem to be directed at making things both compact and hard to hack. On the other hand, if you have a compiler, ignore this. Warren Vail -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Friday, July 02, 2004 3:38 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP cgi * Thus wrote Steve Douville: There used to be a way that stripped something from a PHP binary that drastically reduced the size of the cgi file. For the life of me, I can't remember and can't find it on google anywhere. Anyone know what it is? You're looking for the 'strip' command Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-cgi+suexec and fastcgi
Hi there we need to run php under another user account as we are setting up a link with it to Qmail. Our plan is to use: php-cgi+suexec for this. fastcgi may be an alternative and we are just wondering if there is anything bad about using fastcgi for this? Any help appreciated Thanks Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-cgi+suexec and fastcgi
Hi there we need to run php under another user account as we are setting up a link with it to Qmail. Our plan is to use: php-cgi+suexec for this. fastcgi may be an alternative and we are just php-cgi+wondering if there is anything bad about using fastcgi for this? Any help appreciated Thanks Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php cgi, apache suexec, filesystem problems
Hi, I am having a lot of problems with any PHP routines that have to access the filesystem - things like exec(), shell_exec(), system(), backticked shell commands, copy(), move_uploaded_file() and so on. I have a non-standard setup with CLI, CGI and mod_php all installed. These scripts are using the cgi php executable and the webserver is running suexec. I have confirmed that it isn't permissions issues both by running identical commands to those in the scripts from the uid in use by the suexec'd apache virtual host, and by blowing open permissions to 777 temporarily. No difference. Example code from the manual also fails. Before I post a specific example to see if anyone can spot a problem in my code, does anyone know whether there's a fundamental problem with my server setup? TIA. PWR. FreeBSD 4.9-STABLE #/usr/local/bin/php -v PHP 4.3.4 (cgi) (built: Feb 28 2004 13:43:25) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies #tail /var/log/httpd-error.log [Wed May 19 10:34:43 2004] [notice] Apache/1.3.29 (Unix) mod_perl/1.28 PHP/4.3.4 mod_ssl/2.8.16 OpenSSL/0.9.7c configured -- resuming normal operations [Wed May 19 10:34:43 2004] [notice] suEXEC mechanism enabled (wrapper: /usr/local/sbin/suexec) [Wed May 19 10:34:43 2004] [notice] Accept mutex: flock (Default: flock) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php cgi
Hi, I have here a problem for having the php-cgi binary in linux. I compiled php with php-cli and php-cgi but after installation i can't find the php-cgi binary, i only have the php-cli under /usr/local/bin/. Any idea why? Please help.. here's what i've did: './configure' '--with-mysql' '--with-apache=../apache_1.3.27' '--with-gd' '--with-jpeg-dir=ext/gd/libgd' '--with-zlib' '--with-cgi' '--enable-cli' '--enable-sockets' '--enable-pcntl' make make install Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php cgi configuration w/ htaccess
My ISP hosted website uses the php apache module version, but I'm trying to use php cgi version for the part of my site edit application that actually creates and edits files on the site. This will avoid all the permision and chmod hassle when php tries to create and edit files. My ISP has placed a php cgi binary in my home directory so it can run as my user id. I've never used php cgi version, and all the httacces configuration I've tried to map .phpc files to the php cgi binary hasn't worked right. I need an example htacces file or an example of a script header line with php location. drew
Re: [PHP] php cgi configuration w/ htaccess
* Thus wrote Andrew Warner ([EMAIL PROTECTED]): I've never used php cgi version, and all the httacces configuration I've tried to map .phpc files to the php cgi binary hasn't worked right. I need an example htacces file or an example of a script header line with php location. With cgi you don't map the file to the php cgi binary. You have to set up a directory with a 'Script-Alias' directive to point to a paticular folder for running files as cgi. Hopefully this is already done and there is a cgi-bin outside your web tree. See apache's documentation on doing this. Once you have the cgi-bin set up you put your php file in the cgi-bin with the top of the php file with something like: #!/path/to/your/home/php ?php echo hello worldbr\n; ? Set this file permission bit to be executable and it should all work. All of this is done from memory so a bit might be a bit off but some searching the archives and google'in will help out. HTH, Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI mode and command line variables
That worked like a charm. Thanks Chris. I've added this to my snippet collection. :) At 12:02 AM 7/24/2003, Chris Shiflett wrote: --- CDitty [EMAIL PROTECTED] wrote: Thanks man. That got rid of the error, however it is not using the variable in the script. You have to read them in. I think you can just loop through $argv, so something like this will show you what PHP is receiving: ? echo A total of $argc parameters are available:\n\n; foreach ($argv as $curr_parameter) { echo $curr_parameter\n; } ? Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP CGI mode and command line variables
I have written a script that runs fine when I run it via the command line. However, when I tack on variables to the command line, I get an error. This works. php -q ./import.php This doesn't php -q ./import.php?feed=eastwood This is the error that it returns - Could not open input file: ./import.php?feed=eastwood Can anyone offer any advice for making this work? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI mode and command line variables
--- CDitty [EMAIL PROTECTED] wrote: I have written a script that runs fine when I run it via the command line. However, when I tack on variables to the command line, I get an error. This works. php -q ./import.php This doesn't php -q ./import.php?feed=eastwood I might be wrong, but I don't think it's possible to simulate GET or POST from the command line like that. I always have a shell script perspective and pass things in as arguments like this: ./import.php --feed=eastwood Of course, if it's under document root, you can test from the command line using wget. Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI mode and command line variables
Thanks man. That got rid of the error, however it is not using the variable in the script. I can't run this via wget or the browser since the importing files are rather large. Any other ideas? Chris At 11:33 PM 7/23/2003, Chris Shiflett wrote: --- CDitty [EMAIL PROTECTED] wrote: I have written a script that runs fine when I run it via the command line. However, when I tack on variables to the command line, I get an error. This works. php -q ./import.php This doesn't php -q ./import.php?feed=eastwood I might be wrong, but I don't think it's possible to simulate GET or POST from the command line like that. I always have a shell script perspective and pass things in as arguments like this: ./import.php --feed=eastwood Of course, if it's under document root, you can test from the command line using wget. Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI mode and command line variables
--- CDitty [EMAIL PROTECTED] wrote: Thanks man. That got rid of the error, however it is not using the variable in the script. You have to read them in. I think you can just loop through $argv, so something like this will show you what PHP is receiving: ? echo A total of $argc parameters are available:\n\n; foreach ($argv as $curr_parameter) { echo $curr_parameter\n; } ? Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php cgi question
Without seeing your code... only one guess: what are the permissions on the file like? When you're running the script from the web server, you're running it as the user under which the web server is running (usually nobody or apache if you're using Apache on Linux), and this causes problem if that particular user doesn't have access to the file. There are very few solutions to this problem (at least as far as I know). One is the suexec module for Apache, that lets you impersonate root or another user, but you have to be *extremely* careful with the permissions. The other is to change the default permissions of the file so that everyone can delete and modify it, but that might not work well for your needs. Yet a third one would be to impersonate directly from PHP, for example through a call to su, but there are pitfalls there as well. Hope this helps. On Sun, 2002-10-13 at 02:37, David Cook wrote: Hi all, Got a question regarding using php scripts as cgi's. What I am trying to do is this. (ya may need a bit of background, it gets a little complicated... well for me its complicated) Im building a web based email system using php (duh) as the front end and glue for everything, part of it is using a program called getmail to retreive remote pop accounts to the virtual accounts on the server (its all virtual using qmail/vpopmail and courier-imap). The various setttings for this are in a file called getmailrc, in the virtual users home dir, (this will also be theoretically relevant when I try and do the same thing with a server side filtering program called maildrop.. but one at a time I reckon :)) ie. /home/vpopmail/domains/some.email.domain/someuser/.getmail/getmailrc This file is owned specifically by a user/group otherwise getmail wont work ie: -rw-r--r--1 vpopmail vchkpw585 Sep 29 07:16 getmailrc any permissions other than this will tweak getmails internal security and stop it. I decided to minimise security problems and use mysql as an intermidiary storage for any rules created for getmail, which works fine. :) (yay me.. lol) NOW comes the problem, I need to write (overwrite) that getmailrc file after the user has finished messing with their settings, to do this I decided that since the file can only be read/written to by the vpopmail/vchkpw user/group, that I would knock up a php script to run as a cgi, that would do only one thing: Upon a button being pressed to 'finish edit' the new rules would be written to the mysql table, then the cgi would be invoked with a particular identifier so that it could then look up the mysql table (using that identifier so it gets the right rows), and following some rules inbuilt, write out the getmailrc file with that restrictive permissions set. I wrote up a script that was just for POC, that would get the data for where that file was supposed to be (the /home/vpopmail/etc...etc) and read it, then break out the various details and display it, basically just showing me what was already in the file. (using the shebang method, as my php cgi interpreter is OUTSIDE the web tree, but thats another story of getting the damn thing to work at all... damn RPM'S sometimes... that --enable-force-redirect had me stuck for a few days) When I tested it out from the shell, using ./getmailtest.cgi as root, it worked, in that it did what it was sposed to.. display the contents of the getmailrc file. This cgi php script is owned by vpopmail/vchkpw which should allow reading the file as said above Great, thought I, and proceeded to attempt linking to it from within the editing script, using both an attempt with a 'submit' button and a click through link. Now comes the prob, it fails, with an error of being unable to either open the file, or that the file doesnt exist (depending on what I fiddle with in the script). Would anyone have any ideas as to what may be going wrong here? I havent tried doing this before, using php as a cgi to do stuff to files on the system, so I am at quite a loss, and any help would be appreciated. Regards David Cook -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php cgi question
Hi Marco Thanks for the tips, they were what I was thinking was the problem, that even when the php cgi was owned by the correct user, that if it was being called via another web based script, that it would be executed as apache (in this case) rather than the actual owner of the cgiscript (vpopmail/vchkpw), the same ower/group as the target file. I had thought that if I used setuid/gid on the cgi script that it would execute as that user, rather than apache tho. I didnt want to waste even more bandwidth by posting the code and all the other details, I had hoped I had provided enough for some educated guesses which may have led me to a solution, or what details to provide to help in a solution As I said, this was the first time I had attempted this precise situation (that of executing a script as another user other than the web server), I cant change the permissions on the getmailrc file, or the getmail program wont read it, a bit of a catch 22 :( it seems. Without seeing your code... only one guess: what are the permissions on the file like? The actual php cgi??? its [root@alpha cgi-bin]# ls -lA get* -rwxrwxr-x1 root root 6107 Oct 13 00:44 getmailtest.cgi but I have messed with it, trying different combos including vpopmail:vchkpw (the target file owner) all set as world executable the permissions on the getmailrc file (the target file) are in my original post but to show it again, it is -rw-r--r--1 vpopmail vchkpw585 Sep 29 07:16 getmailrc When you're running the script from the web server, you're running it as the user under which the web server is running (usually nobody or apache if you're using Apache on Linux), and this causes problem if that particular user doesn't have access to the file. which is why I thought (stressing thought.. like I said.. Ive never tried this approach before) that the setuid/gid may have been the solution, although testing did appear to indicate that it was executed as the web server user when it is accessed via a click or button from the web, ignoring the setuid etc...Like I was saying I may be trying somethign that is really tough, but basically I wanted to partition out the part of the process that may have security implications, and just pass a single variable to it, executing it on demand, rather than via cron (though it does work via cron.. its not the best solution in my case.. but may be one I have to look at) There are very few solutions to this problem (at least as far as I know). One is the suexec module for Apache, that lets you impersonate root or another user, but you have to be *extremely* careful with the permissions. The other is to change the default permissions of the file so that everyone can delete and modify it, but that might not work well for your needs. Yet a third one would be to impersonate directly from PHP, for example through a call to su, but there are pitfalls there as well. Even though I would reallyyy prefer NOT to go anywhere near su (cause security is my primary focus in splitting out any file system writes to a separate process) how would using su help out??? I havent done that either so far (have never run into a situation like this before) Thanks again for the reply... I will keep working on it.. and post back if I get any further Regards David Cook -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php cgi question
Hi all, Got a question regarding using php scripts as cgi's. What I am trying to do is this. (ya may need a bit of background, it gets a little complicated... well for me its complicated) Im building a web based email system using php (duh) as the front end and glue for everything, part of it is using a program called getmail to retreive remote pop accounts to the virtual accounts on the server (its all virtual using qmail/vpopmail and courier-imap). The various setttings for this are in a file called getmailrc, in the virtual users home dir, (this will also be theoretically relevant when I try and do the same thing with a server side filtering program called maildrop.. but one at a time I reckon :)) ie. /home/vpopmail/domains/some.email.domain/someuser/.getmail/getmailrc This file is owned specifically by a user/group otherwise getmail wont work ie: -rw-r--r--1 vpopmail vchkpw585 Sep 29 07:16 getmailrc any permissions other than this will tweak getmails internal security and stop it. I decided to minimise security problems and use mysql as an intermidiary storage for any rules created for getmail, which works fine. :) (yay me.. lol) NOW comes the problem, I need to write (overwrite) that getmailrc file after the user has finished messing with their settings, to do this I decided that since the file can only be read/written to by the vpopmail/vchkpw user/group, that I would knock up a php script to run as a cgi, that would do only one thing: Upon a button being pressed to 'finish edit' the new rules would be written to the mysql table, then the cgi would be invoked with a particular identifier so that it could then look up the mysql table (using that identifier so it gets the right rows), and following some rules inbuilt, write out the getmailrc file with that restrictive permissions set. I wrote up a script that was just for POC, that would get the data for where that file was supposed to be (the /home/vpopmail/etc...etc) and read it, then break out the various details and display it, basically just showing me what was already in the file. (using the shebang method, as my php cgi interpreter is OUTSIDE the web tree, but thats another story of getting the damn thing to work at all... damn RPM'S sometimes... that --enable-force-redirect had me stuck for a few days) When I tested it out from the shell, using ./getmailtest.cgi as root, it worked, in that it did what it was sposed to.. display the contents of the getmailrc file. This cgi php script is owned by vpopmail/vchkpw which should allow reading the file as said above Great, thought I, and proceeded to attempt linking to it from within the editing script, using both an attempt with a 'submit' button and a click through link. Now comes the prob, it fails, with an error of being unable to either open the file, or that the file doesnt exist (depending on what I fiddle with in the script). Would anyone have any ideas as to what may be going wrong here? I havent tried doing this before, using php as a cgi to do stuff to files on the system, so I am at quite a loss, and any help would be appreciated. Regards David Cook -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php cgi question
Hi David-- If that is the issue then I would suggest looking into the suexec module for Apache...as long as you're very careful with the permissions, you should be fine! Also, my reference to the code was more a caveat than anything else. In your case, if the script was working from the sell, imho you made a good decision not to post the source, since the problem was clearly somewhere else. Marco On Sun, 2002-10-13 at 11:20, David Cook wrote: Hi Marco Thanks for the tips, they were what I was thinking was the problem, that even when the php cgi was owned by the correct user, that if it was being called via another web based script, that it would be executed as apache (in this case) rather than the actual owner of the cgiscript (vpopmail/vchkpw), the same ower/group as the target file. I had thought that if I used setuid/gid on the cgi script that it would execute as that user, rather than apache tho. I didnt want to waste even more bandwidth by posting the code and all the other details, I had hoped I had provided enough for some educated guesses which may have led me to a solution, or what details to provide to help in a solution As I said, this was the first time I had attempted this precise situation (that of executing a script as another user other than the web server), I cant change the permissions on the getmailrc file, or the getmail program wont read it, a bit of a catch 22 :( it seems. Without seeing your code... only one guess: what are the permissions on the file like? The actual php cgi??? its [root@alpha cgi-bin]# ls -lA get* -rwxrwxr-x1 root root 6107 Oct 13 00:44 getmailtest.cgi but I have messed with it, trying different combos including vpopmail:vchkpw (the target file owner) all set as world executable the permissions on the getmailrc file (the target file) are in my original post but to show it again, it is -rw-r--r--1 vpopmail vchkpw585 Sep 29 07:16 getmailrc When you're running the script from the web server, you're running it as the user under which the web server is running (usually nobody or apache if you're using Apache on Linux), and this causes problem if that particular user doesn't have access to the file. which is why I thought (stressing thought.. like I said.. Ive never tried this approach before) that the setuid/gid may have been the solution, although testing did appear to indicate that it was executed as the web server user when it is accessed via a click or button from the web, ignoring the setuid etc...Like I was saying I may be trying somethign that is really tough, but basically I wanted to partition out the part of the process that may have security implications, and just pass a single variable to it, executing it on demand, rather than via cron (though it does work via cron.. its not the best solution in my case.. but may be one I have to look at) There are very few solutions to this problem (at least as far as I know). One is the suexec module for Apache, that lets you impersonate root or another user, but you have to be *extremely* careful with the permissions. The other is to change the default permissions of the file so that everyone can delete and modify it, but that might not work well for your needs. Yet a third one would be to impersonate directly from PHP, for example through a call to su, but there are pitfalls there as well. Even though I would reallyyy prefer NOT to go anywhere near su (cause security is my primary focus in splitting out any file system writes to a separate process) how would using su help out??? I havent done that either so far (have never run into a situation like this before) Thanks again for the reply... I will keep working on it.. and post back if I get any further Regards David Cook -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP CGI versus Module
We have some cases where we run PHP as a standalone executable for scripting certain processes that can be called from CRON, and we also have PHP for Apache. Does the php.ini affect both? Specifically script times? Only if you compiled it with the exact same settings for that one --xxx-dir I can't think of right now... Just use ?php phpinfo();? for both and search (grep) for php.ini in the output. You'll find out what you need to know. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php cgi problem on RH linux
Hi, I have a RH 7.2 server with php 4.1.2 installed as a CGI. I'm trying to run this script #!/usr/local/phpcgi/bin/php -q ? print hello; ? I get this as output: [root@dev bin]# ./test.php Error in argument 1, char 3: option not found Error in argument 1, char 3: option not found Usage: php [-q] [-h] [-s [-v] [-i] [-f file] | {file [args...]} etc if I remove the -q (ie first line #!/usr/local/phpcgi/bin/php) I get: [root@dev bin]# ./test.php bash: ./test.php: No such file or directory PHP seems to be OK : [root@dev bin]# /usr/local/phpcgi/bin/php -m Running PHP 4.1.2 Zend Engine v1.1.1, Copyright (c) 1998-2001 Zend Technologies [PHP Modules] xml standard session posix pcre mysql imap [Zend Modules] Not Implemented The same script works fine on another server (with a different path to php) so, not being a Linux guru I'm stuck at this point. The script's permissions are set to 755. Any help would be great! Many thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP CGI cannot be accessed directly
Yes I have set cgi.force_redirect=0 in my php.ini file. I have trippled checked this! I am running PHP 4.2.0 on Win2K IIS5 as CGI. What am I missing? Any known bugs? Tx MH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP-CGI and script files not found
Can someone confirm the following that was sent to me by my hosting provider. If have php script file that can not be found throwing 500 errors instead of 404 errors. ~~ Because PHP-CGI is a little strange, you (as far as I know) apparently can't set up any sort of custom 404 error for it. PHP-CGI works like this: When Apache gets a request for a filename ending in .pcgi, it sends that URL to a system-wide alias to a global PHP binary (which itself is just a CGI script). When you send this global PHP binary the URL of another script, that PHP binary takes the filename you sent it and attempts to interpret it as a PHP script. However, because the file you're sending the PHP binary doesn't exist, there's nothing for PHP to do, and it just quits. Hence, you get a 500 error (because the systemwide PHP binary didn't spit anything out). Because Apache immediately sends the file.pcgi to the systemwide PHP binary, there's no way for it to check if the file exists. If you can find a workaround we can implement, we'll gladly do it, but I've looked and to the best of my knowledge, there's no way around this. Sorry about this! ~~~ Thanks, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI
Who knows? It might. Its use is growing rapidly, and it's much easier to learn. A few years ago the prospect would have been unthinkable, due to the vastly greater supply of Perl CGI web apps and free libraries in circulation. These days the advantage is not so strong. And PHP is far better optimized for the specific task of web application development. Yes, but still Perl's CPAN is far more filling than PEAR is, for the moment at least. So until PEAR takes off bigtime, PERL will have a very strong card in its favor. cheers, --thalis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI
On Sunday, March 17, 2002, at 10:07 PM, David Duong wrote: Can PHP be considered CGI? Would PHP replace Perl as the main language of CGI? Unless you are specifically referring to Common Gateway Interface, the term CGI should be deprecated in favor of the term server-side scripting language. It's easier to say CGI, but you refer to something very specific when you do. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP CGI
simple answer - yes and possibly I believe, anything that's run on a server to output stuff to a browser, can be considered a CGI program The second question is like asking - Will COBOL ever become obsolete? - maybe, possibly, but there'll, no doubt, be someone, somewhere still using it. -Original Message- From: David Duong [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 2:08 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP CGI Can PHP be considered CGI? Would PHP replace Perl as the main language of CGI? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI
On Sun, 17 Mar 2002, David Duong wrote: Can PHP be considered CGI? Sometimes. CGI is a standardized interface between web servers and backend applications. PHP can communicate with web servers using that mechanism, but it doesn't have to (depends on the web server in use). I think the problem here is that you're not asking the question you think you're asking. Unfortunately, I'm not sure what you're really trying to figure out. Would PHP replace Perl as the main language of CGI? Who knows? It might. Its use is growing rapidly, and it's much easier to learn. A few years ago the prospect would have been unthinkable, due to the vastly greater supply of Perl CGI web apps and free libraries in circulation. These days the advantage is not so strong. And PHP is far better optimized for the specific task of web application development. On the other hand, Perl is in the abstract a more powerful language. So many programmers will continue to prefer it. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI
I mean any time you hear the word CGI it is rarely referring to PHP, always Perl (My most comfortable Web language). You'd think that CGI only refers to Perl. If you goto a site and download scripts under category CGI you would be downloading Perl scripts, PHP has its own category. Should CGI still mainly Perl even though PHP is somewhat easier, quicker thus easier suited for CGI. I think the meaning of CGI is quite blured. Anyone else think so? [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Sun, 17 Mar 2002, David Duong wrote: Can PHP be considered CGI? Sometimes. CGI is a standardized interface between web servers and backend applications. PHP can communicate with web servers using that mechanism, but it doesn't have to (depends on the web server in use). I think the problem here is that you're not asking the question you think you're asking. Unfortunately, I'm not sure what you're really trying to figure out. Would PHP replace Perl as the main language of CGI? Who knows? It might. Its use is growing rapidly, and it's much easier to learn. A few years ago the prospect would have been unthinkable, due to the vastly greater supply of Perl CGI web apps and free libraries in circulation. These days the advantage is not so strong. And PHP is far better optimized for the specific task of web application development. On the other hand, Perl is in the abstract a more powerful language. So many programmers will continue to prefer it. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP CGI
I think the meaning of CGI is quite blured. Anyone else think so? I think the the meaning of CGI (Common Gateway Interface) has lost it's meaning by a lot of people who just hear the acronym and not the full phrase. It's like the term PC - when people hear that, they almost straight away think IBM/IBM Compats, but, as all of you should know, there's MANY other types of PC around the place, not just IBM/IBM Compats. Same goes for CGI programs. -Original Message- From: David Duong [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002 3:47 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP CGI I mean any time you hear the word CGI it is rarely referring to PHP, always Perl (My most comfortable Web language). You'd think that CGI only refers to Perl. If you goto a site and download scripts under category CGI you would be downloading Perl scripts, PHP has its own category. Should CGI still mainly Perl even though PHP is somewhat easier, quicker thus easier suited for CGI. I think the meaning of CGI is quite blured. Anyone else think so? [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Sun, 17 Mar 2002, David Duong wrote: Can PHP be considered CGI? Sometimes. CGI is a standardized interface between web servers and backend applications. PHP can communicate with web servers using that mechanism, but it doesn't have to (depends on the web server in use). I think the problem here is that you're not asking the question you think you're asking. Unfortunately, I'm not sure what you're really trying to figure out. Would PHP replace Perl as the main language of CGI? Who knows? It might. Its use is growing rapidly, and it's much easier to learn. A few years ago the prospect would have been unthinkable, due to the vastly greater supply of Perl CGI web apps and free libraries in circulation. These days the advantage is not so strong. And PHP is far better optimized for the specific task of web application development. On the other hand, Perl is in the abstract a more powerful language. So many programmers will continue to prefer it. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP CGI
On Sun, 17 Mar 2002, David Duong wrote: I mean any time you hear the word CGI it is rarely referring to PHP, always Perl (My most comfortable Web language). You'd think that CGI only refers to Perl. Back in the day, CGI repositories had a greater representation of programs written in C and other hardcore languages. As web servers became more available, the center of gravity of CGI development moved toward more accessible languages, such as Perl (along with shell scripts, Python, TCL, etc.). If you goto a site and download scripts under category CGI you would be downloading Perl scripts, PHP has its own category. One reason for this is that PHP is not necessarily CGI. The typical high-performance PHP installation is running as either a static or dynamic module linked into Apache through that web server's proprietary interface. For all these people, CGI has nothing to do with it. In point of fact, many people also run Perl in similar fashions (such as mod_perl), in which case CGI is also out of the equation. But by the time this became common, Perl web development had already developed a strong connection to the term CGI. Should CGI still mainly Perl even though PHP is somewhat easier, quicker thus easier suited for CGI. People should do their development any way they feel comfortable. Once again, though, you're confusing CGI, which is a specific interface, with server-side web application development in general. I think the meaning of CGI is quite blured. Anyone else think so? Yes, the term is very often misused and has come to be misconstrued as referring to things that have nothing to do with CGI. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php- cgi
I have a script that when I execute via a browser retrieves information. Ultimately I want this automated. There has been mention on these lists about compliling php as cgi, which I think may help This also may help out with some timeout issues that arise. can anyone point me in the right direction to a tutoria; or something about this subject Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php- cgi
Hi Caspar, @ 10:54:13 AM on 11/21/01, Caspar Kennerdale wrote: I have a script that when I execute via a browser retrieves information. Ultimately I want this automated. There has been mention on these lists about compliling php as cgi, which I think may help By automated do you mean with something like cron? ./configure php without using apxs or apache. That will build it as a stand alone executable which you can call from a shell or from cron. If you need it as a cgi also, you'd configure it pretty much the same way you'd configure a cgi-bin for perl-cgi scripts, but I don't know if running php as an apache module AND as a cgi is going to fly. This also may help out with some timeout issues that arise. Search this page for max_execution_time: http://www.php.net/manual/en/configuration.php -- -Brian Clark | PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] php- cgi
yes ideally with cron- I know nothing about it really other than a little bit i've read- but my isp says they can execute a perl file and not a php file via cron. I was interested to see whether or not compliing as a cgo would circumnavigate this- but i'm as much in the dark about that. I have tried executing my script via autmotaing windows which didnt work really as it was reliiant on the internet connection as opposed to the servers connection- and timing out problems occurred. I am rewriting parts to include fsockopen instead of file which will help but doesnt solve the automation issue thanks -Original Message- From: Brian Clark [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 21, 2001 16:04 To: PHP is not a drug. Subject: Re: [PHP] php- cgi Hi Caspar, @ 10:54:13 AM on 11/21/01, Caspar Kennerdale wrote: I have a script that when I execute via a browser retrieves information. Ultimately I want this automated. There has been mention on these lists about compliling php as cgi, which I think may help By automated do you mean with something like cron? ./configure php without using apxs or apache. That will build it as a stand alone executable which you can call from a shell or from cron. If you need it as a cgi also, you'd configure it pretty much the same way you'd configure a cgi-bin for perl-cgi scripts, but I don't know if running php as an apache module AND as a cgi is going to fly. This also may help out with some timeout issues that arise. Search this page for max_execution_time: http://www.php.net/manual/en/configuration.php -- -Brian Clark | PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php- cgi
Hi Caspar, @ 11:11:25 AM on 11/21/01, Caspar Kennerdale wrote: yes ideally with cron- I know nothing about it really other than a little bit i've read- but my isp says they can execute a perl file and not a php file via cron. ISP's can be strange about that stuff, but it's understandable sometimes. Try compiling a php executable for yourself in your home directory and running it from cron and see if that gets around it. (If the sysadmin finds out he might give you the boot though.) man 5 crontab (if you have shell access) Might not work that way either, depending on the sysadmin. -- -Brian Clark | PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] php- cgi
Thanks I'll give it a go -Original Message- From: Brian Clark [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 21, 2001 16:26 To: PHP is not a drug. Subject: Re: [PHP] php- cgi Hi Caspar, @ 11:11:25 AM on 11/21/01, Caspar Kennerdale wrote: yes ideally with cron- I know nothing about it really other than a little bit i've read- but my isp says they can execute a perl file and not a php file via cron. ISP's can be strange about that stuff, but it's understandable sometimes. Try compiling a php executable for yourself in your home directory and running it from cron and see if that gets around it. (If the sysadmin finds out he might give you the boot though.) man 5 crontab (if you have shell access) Might not work that way either, depending on the sysadmin. -- -Brian Clark | PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php- cgi
Brian Clark wrote: way you'd configure a cgi-bin for perl-cgi scripts, but I don't know if running php as an apache module AND as a cgi is going to fly. PHP as both CGI and Module on the same box works just fine. In fact, using multiple mime types and file extensions, you can have as many different versions and compilation options of PHP as a CGI as you like. I did this once to track down a bug that was version-dependent. Had PHP 3.0.4, PHP 3.0.5, PHP 3.0.6, PHP 3.0.7 etc all running using .php304 .php305 .php306, .php307 etc as the filenames and a different AddType mime-type and Action for each. If *I* can get this to work, anybody can :-) -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php- cgi
At 03:54 PM 11/21/2001 +, Caspar Kennerdale wrote: I have a script that when I execute via a browser retrieves information. Ultimately I want this automated. There has been mention on these lists about compliling php as cgi, which I think may help I saw the following somewhere and saved it, but I can't remember where I got it from. I haven't tested it either, but I can't see why it wouldn't work if you have either of these programs available in conjunction w/cron: ...If you don't have php installed as CGI you can use a unix console program for fetching URLs, we recommend lynx or wget. Example of using lynx: 0 10 * * * lynx -dump http://fsck.dk/script.php /dev/null Example of using wget: 0 10 * * * wget http://fsck.dk/script.php /dev/null -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP CGI
i have .htaccess on root of my web: ErrorDocument 400 /e.php ErrorDocument 401 /e.php ErrorDocument 403 /e.php ErrorDocument 404 /e.php ErrorDocument 500 /e.php When i try get via http an nonexisten html document : noneasdfaasd.html i got result of e.php script. When i try to get nonexisten dfsdfksf.php i got Internal Server Error of Apache ,- not result of working e.php .. Any suggestions , why it happens? Arsen Kiriilov http://www.softm.h1.ru/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP/CGI problem: #!/path/php at top of CGI script appears in output
Nope it fails when he removes the line. It fails on me as well, I tried it. Also note I did say that the ouput of phpinfo() was correct. The output showed the page had been handled by the php cgi binary, not the module. The module has a large config line and several extensions configured in, the cgi binary was compiled with nothing but ./configure and the info page confirms this. So it seems Apache is handling everything correct, the page gets passed to the proper php binary, and the result is correctly served back to the client. DAve On Sun, Oct 21, 2001 at 12:18:07PM -0500, Brian Mauter wrote: Seems to me that the problems is that you have two instances of PHP going at the same time. The first is the one compiled into Apache and the second is the cgi module. My bet is that the PHP compiled into Apache is catching it first (maybe you told all .cgi files to be parsed by the PHP parser?). In that case, the first line would be treated as HTML output, not PHP. This would be the reason you get that line in all of your scripts. Here's a test: remove that line from your file and then try it. If it continues to work, I would seriously suspect that the built-in Apache-PHP parser is handling your .cgi files. -Brian -Original Message- From: Dave Goodrich [mailto:[EMAIL PROTECTED]] * snip info.cgi #!/usr/local/bin/php ?php phpinfo(); ? -- My other computer is your Windows machine... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP/CGI problem: #!/path/php at top of CGI script appears in output
Hi, I'll synthetize the problem with the response I have givven to Curt. I've FreeBSD 4.2/Apache 1.3.9/PHP 4.0.6 I've installed PHP in Apache, it works very well I need to have too PHP 4.0.6 in CGI mode (With Suexec but I don't think it's the problem) but I've a problem. In CGI mode, the path of PHP is always written at the top of the result I'll take for example this script which is in the cgi-bin with the execute mod (755), the extension is .cgi : #!/usr/local/bin/php ? print Hello World; ? When the file is called by the browser, the result is : #!/usr/local/bin/php Hello World Does someone know the problem and the solution ? Have I forgotten something ? I think that's a misconfiguration in PHP Thanks for your help Philippe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP/CGI problem: #!/path/php at top of CGI script appears in output
It's not you. I just built a bare cgi version of php, nothing but './configure' and got the same result. I used this simple script to be sure I was in fact running the cgi binary and it showed I was. info.cgi #!/usr/local/bin/php ?php phpinfo(); ? I got the correct info page, but with the #!/usr/local/bin/php at the top as you stated. Odd, but I've never used the cgi version so other than confirming your problem I am afraid I'm no help. DAve On Sat, Oct 20, 2001 at 03:31:06PM +, Philippe wrote: Hi, I'll synthetize the problem with the response I have givven to Curt. I've FreeBSD 4.2/Apache 1.3.9/PHP 4.0.6 I've installed PHP in Apache, it works very well I need to have too PHP 4.0.6 in CGI mode (With Suexec but I don't think it's the problem) but I've a problem. In CGI mode, the path of PHP is always written at the top of the result I'll take for example this script which is in the cgi-bin with the execute mod (755), the extension is .cgi : #!/usr/local/bin/php ? print Hello World; ? When the file is called by the browser, the result is : #!/usr/local/bin/php Hello World Does someone know the problem and the solution ? Have I forgotten something ? I think that's a misconfiguration in PHP Thanks for your help Philippe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- My other computer is your Windows machine... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: [PHP-INST] Re: [PHP] PHP/CGI problem: #!/path/php at top of CGI script appears in output
Hi @all.. I'm not sure if this can fix (or explain) your problem (cause I didn't tried it in lack of time) but theoretical it could be :). I think you only need the #!/usr/local/bin/php if you would like to run scripts from the bash, or as a real cgi. But I think, there could be another solution .. compile your php as cgi like you did and add these lines in your httpd.conf ScriptAlias /php/ /usr/local/bin/ AddType application/x-httpd-php .php .phtml .cgi Action application/x-httpd-php /php/php This should also launch the cgi - version of php, but doesn't requires the #! line in the scripts. I'm not sure, but it should work. Hope this helps you, Stefan Siefert - Original Message - From: Dave Goodrich [EMAIL PROTECTED] To: Philippe [EMAIL PROTECTED] Cc: php-general [EMAIL PROTECTED]; php-install [EMAIL PROTECTED] Sent: Saturday, October 20, 2001 6:05 PM Subject: [PHP-INST] Re: [PHP] PHP/CGI problem: #!/path/php at top of CGI script appears in output It's not you. I just built a bare cgi version of php, nothing but './configure' and got the same result. I used this simple script to be sure I was in fact running the cgi binary and it showed I was. info.cgi #!/usr/local/bin/php ?php phpinfo(); ? I got the correct info page, but with the #!/usr/local/bin/php at the top as you stated. Odd, but I've never used the cgi version so other than confirming your problem I am afraid I'm no help. DAve On Sat, Oct 20, 2001 at 03:31:06PM +, Philippe wrote: Hi, I'll synthetize the problem with the response I have givven to Curt. I've FreeBSD 4.2/Apache 1.3.9/PHP 4.0.6 I've installed PHP in Apache, it works very well I need to have too PHP 4.0.6 in CGI mode (With Suexec but I don't think it's the problem) but I've a problem. In CGI mode, the path of PHP is always written at the top of the result I'll take for example this script which is in the cgi-bin with the execute mod (755), the extension is .cgi : #!/usr/local/bin/php ? print Hello World; ? When the file is called by the browser, the result is : #!/usr/local/bin/php Hello World Does someone know the problem and the solution ? Have I forgotten something ? I think that's a misconfiguration in PHP Thanks for your help Philippe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- My other computer is your Windows machine... -- PHP Install Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP/CGI problem: #!/path/php at top of CGI script appears in output
Hi, I've FreeBSD 4.2/Apache 1.3.9/PHP 4.0.6 I've installed PHP in Apache, it works very well I need to have too PHP 4.0.6 in CGI mode (With Suexec but I don't think it's the problem) but I've a problem. In CGI mode, the path of PHP is always written at the top of the result I'll take for example this script : #!/usr/local/bin/php ? print Hello World; ? When the file is called by the browser, the result is : #!/usr/local/bin/php Hello World Does someone know the problem and the solution ? Have I forgotten something ? Thanks for your help Philippe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP/CGI Help
Hi all, This is a tough one, wasn't able to find a solution so far. But I hope that someone can help me out or point me in the right direction. Here is what I got: /src contains a bunch of cgi scripts that require apache to have an entry like this ScriptAlias /src "/home/src/" When I try to run a file with .php extension in /src I get an error. I figured out since I have ScriptAlias /src, Apache will handle every file called in that directory as if it were a perl /cgi program. I need to be able to have apache execute the .cgi and .php files in /src Any ideas on how to make Apache differentiate between the two. Any help would be greatly appreciated. Nick -- ~ Nicholas Marouf || http://www.RamallahOnline.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP/CGI Help
do .php files work anywhere else? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Maroufski Sent: Thursday, March 22, 2001 5:41 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP/CGI Help Hi all, This is a tough one, wasn't able to find a solution so far. But I hope that someone can help me out or point me in the right direction. Here is what I got: /src contains a bunch of cgi scripts that require apache to have an entry like this ScriptAlias /src "/home/src/" When I try to run a file with .php extension in /src I get an error. I figured out since I have ScriptAlias /src, Apache will handle every file called in that directory as if it were a perl /cgi program. I need to be able to have apache execute the .cgi and .php files in /src Any ideas on how to make Apache differentiate between the two. Any help would be greatly appreciated. Nick -- ~ Nicholas Marouf || http://www.RamallahOnline.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP/CGI Help
you also need to have ScriptAlias /src "/home/src/" Action application/x-httpd-php4 "php excicution file location" AddType application/x-httpd-php4 .php -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Maroufski Sent: Thursday, March 22, 2001 5:41 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP/CGI Help Hi all, This is a tough one, wasn't able to find a solution so far. But I hope that someone can help me out or point me in the right direction. Here is what I got: /src contains a bunch of cgi scripts that require apache to have an entry like this ScriptAlias /src "/home/src/" When I try to run a file with .php extension in /src I get an error. I figured out since I have ScriptAlias /src, Apache will handle every file called in that directory as if it were a perl /cgi program. I need to be able to have apache execute the .cgi and .php files in /src Any ideas on how to make Apache differentiate between the two. Any help would be greatly appreciated. Nick -- ~ Nicholas Marouf || http://www.RamallahOnline.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP/CGI Help
Hi Peter, Thanks for all the help. I actually started playing with what you told me, and then did some trial-and-error testing and found out that I didn't need ScriptAlias /src "/home/src/" at all.The .php3 files ran when I removed it, then I added these two lines to get the .pl and .cgi to work for the virtual host. AddHandler cgi-script .cgi AddHandler cgi-script .pl Works like a charm. Thanks again. Nick Peter Houchin wrote: you also need to have ScriptAlias /src "/home/src/" Action application/x-httpd-php4 "php excicution file location" AddType application/x-httpd-php4 .php -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Maroufski Sent: Thursday, March 22, 2001 5:41 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP/CGI Help Hi all, This is a tough one, wasn't able to find a solution so far. But I hope that someone can help me out or point me in the right direction. Here is what I got: /src contains a bunch of cgi scripts that require apache to have an entry like this ScriptAlias /src "/home/src/" When I try to run a file with .php extension in /src I get an error. I figured out since I have ScriptAlias /src, Apache will handle every file called in that directory as if it were a perl /cgi program. I need to be able to have apache execute the .cgi and .php files in /src Any ideas on how to make Apache differentiate between the two. Any help would be greatly appreciated. Nick -- Nicholas Marouf || System Administrator/Security Response Team http://www.ramallahonline.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php (cgi version) with Apache and suexec - help
The php.ini file has safe-mode = Off so I don't think that is the problem. Suexec is checking to see that the php binary has the same uid/gid as the virtual host user running the php script. Since the php binary is owned by the web server user and the script is owned by one of the virtual host users, the uids/gids do not match and I get an error. I don't see how this can work. If it is possible to run the php binary through suexec, what am I missing? Has anybody gotten the cgi version of php to work with Apache, suexec, and virtual hosting? All replies are appreciated. -john On Fri, 23 Feb 2001, Richard Lynch wrote: Don't use safe-mode in your suExec PHP CGI configure. suExec pretty much does everything safe mode does anyway, and more. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: [EMAIL PROTECTED] Newsgroups: php.general Sent: Friday, February 23, 2001 1:18 PM Subject: [PHP] php (cgi version) with Apache and suexec - help I've been trying to get the cgi version of php working with Apache and suexec but so far I have not had much success. I've installed the Apache module version of php and it seems to work fine. I then installed the cgi version of php and it too seems to work fine as long as it doesn't run through suexec. Suexec works fine for other (perl, c, etc...) cgi's. Here's what I have in Apache's httpd.conf: AddType application/x-httpd-php .php Action application/x-httpd-php /cgi-bin/php.cgi When I try to access a .php file I get an error about the command not being in the document root. This is one of the tests suexec performs and it is true, the cgi-bin directory (and hence the php binary) is not under the document root (although the .php file is). If I change httpd.conf to this: ScriptAlias /php-bin/ "/local/www/php/" AddType application/x-httpd-php .php Action application/x-httpd-php /php-bin/php.cgi Now the php binary is under the document root but when I try to access a .php file I get an error that the target uid/gid does not match that of the directory or program. This is also true since the php binary is owned by the web server and the .php file is owned by another user. So my question is "What am I missing?". How can I ever get the cgi version of php to work with suexec? The php binary is owned by the web server but the .php files will be owned by other users. Here is some more information about the environment in which I am working in case it is relevant: Solaris 7 Apache 1.3.17 php 4.04pl1 I'm just about ready to give up on this one. Thanks in advance for any and all help. -john -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP CGI-Binary
Ok, I give up... how do I build PHP as a CGI-Binary? I've spent two days searching the configure file for this. Julia -- [ Julia Anne Case ] [Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for.] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP CGI-Binary
IF you dont specify --with-apache or --with-apxs configure options you will build the CGI ! - Frank Ok, I give up... how do I build PHP as a CGI-Binary? I've spent two days searching the configure file for this. Julia -- [ Julia Anne Case ] [Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for.] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] php (cgi version) with Apache and suexec - help
I've been trying to get the cgi version of php working with Apache and suexec but so far I have not had much success. I've installed the Apache module version of php and it seems to work fine. I then installed the cgi version of php and it too seems to work fine as long as it doesn't run through suexec. Suexec works fine for other (perl, c, etc...) cgi's. Here's what I have in Apache's httpd.conf: AddType application/x-httpd-php .php Action application/x-httpd-php /cgi-bin/php.cgi When I try to access a .php file I get an error about the command not being in the document root. This is one of the tests suexec performs and it is true, the cgi-bin directory (and hence the php binary) is not under the document root (although the .php file is). If I change httpd.conf to this: ScriptAlias /php-bin/ "/local/www/php/" AddType application/x-httpd-php .php Action application/x-httpd-php /php-bin/php.cgi Now the php binary is under the document root but when I try to access a .php file I get an error that the target uid/gid does not match that of the directory or program. This is also true since the php binary is owned by the web server and the .php file is owned by another user. So my question is "What am I missing?". How can I ever get the cgi version of php to work with suexec? The php binary is owned by the web server but the .php files will be owned by other users. Here is some more information about the environment in which I am working in case it is relevant: Solaris 7 Apache 1.3.17 php 4.04pl1 I'm just about ready to give up on this one. Thanks in advance for any and all help. -john -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php (cgi version) with Apache and suexec - help
Don't use safe-mode in your suExec PHP CGI configure. suExec pretty much does everything safe mode does anyway, and more. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: [EMAIL PROTECTED] Newsgroups: php.general Sent: Friday, February 23, 2001 1:18 PM Subject: [PHP] php (cgi version) with Apache and suexec - help I've been trying to get the cgi version of php working with Apache and suexec but so far I have not had much success. I've installed the Apache module version of php and it seems to work fine. I then installed the cgi version of php and it too seems to work fine as long as it doesn't run through suexec. Suexec works fine for other (perl, c, etc...) cgi's. Here's what I have in Apache's httpd.conf: AddType application/x-httpd-php .php Action application/x-httpd-php /cgi-bin/php.cgi When I try to access a .php file I get an error about the command not being in the document root. This is one of the tests suexec performs and it is true, the cgi-bin directory (and hence the php binary) is not under the document root (although the .php file is). If I change httpd.conf to this: ScriptAlias /php-bin/ "/local/www/php/" AddType application/x-httpd-php .php Action application/x-httpd-php /php-bin/php.cgi Now the php binary is under the document root but when I try to access a .php file I get an error that the target uid/gid does not match that of the directory or program. This is also true since the php binary is owned by the web server and the .php file is owned by another user. So my question is "What am I missing?". How can I ever get the cgi version of php to work with suexec? The php binary is owned by the web server but the .php files will be owned by other users. Here is some more information about the environment in which I am working in case it is relevant: Solaris 7 Apache 1.3.17 php 4.04pl1 I'm just about ready to give up on this one. Thanks in advance for any and all help. -john -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP - CGI Version
I have installed the CGI version of PHP and customized Apache's httpd.conf. (Had to use CGI for this instance). Since I only need (and want) a few php scripts to be available on this server, I added the following line to httpd.conf in order to get my script to work. ScriptAlias /myfile.php /location/myfile.php Then I added the following to "myfile.php" #!/usr/local/bin/php ? phpinfo() ? Everything works fine except that I get "X-Powered-By: PHP/4.0.4pl1 Content-type: text/html #!/usr/local/bin/php" at the top of the page. Any Ideas on how to get rid of this stuff in the output? I have looked through the php.ini file, and php.net but couldn't find anything. Thanks in advance Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP - CGI Version
The solution ended up being the need to re-compile php with the "--enable-discard-path" configure option. This removed the "#!/usr/local/bin/php" line from the top of the file. Thanks for the feedback. Tim Tim Livers wrote: I have installed the CGI version of PHP and customized Apache's httpd.conf. (Had to use CGI for this instance). Since I only need (and want) a few php scripts to be available on this server, I added the following line to httpd.conf in order to get my script to work. ScriptAlias /myfile.php /location/myfile.php Then I added the following to "myfile.php" #!/usr/local/bin/php ? phpinfo() ? Everything works fine except that I get "X-Powered-By: PHP/4.0.4pl1 Content-type: text/html #!/usr/local/bin/php" at the top of the page. Any Ideas on how to get rid of this stuff in the output? I have looked through the php.ini file, and php.net but couldn't find anything. Thanks in advance Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]