[PHP] php as cgi script
Hello all! I have this problem: I need to run a php (http://xx.yy.zz/cgi-bin/pruebacgi.php) that contains that line #!/usr/local/bin/php -q I get it an error from my apache log: malformed header from script. Bad header= php [options] -r : /www/cgi-bin/pruebacgi.php I hope someone can help me! I don't know what can I do. In fact if I run any php that have this line #!/usr/local/bin/php I get an error like that Premature end of script headers: /www/cgi-bin/pruebacgi.php I have installed the php4.3.3 and apache 1.3.28. I configured the php with this line ./configure --with-mysql --with-apache=../apache_1.3.28 --enable-track-vars Do I need to configure some else in my apache or php configuration file. Whan can I do to solve this problem? Thanks in advance KISSES Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as cgi script
Hi Nicole! Thanks for your reply! I'm a little confused: Do I need to compile the php as cgi? I thought it was when you wanted to run php from commanline: as ./pruebacgi.php (Servers-CGI/Commandline) But in my case I want to call a php like that: http://xx.yy.zz/cgi-bin/pruebacgi.php and this php has this line #!/usr/local/bin/php Do I have to compile a php as a cgi, or do I need to do something on the apache server? Please could you clarify my doubts. For example this is a sample of the code: \r\n";?> http://www.phone.com/dtd/wml11.dtd";> Test I really appreciate your help. Kisses, Ivone --- Nicole Lallande <[EMAIL PROTECTED]> wrote: > Ivone -- > > You are using a PERL invocation for php. PHP > scripts begin with > > the # sign is a comment in PERL - not in PHP. > > To run php as cgi you need to install the php cgi > version (as opposed to > the apache modular installation.) That will allow > you to run cgi > scripts on the command line. > > http://www.php.net/manual/en/install.commandline.php > > Best regards, > > Nicole > > Ivone Uribe wrote: > > >Hello all! > > > >I have this problem: > > > >I need to run a php > >(http://xx.yy.zz/cgi-bin/pruebacgi.php) that > contains > >that line > > > >#!/usr/local/bin/php -q > >I get it an error from my apache log: > >malformed header from script. Bad header= php > >[options] -r >e>: /www/cgi-bin/pruebacgi.php > >I hope someone can help me! I don't know what can I > >do. > > > >In fact if I run any php that have this line > >#!/usr/local/bin/php > >I get an error like that > >Premature end of script headers: > >/www/cgi-bin/pruebacgi.php > > > > > > > >I have installed the php4.3.3 and apache 1.3.28. > > > >I configured the php with this line > >./configure --with-mysql > >--with-apache=../apache_1.3.28 --enable-track-vars > > > >Do I need to configure some else in my apache or > php > >configuration file. Whan can I do to solve this > >problem? > > > > > >Thanks in advance > >KISSES > >Ivone > > > > > > > > > > > >__ > >Do you Yahoo!? > >Free Pop-Up Blocker - Get it now > >http://companion.yahoo.com/ > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as cgi script
Thanks very much to all, Ok, I understand now.. so I need to install php as a cgi oppose to the module apache. Do you have some good page that can help me to configure and compile correctly the php as cgi? Thanks in advance, Kisses, Ivone --- Kelly Hallman <[EMAIL PROTECTED]> wrote: > On Fri, 28 Nov 2003, Nicole Lallande wrote: > > Ivone -- > > You are using a PERL invocation for php. PHP > scripts begin > #! is not a perl invocation, it is a Unix convention > to tell the shell > which program should be used to process the file > contents. If you are > running PHP as a CGI from a webserver, chances are > good you do want > #!/path/to/php as the first line, and next line. > > I don't think you can pass a flag like > #!/usr/bin/php -q though, and I > doubt you would want to, since you still need to > send the headers upon > first output. If you did not send headers and just > started outputting, the > server would return a 500 Internal Server Error. > > The directory you're running it from needs to have > ExecCGI permission > (i.e. /cgi-bin/) and assuming no special setup has > been done, you probably > want to start the file off with that #! line as > mentioned above. Also, you > may want to try naming the file .cgi > > > the # sign is a comment in PERL - not in PHP. > > # also denotes a comment in PHP. Though #! is not a > comment, per se. > (However, if you feed the file directly to some > interpreter like perl, it > does have the benefit of being ignored as a > comment.) > > > To run php as cgi you need to install the php cgi > version (as opposed to > > the apache modular installation.) That will allow > you to run cgi > > scripts on the command line. > > CGI stands for common gateway interface, which is > the interface between a > web server/request and some external program, so it > has little to do with > the command line. However, to run PHP from the > command line, you do need > to run it with the "CGI version" of PHP. The > question did not specify > needing to run PHP from the command line, but as a > CGI by the webserver. > > -- > Kelly Hallman > // Ultrafancy > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] run a command on a remote host
How can I run a command on a remote host wiht php? I'm trying this line but nothing happen. passthru("rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n"); I try exec and system, too But if I run this from the command line of my machine the command run rightly. rsh rubella /export/dat0/users/augur-se/bin/.upnotify -s 1045073262-82425_net2.nextelinternational.com -u http://wap.peru.com -a -y D--- -i Location -n Thanks in advance, Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] run a command on a remote host
Hi Brad, Thanks for your help, I'm trying to run this code to know which user is running my webserver. I think it is the nobody #!/usr/local/bin/php -q "; #$output=passthru("rsh rubella ls > /tmp/salididta.txt",$vari); $output=system("who am I",$vari); echo "salida".$vari; printf("\n%s\n",$output); ?> but I only get this "salida0" and I don't get the user How can I know the user? so I can give it permisions to run a rsh? I check and I only can do a rsh to that machine if I'm login with my user and the user root, but I don't know the user of the web server. --- Brad Lhotsky <[EMAIL PROTECTED]> wrote: > Don't forget that this will be executed as the user > that the webserver > is running as. Hopefully that's not root in this > case. Check out the > docs for rsh, you can specify the username with the > -l option. I > don't know if that will accomplish what you want. > Also, what do you mean > by "nothing happen". No output to the browser? The > command does not > execute? What error messages are in your webserver's > error_log? I'm not > incredibly well versed in rsh, but you couls > potentially run into some > issues with the -l option too. Check your error_log > though, if it > doesn't spell out what's wrong to you, it should > atleast give some > information that someone here might be able to > expand on. > > On Tue, Dec 09, 2003 at 02:44:28PM -0800, Ivone > Uribe wrote: > > How can I run a command on a remote host wiht php? > > > > I'm trying this line but nothing happen. > > passthru("rsh rubella > > /export/dat0/users/augur-se/bin/.upnotify -s > > 1045073262-82425_net2.nextelinternational.com -u > > http://wap.peru.com -a -y D--- -i Location -n"); > > > > I try exec and system, too > > > > But if I run this from the command line of my > machine > > the command run rightly. > > > > rsh rubella > /export/dat0/users/augur-se/bin/.upnotify > > -s 1045073262-82425_net2.nextelinternational.com > -u > > http://wap.peru.com -a -y D--- -i Location -n > > > > Thanks in advance, > > Ivone > > > > > > > > __ > > Do you Yahoo!? > > Free Pop-Up Blocker - Get it now > > http://companion.yahoo.com/ > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: > http://www.php.net/unsub.php > > > > -- > Brad Lhotsky <[EMAIL PROTECTED]> __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] run a command on a remote host
Thanks Vail and all! I use it: rsh -l user host command and and I can run it! Kisses! --- "Vail, Warren" <[EMAIL PROTECTED]> wrote: > Well, it is not possible directly, but you can try > some of the following; > > $cmd = "rsh -l user host command";// remote shell > $cmd = "rpc -l user host command";// remote > procedure call > $cmd = "rexec -l user host command"; // remote exec > $cmd = "ssh host command";// secure shell > (recommended, but > not always available) > exec($cmd, $returnlines); // your php command for > one of the > above > foreach($returnlines as $line) echo $line.""; > // output results > > I haven't checked the syntax of the various > commands, but I think this > answers your question about a few options that might > be available. rsh, > rexec, rpc and ssh are defined best in Unix > references, but many are also > available if your php server is windows based. > > good luck, > > Warren Vail > > > -Original Message- > From: Nathan Taylor [mailto:[EMAIL PROTECTED] > Sent: Tuesday, December 09, 2003 3:48 PM > To: [EMAIL PROTECTED]; Ivone Uribe > Subject: Re: [PHP] run a command on a remote host > > > When you say remote host do you mean the server > executing the script or the > person accessing it? > > If you mean the latter, it is not possible. > - Original Message - > From: Ivone Uribe > To: [EMAIL PROTECTED] > Sent: Tuesday, December 09, 2003 5:44 PM > Subject: [PHP] run a command on a remote host > > > How can I run a command on a remote host wiht php? > > I'm trying this line but nothing happen. > passthru("rsh rubella > /export/dat0/users/augur-se/bin/.upnotify -s > 1045073262-82425_net2.nextelinternational.com -u > http://wap.peru.com -a -y D--- -i Location -n"); > > I try exec and system, too > > But if I run this from the command line of my > machine > the command run rightly. > > rsh rubella > /export/dat0/users/augur-se/bin/.upnotify > -s 1045073262-82425_net2.nextelinternational.com > -u > http://wap.peru.com -a -y D--- -i Location -n > > Thanks in advance, > Ivone > > > > __ > Do you Yahoo!? > Free Pop-Up Blocker - Get it now > http://companion.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: > http://www.php.net/unsub.php > __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php compile error with mysql undefined reference to `mysql_real_escape_string'
Hi all! I'm installing php4.3.3, apache 1.3.28 with mysql3.22.32 I'm using this option --with-mysql=/usr/local/mysql But when I compile the php code, I get this error: ext/mysql/php_mysql.o: In function `zif_mysql_client_encoding': /root/fuente/archivos/php-4.3.3/ext/mysql/php_mysql.c:1118: undefined reference to `mysql_character_set_name' ext/mysql/php_mysql.o: In function `zif_mysql_real_escape_string': /root/fuente/archivos/php-4.3.3/ext/mysql/php_mysql.c:1705: undefined reference to `mysql_real_escape_string' collect2: ld returned 1 exit status To solve it..I try the option --disable-cli on ./configure, and all ok. But now I have the same problem (/php-4.3.3/ext/mysql/php_mysql.c:1118: undefined reference to `mysql_character_set_name') when I try to compile the apache... Please!!! Does anybody know how to solve it? Thanks in advance!! __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php compile error with mysql undefined reference to `mysql_real_escape_string'
Hi all! I'm installing php4.3.3, apache 1.3.28 with mysql3.22.32 I'm using this option --with-mysql=/usr/local/mysql But when I compile the php code, I get this error: ext/mysql/php_mysql.o: In function `zif_mysql_client_encoding': /root/fuente/archivos/php-4.3.3/ext/mysql/php_mysql.c:1118: undefined reference to `mysql_character_set_name' ext/mysql/php_mysql.o: In function `zif_mysql_real_escape_string': /root/fuente/archivos/php-4.3.3/ext/mysql/php_mysql.c:1705: undefined reference to `mysql_real_escape_string' collect2: ld returned 1 exit status To solve it..I try the option --disable-cli on ./configure, and all ok. But now I have the same problem (/php-4.3.3/ext/mysql/php_mysql.c:1118: undefined reference to `mysql_character_set_name') when I try to compile the apache... Please!!! Does anybody know how to solve it? Thanks in advance!! __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and MSSQL-Server
Hi all! I know that I can use php with mssql-server, but it isn't common as using php with mysql. So, I want to know is someone is using this structure, and is it stable? don't you have any kind of problems? Thanks and Regards, Ivone __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and MSSQL-Server
Sorry,I forget to mention that I have a linux Red Hat 7.3 and PHP 4, and a SQL Server 2000. Regard and Thanks a lot! --- Ivone Uribe <[EMAIL PROTECTED]> wrote: > Hi all! > I know that I can use php with mssql-server, but it > isn't common as using php with mysql. > So, I want to know is someone is using this > structure, > and is it stable? don't you have any kind of > problems? > > Thanks and Regards, > Ivone > > __ > Do you Yahoo!? > Yahoo! Finance Tax Center - File online. File on > time. > http://taxes.yahoo.com/filing.html > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and ms sql server
Hi all! I need some recommendations from someone who is using php with ms sql. Is it stable? Is it run without any kind of problems? Do you recommend to use php and ms sql server? I have a linux Red Hat 7.3 and PHP 4, and a SQL Server 2000. Thanks a lot and Regards, Ivone __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php