[PHP] Question about PHP-CGI, mysqld and sudden spiking average load readings on Linux Virtual Dedicated Server running CentOS 6.3

2013-02-11 Thread Gary Lebowitz
I have noticed when doing a "top" via SSH on my GoDaddy virtual dedicated
server that every time a user logs in in the COMMAND column I see the
PHP-CGI process start to run, followed by mysqld. Often when these two
processes run I start to see a spike in average load, and sometimes this
spike spins out of control to the point that when trying to log on to my
Moodle 2.3.2 LMS I get an 500 Internal Server Error from Apache. Now, what
I'd like to know given the fact that I have only 2GBytes of RAM and am
sharing a processor with other users :-( is if there is any way to make
sure my PHP 5.3.3 is properly configured. I am given, for example, a choice
between CGI, fastCGI and Apache in my Plesk panel, and I am not quite sure
how to optimize things for my environment. I went to the Moodle.org site to
try and see what's the right setting, but it's not clear if the persons
writing there have a different setup or not. Unfortunately, it's impossible
to get specs on my VDS's processor from the fine folks at GoDaddy, and
perhaps there is just a simple processor power issue going on here, but I
only have 30 students and only a handful going in simultaneously. And at
times my average load can move from .08 to 1.5+ and all the way up to 2+
within the space of a few seconds. I should point out that at one point it
was discovered by GoDaddy technicial people that a user was running a rogue
process that overtaxing resources. But perhaps I also need to tweak my
installation despite this incident. Any help here would be appreciated.


[PHP] 答复: [PHP] Re: Problem of load balance among php-cgi process

2011-10-20 Thread Sean Chen
lol.
The last one:

500  23880  0.0  0.0 209136 10832 ?S21:23   0:01 
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config 
/usr/local/websrv/php/etc/php-fpm.conf
500  27195 15.0  0.1 210196 12644 ?S23:02   0:02 
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config 
/usr/local/websrv/php/etc/php-fpm.conf <- THIS ONE

PS: The problem is solved, It's cause by eaccelerator module, when I remove 
this module, the php-cgi works well.

Regards.
Sean

-邮件原件-

On 10/20/2011 5:20 AM, sean chen wrote:

>> The red one is busy

My email client is color blind.

-- 
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

C - (541) 408-5189
O - (541) 323-9113
H - (541) 323-4219


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Problem of load balance among php-cgi process

2011-10-20 Thread Jim Lucas
On 10/20/2011 5:20 AM, sean chen wrote:

>> The red one is busy

My email client is color blind.

-- 
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

C - (541) 408-5189
O - (541) 323-9113
H - (541) 323-4219

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Problem of load balance among php-cgi process

2011-10-20 Thread sean chen
It's cause by eaccelerator module, when I remove this module, the php-cgi
works well.
Is there some compatible issue between eaccelerator and php?

Regards
Sean

2011/10/19 Sean Chen 

>  Hi,
>
> ** **
>
> I’ve got a problem when running PHP with nginx, there are several php-cgi
> processes and only one is busy at one time, like this:
>
> ** **
>
> 500  23868  0.0  0.0 209164 10948 ?S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  23871  0.0  0.0 209136 10684 ?    S    21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  23872  0.0  0.0 209136 10732 ?    S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  23873  0.0  0.0 209136 10712 ?S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  23874  0.0  0.0 209076 10576 ?S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  23875  0.0  0.0 209136 10976 ?S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf****
>
> 500  23876  0.0  0.0 209136 10796 ?S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  23877  0.0  0.0 209136 11068 ?S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  23878  0.0  0.0 209136 10708 ?S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  23879  0.0  0.0 209136 10960 ?S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  23880  0.0  0.0 209136 10832 ?S21:23   0:01
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> 500  *27195 15.0*  0.1 210196 12644 ?    S    23:02   0:02
> /usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
> /usr/local/websrv/php/etc/php-fpm.conf
>
> ** **
>
> The red one is busy, and other php-cgi processes is cpu free, cpu load is
> about 20% total, with lot of free memory, disk and network io status is
> fine,
>
> and mean time, response of HTTP request to this server is very slow.
>
> ** **
>
> The cpu load of php-cgi processes return normal when I restart the php-fpm
> service (each process takes some cpu slice which means they are all working
> I think). But, after several minutes, the problem appears again and again…
> 
>
> ** **
>
> what’s wrong with my php-cgi?
>
> ** **
>
> PS: how do I debug or monitor the php program running status when it goes
> wrong?
>
> ** **
>
> versions:
>
> php: 5.2.17
>
> nginx: 5.8.55
>
> OS: CentOS 5.6 64-bit
>
> ** **
>
> Regards
>
> Sean
>
> ** **
>


[PHP] Problem of load balance among php-cgi process

2011-10-19 Thread Sean Chen
Hi,

 

I've got a problem when running PHP with nginx, there are several php-cgi
processes and only one is busy at one time, like this:

 

500  23868  0.0  0.0 209164 10948 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23871  0.0  0.0 209136 10684 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23872  0.0  0.0 209136 10732 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23873  0.0  0.0 209136 10712 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23874  0.0  0.0 209076 10576 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23875  0.0  0.0 209136 10976 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23876  0.0  0.0 209136 10796 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23877  0.0  0.0 209136 11068 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23878  0.0  0.0 209136 10708 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23879  0.0  0.0 209136 10960 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  23880  0.0  0.0 209136 10832 ?S21:23   0:01
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

500  27195 15.0  0.1 210196 12644 ?S23:02   0:02
/usr/local/websrv/php/bin/php-cgi --fpm --fpm-config
/usr/local/websrv/php/etc/php-fpm.conf

 

The red one is busy, and other php-cgi processes is cpu free, cpu load is
about 20% total, with lot of free memory, disk and network io status is
fine,

and mean time, response of HTTP request to this server is very slow.

 

The cpu load of php-cgi processes return normal when I restart the php-fpm
service (each process takes some cpu slice which means they are all working
I think). But, after several minutes, the problem appears again and again.

 

what's wrong with my php-cgi?

 

PS: how do I debug or monitor the php program running status when it goes
wrong?

 

versions:

php: 5.2.17

nginx: 5.8.55

OS: CentOS 5.6 64-bit

 

Regards

Sean

 



Re: [PHP] CGI PHP vs. FastCGI vs. mod_php vs. application server?

2011-10-12 Thread Mike Mackintosh
Nice write up Richard

On Oct 12, 2011, at 7:06, Richard Quadling  wrote:

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] CGI PHP vs. FastCGI vs. mod_php vs. application server?

2011-10-12 Thread Richard Quadling
On 12 October 2011 09:19, saeed ahmed  wrote:
> greeting all,
>
> As far as I know, there are different ways to write a PHP application:
> - CGI, ie. the usual way : some PHP code in web pages, and the PHP
> interpreter is loaded each time a PHP page is called
> - FastCGI : apparently, the interpreter is loaded at boot time; the
> application itself might also be compiled and loaded once
> - mod_php : same as FastCGI?
> - application server : the application is compiled and loaded once;
> the application can either have its own web server, or use a web
> server as front end, and only handle its own part
>
> Any tips much appreciated, thank you.


Each of the SAPIs operate in different environments (though I suppose
CGI and FastCGI are going to nearly be swappable).

CGI - As you rightly say, is loaded on a per-request basis. There is
an overhead for every request to get PHP up and running prior to
processing the PHP script.

Fast-CGI - This requires some cooperation from the server. The server
will create a set of PHP instances (separate executable, not running
in the same memory space as the server) ready to receive the script.
This reduces the overhead that exists with CGI from request loading to
server startup/loading.

mod_php - I'm on Windows and have not used Apache. But I have used
ISAPI. I believe these operate in a similar fashion. In this instance,
the PHP interpreter is loaded as a module of the server, just like any
other module the server loads. Each PHP script is handled by a
separate PHP thread. These threads are NOT separate instances of PHP,
and are running within the same address space as the web server. As a
consequence, several features/issues exist. Chiefly for me was the
persistent database connections. As the same module of code is running
all the scripts, a script can (by the use of the appropriate
functions) get the database connection remembered between each script.
This allows faster connection to the DB for each script. There are
issues though. The connection is to the SERVER and not to the DB. The
remembered connection is based upon the server, the username and
password. If you use multiple databases on the same connection AND use
the selectDB functionality, the single remembered DB connection will
change DB. If this happens midscript, you could end up in a very
strange place. But, if you use qualified naming
(database_name.owner.table_name for an MS SQL example), then you will
be fine. Just remember select DB is just a shortcut for the connection
to use. It isn't part of the connection.

Application Server - Don't know.

You also have ...

CLI - Command line PHP scripting. You must manually invoke PHP with
the script name for it to run, though Windows has some useful features
to allow you to run a PHP script without having to declare the PHP
executable every time. I think the #! line is the Unix equivalent of
this feature, but isn't as complete as the Windows mechanism (IMHO) -
See http://docs.php.net/manual/en/install.windows.commandline.php for
additional details on this.

And as of 5.4, there is CLI Server. This is using PHP to run as a
listener on the HTTP port and passes requests to a simple, userland,
PHP-based routing script which will allow you to respond to PHP
requests. See http://docs.php.net/manual/en/features.commandline.webserver.php
for more details.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] CGI PHP vs. FastCGI vs. mod_php vs. application server?

2011-10-12 Thread saeed ahmed
greeting all,

As far as I know, there are different ways to write a PHP application:
- CGI, ie. the usual way : some PHP code in web pages, and the PHP
interpreter is loaded each time a PHP page is called
- FastCGI : apparently, the interpreter is loaded at boot time; the
application itself might also be compiled and loaded once
- mod_php : same as FastCGI?
- application server : the application is compiled and loaded once;
the application can either have its own web server, or use a web
server as front end, and only handle its own part

Any tips much appreciated, thank you.

--
Saeed Ahmed
Junior Software engineer
Codemate Ltd .
My Blog: saeedahmed.net


[PHP] CGI/FastCGI problem when debugging

2011-05-15 Thread taomin
Hi, everyone,
I built a project base on ZF in Zend Studio 8, and run well. But when I
debug the index.php as PHP Web Page, it always get the index.php file "save
as", and then an CGI/FastCGI error, soon or later. 
I use Zend Debugger, and Local Zend server.
I googled much , and have changed settings about some timing controls. Like:

C:\..\Zend\ZendServer\etc \ZendEnablerConf.xml  
  to 
And, in Zend Server-Server Setup-Directives, change the
"max_execution_time"to 600,restart php and Apache-Zend。Also I shut down the
time limit in
"ZendServer/GUI/applications/CE/models/Plugins/Initializer/CE.php" (
//set_time_limit(60);)

But the index.php"save as " and the CGI problem still there.

I checked Zend Server's httpd.conf  and  Zend.conf, nothing weird.  Testing
debugger in Zend Studio also succced.

And more strangely, if I hold the F5 key, let the debugger step quickly, it
has a big chance to get this in brower: 
Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
Please contact the server administrator, ad...@example.com and inform them
of the time the error occurred, and anything you might have done that may
have caused the error.
More information about this error may be available in the server error log.

At the same time, the address bar will be:
http://localhost:8081/quickstart/quickstart/public/index.php?debug_host=192.
168.0.181%2C127.0.0.1&debug_fastfile=1&start_debug=1&debug_port=10137&use_re
mote=1&original_url=http%3A%2F%2Flocalhost%3A8081%2Fquickstart%2Fquickstart%
2Fpublic%2Findex.php&send_sess_end=1&debug_stop=1&debug_start_session=1&debu
g_no_cache=1305510553167&debug_session_id=1007

the ip address "192.168.0.181" is my laptop's wireless ip, but I have
already set the ServerName to 127.0.0.1 in Zend server's httpd.conf.  So why
the debug_host will be 192.168.0.181? Dose this can figure any clue to my
problem above? 

I have ticked around here for 3 days. Any help appreciated!!

Best Wishes.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Want a answer about php-cgi

2010-04-22 Thread Sharl.Jimh.Tsin
thanks for your reply.

i think i have know the reason now.

the CGI version of php is not built by default,we MUST add
"--enable-cgi" to configure explicitly.

Best regards,
Sharl.Jimh.Tsin



2010/4/22 Lupus Michaelis :
> Le 21/04/2010 12:17, Sharl.Jimh.Tsin a écrit :
>
>> i can not find php-cgi file in the bin/sbin directory. WHY?
>> ("--disable-cgi" is not used)
>
>  cd to your build directory, then type next command :
>
>  find . -name php5-cgi -or -name php-cgi
>
>
> --
> Mickaël Wolff aka Lupus Michaelis
> http://lupusmic.org
>
> --
> 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] Re: Want a answer about php-cgi

2010-04-22 Thread Lupus Michaelis

Le 21/04/2010 12:17, Sharl.Jimh.Tsin a écrit :


i can not find php-cgi file in the bin/sbin directory. WHY?
("--disable-cgi" is not used)


  cd to your build directory, then type next command :

  find . -name php5-cgi -or -name php-cgi


--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Want a answer about php-cgi

2010-04-22 Thread Sharl.Jimh.Tsin
who can give me a sample to build a cgi version of php 5.3.x?

i really have no idea now...

Best regards,
Sharl.Jimh.Tsin



在 2010年4月21日 下午7:32,Sharl.Jimh.Tsin  写道:
> added it,but still no found. 囧rz
>
> Best regards,
> Sharl.Jimh.Tsin
>
>
>
> 2010/4/21 Sharl.Jimh.Tsin :
>> Sorry,i don't add it.
>>
>> and i can not find them in the ./configure --help context.
>>
>> does this string really exist?
>>
>> thankx a lot.
>>
>> Best regards,
>> Sharl.Jimh.Tsin
>>
>>
>>
>> 2010/4/21 shiplu :
>>> Did you try   --with-fastcgi or --enable-fastcgi
>>>
>>>
>>>
>>>
>>>
>>> Shiplu Mokaddim
>>> My talks, http://talk.cmyweb.net
>>> Follow me, http://twitter.com/shiplu
>>> SUST Programmers, http://groups.google.com/group/p2psust
>>> Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
>>>
>>>
>>>
>>> On Wed, Apr 21, 2010 at 5:17 PM, Sharl.Jimh.Tsin  
>>> wrote:
>>>> i can not find php-cgi file in the bin/sbin directory. WHY?
>>>
>>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Want a answer about php-cgi

2010-04-21 Thread Sharl.Jimh.Tsin
added it,but still no found. 囧rz

Best regards,
Sharl.Jimh.Tsin



2010/4/21 Sharl.Jimh.Tsin :
> Sorry,i don't add it.
>
> and i can not find them in the ./configure --help context.
>
> does this string really exist?
>
> thankx a lot.
>
> Best regards,
> Sharl.Jimh.Tsin
>
>
>
> 2010/4/21 shiplu :
>> Did you try   --with-fastcgi or --enable-fastcgi
>>
>>
>>
>>
>>
>> Shiplu Mokaddim
>> My talks, http://talk.cmyweb.net
>> Follow me, http://twitter.com/shiplu
>> SUST Programmers, http://groups.google.com/group/p2psust
>> Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
>>
>>
>>
>> On Wed, Apr 21, 2010 at 5:17 PM, Sharl.Jimh.Tsin  
>> wrote:
>>> i can not find php-cgi file in the bin/sbin directory. WHY?
>>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Want a answer about php-cgi

2010-04-21 Thread Sharl.Jimh.Tsin
Sorry,i don't add it.

and i can not find them in the ./configure --help context.

does this string really exist?

thankx a lot.

Best regards,
Sharl.Jimh.Tsin



2010/4/21 shiplu :
> Did you try   --with-fastcgi or --enable-fastcgi
>
>
>
>
>
> Shiplu Mokaddim
> My talks, http://talk.cmyweb.net
> Follow me, http://twitter.com/shiplu
> SUST Programmers, http://groups.google.com/group/p2psust
> Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
>
>
>
> On Wed, Apr 21, 2010 at 5:17 PM, Sharl.Jimh.Tsin  
> wrote:
>> i can not find php-cgi file in the bin/sbin directory. WHY?
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Want a answer about php-cgi

2010-04-21 Thread shiplu
Did you try   --with-fastcgi or --enable-fastcgi





Shiplu Mokaddim
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)



On Wed, Apr 21, 2010 at 5:17 PM, Sharl.Jimh.Tsin  wrote:
> i can not find php-cgi file in the bin/sbin directory. WHY?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Want a answer about php-cgi

2010-04-21 Thread Sharl.Jimh.Tsin
hi,everyone

I installed php 5.3.2 from source.
this is my configurate string:
  $ ./configure --prefix=/usr/local/php --bindir=/usr/local/bin
--sbindir=/usr/local/sbin --sysconfdir=/etc/sysconfig
--localstatedir=/var --enable-fpm --enable-calendar
--enable-dba-shared --enable-exif --enable-ftp --enable-gd-native-ttf
--enable-intl --enable-mbstring --enable-soap --enable-sockets
--enable-wddx --enable-zip --enable-zend-multibyte
--with-libevent-dir=/usr/local/libevent --with-fpm-user=http
--with-fpm-group=web --with-config-file-path=/etc/sysconfig/php.ini
--with-openssl --with-kerberos --with-zlib --with-bz2 --with-gd
--with-mhash --with-imap --with-imap-ssl --with-ldap --with-mcrypt
--with-mysql=/usr/local/mysql --with-mysql-sock=/tmp
--with-mysqli=/usr/local/bin/mysql_config --with-xmlrpc

after make install.

i can not find php-cgi file in the bin/sbin directory. WHY?
("--disable-cgi" is not used)

Best regards,
Sharl.Jimh.Tsin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] C++, $_POST -> php-cgi

2009-06-10 Thread Simon
I'm working on something similar, here's the pseudo-code of what
happens to ensure the PHP script run by my server doesnt see any
difference than when it runs under apache or others...

Say the php file to execute is "index.php" and it was called from a
form post, the form tag also specified GET arguments like this ...

The PHP script will expect this:
$_GET['somegetvar'] = "getvalue";
$_POST['somepostvar'] = "postvalue";
and
$_REQUEST['somegetvar'] = "getvalue";
$_REQUEST['somepostvar'] = "postvalue";

To get this working, the server first has to parse the HTTP message to
grab the GET arguments in the URI.  After this, the server has to
parse the Body entity of the HTTP message for POST values.  Once the
server has all the information, it can execute the php script.

I personally like to use popen("php", "w") which opens a write-only
pipe to the php process... it's like just typing "php" on the
commandline, php then listens on stdin for the code and it executes
when it receives EOF (on the commandline this happens after a ctrl-d
on linux), using popen() this happens on a pclose().

Once you've popen()ed php, you start writting something like this:


And bingo!

Hope this helps, good luck!


On Mon, Jun 8, 2009 at 9:29 AM, Jasper wrote:
> Hi,
> i'm planning to create a win32 http server that supports cgi. Does anybody 
> see the problem in C++ -source? Php doesn't give any output, but if I don't 
> set the rfc3875 environment variables, all output comes
> normally (expect post and other variables aren't set).
> Only what I'm able to set is $_GET -variables as
> script arguments.
>
> So how can I set post variables and others, like RAW_POST_DATA?
> The c code above lets php to read the script by itself and post -variables 
> are written to stdin pipe. Output
> should be able to be readed from stdout (problem is
> that there are no output, even not the headers).
>
> I hope that you understand what I mean...
>
> -
> Test script: (D:\test.php)
> -
> 
>
> -
> C++ source:
> -
> #include 
> #include 
> #include 
>
> int main()
> {
>SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES)};
>sa.bInheritHandle = 1;
>sa.lpSecurityDescriptor = NULL;
>
>HANDLE hStdoutR, hStdoutW, hStdinR, hStdinW;
>CreatePipe(&hStdoutR,&hStdoutW,&sa,0);
>SetHandleInformation(hStdoutR,HANDLE_FLAG_INHERIT,0);
>CreatePipe(&hStdinR,&hStdinW,&sa,0);
>SetHandleInformation(hStdinW,HANDLE_FLAG_INHERIT,0);
>
>STARTUPINFO si = {sizeof(STARTUPINFO)};
>PROCESS_INFORMATION pi;
>si.dwFlags = STARTF_USESTDHANDLES;
>si.hStdOutput = hStdoutW;
>si.hStdInput = hStdinR;
>
>char env[255] = 
> "REQUEST_METHOD=POST\0CONTENT_LENGTH=17\0CONTENT_TYPE=application/x-www-form-urlencoded\0SCRIPT_FILENAME=D:\\test.php";
>if(!CreateProcess(NULL,"php-5.2.9-1-Win32\\php-cgi.exe 
> D:\\test.php",NULL,NULL,1,NORMAL_PRIORITY_CLASS,env,NULL,&si,&pi))
>return 0;
>CloseHandle(hStdoutW);
>CloseHandle(hStdinR);
>
>DWORD dwWritten = 0;
> //Write post data here?
> if(!WriteFile(hStdinW,"var=post+variable",20,&dwWritten,NULL))
>return 0;
>
>CloseHandle(hStdinW);
>
>char buf[1000] = {0};
>DWORD dwRead = 0;
>while(ReadFile(hStdoutR,buf,sizeof(buf),&dwRead,NULL) && dwRead != 0){
>printf(buf);
>}
>printf("|\n\nEND");
>CloseHandle(hStdoutR);
>
>getch();
>
>return 0;
> }
> --
> Thanks!
> Jasper
>
> ...
> Luukku Plus paketilla pääset eroon tila- ja turvallisuusongelmista.
> Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku
>
>
> --
> 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] C++, $_POST -> php-cgi

2009-06-08 Thread Jasper
Hi,
i'm planning to create a win32 http server that supports cgi. Does anybody see 
the problem in C++ -source? Php doesn't give any output, but if I don't set the 
rfc3875 environment variables, all output comes
normally (expect post and other variables aren't set).
Only what I'm able to set is $_GET -variables as
script arguments.

So how can I set post variables and others, like RAW_POST_DATA?
The c code above lets php to read the script by itself and post -variables are 
written to stdin pipe. Output
should be able to be readed from stdout (problem is
that there are no output, even not the headers).

I hope that you understand what I mean...

-
Test script: (D:\test.php)
-


-
C++ source:
-
#include 
#include 
#include 

int main()
{
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES)};
sa.bInheritHandle = 1;
sa.lpSecurityDescriptor = NULL;

HANDLE hStdoutR, hStdoutW, hStdinR, hStdinW;
CreatePipe(&hStdoutR,&hStdoutW,&sa,0);
SetHandleInformation(hStdoutR,HANDLE_FLAG_INHERIT,0);
CreatePipe(&hStdinR,&hStdinW,&sa,0);
SetHandleInformation(hStdinW,HANDLE_FLAG_INHERIT,0);

STARTUPINFO si = {sizeof(STARTUPINFO)};
PROCESS_INFORMATION pi;
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdOutput = hStdoutW;
si.hStdInput = hStdinR;

char env[255] = 
"REQUEST_METHOD=POST\0CONTENT_LENGTH=17\0CONTENT_TYPE=application/x-www-form-urlencoded\0SCRIPT_FILENAME=D:\\test.php";
if(!CreateProcess(NULL,"php-5.2.9-1-Win32\\php-cgi.exe 
D:\\test.php",NULL,NULL,1,NORMAL_PRIORITY_CLASS,env,NULL,&si,&pi))
return 0;
CloseHandle(hStdoutW);
CloseHandle(hStdinR);

DWORD dwWritten = 0;
//Write post data here?
if(!WriteFile(hStdinW,"var=post+variable",20,&dwWritten,NULL))
return 0;

CloseHandle(hStdinW);

char buf[1000] = {0};
DWORD dwRead = 0;
while(ReadFile(hStdoutR,buf,sizeof(buf),&dwRead,NULL) && dwRead != 0){
printf(buf);
}
printf("|\n\nEND");
CloseHandle(hStdoutR);

getch();

return 0;
}
--
Thanks!
Jasper

...
Luukku Plus paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] cgi vs php

2009-02-06 Thread Thodoris



Thodoris napsal(a):



Y

In cgi i can use perl ,c etc
suppose i use perl

now how efficiency differs?
How cgi written in perl  and php is differ in working in context of web
service?

other difference?.

but their differ.

On Thu, Feb 5, 2009 at 6:45 PM, Jay Blanchard 
 wrote:


 

[snip]
can anybody tell me the benefits of php over cgi or vice versa?
i need to compare both?
[/snip]

CGI is a gateway to be used by languages
PHP is a language






  


First of all try not to top post this is what we usually do here.

Well CGI is a standard protocol implemented by many programming 
languages. You may start googling to find about it but this is a start:


http://en.wikipedia.org/wiki/Common_Gateway_Interface

Both Perl and PHP can work with CGI but working with Perl-CGI is not 
something that we should discuss in this list since this is a *PHP* 
list.


IMHO you should start reading some aspects of web development to make 
some things clear before start asking questions in the lsit. This 
will improve your understanding and it help us to make suggestions.




I admire your calmness.
Such a descriptive reply for someone who doesn't think before asking.



After smashing a ton of keyboards and yell at my screen when people 
started looking me with a weird expression in their faces I understood that:


1) I am paying a lot of money for keyboards
2) My screen will never answer my threats
3) People will start to think that I come from outer space
4) Everybody needs help

:-)

--
Thodoris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cgi vs php

2009-02-05 Thread Vikas Sharma
Thanx for your reply Thodoris
i really new to this.
i will follow your suggestions.
and i admit tht my query was silly its b'zoz i know less .

but
wht the hell reply by the "Martin Zvarík". has he done all this in womb.
MZ u also need to think before commenting such.


On Thu, Feb 5, 2009 at 9:33 PM, Martin Zvarík  wrote:

> Thodoris napsal(a):
>
>
>>  Y
>>>
>>> In cgi i can use perl ,c etc
>>> suppose i use perl
>>>
>>> now how efficiency differs?
>>> How cgi written in perl  and php is differ in working in context of web
>>> service?
>>>
>>> other difference?.
>>>
>>> but their differ.
>>>
>>> On Thu, Feb 5, 2009 at 6:45 PM, Jay Blanchard 
>>> wrote:
>>>
>>>
>>>
 [snip]
 can anybody tell me the benefits of php over cgi or vice versa?
 i need to compare both?
 [/snip]

 CGI is a gateway to be used by languages
 PHP is a language



>>>
>>>
>>>
>>>
>>>
>>
>> First of all try not to top post this is what we usually do here.
>>
>> Well CGI is a standard protocol implemented by many programming languages.
>> You may start googling to find about it but this is a start:
>>
>> http://en.wikipedia.org/wiki/Common_Gateway_Interface
>>
>> Both Perl and PHP can work with CGI but working with Perl-CGI is not
>> something that we should discuss in this list since this is a *PHP* list.
>>
>> IMHO you should start reading some aspects of web development to make some
>> things clear before start asking questions in the lsit. This will improve
>> your understanding and it help us to make suggestions.
>>
>>
> I admire your calmness.
> Such a descriptive reply for someone who doesn't think before asking.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
vikas sharma


Re: [PHP] cgi vs php

2009-02-05 Thread Martin Zvarík

Thodoris napsal(a):



Y

In cgi i can use perl ,c etc
suppose i use perl

now how efficiency differs?
How cgi written in perl  and php is differ in working in context of web
service?

other difference?.

but their differ.

On Thu, Feb 5, 2009 at 6:45 PM, Jay Blanchard  
wrote:


 

[snip]
can anybody tell me the benefits of php over cgi or vice versa?
i need to compare both?
[/snip]

CGI is a gateway to be used by languages
PHP is a language






  


First of all try not to top post this is what we usually do here.

Well CGI is a standard protocol implemented by many programming 
languages. You may start googling to find about it but this is a start:


http://en.wikipedia.org/wiki/Common_Gateway_Interface

Both Perl and PHP can work with CGI but working with Perl-CGI is not 
something that we should discuss in this list since this is a *PHP* list.


IMHO you should start reading some aspects of web development to make 
some things clear before start asking questions in the lsit. This will 
improve your understanding and it help us to make suggestions.




I admire your calmness.
Such a descriptive reply for someone who doesn't think before asking.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cgi vs php

2009-02-05 Thread Thodoris



Y

In cgi i can use perl ,c etc
suppose i use perl

now how efficiency differs?
How cgi written in perl  and php is differ in working in context of web
service?

other difference?.

but their differ.

On Thu, Feb 5, 2009 at 6:45 PM, Jay Blanchard  wrote:

  

[snip]
can anybody tell me the benefits of php over cgi or vice versa?
i need to compare both?
[/snip]

CGI is a gateway to be used by languages
PHP is a language






  


First of all try not to top post this is what we usually do here.

Well CGI is a standard protocol implemented by many programming 
languages. You may start googling to find about it but this is a start:


http://en.wikipedia.org/wiki/Common_Gateway_Interface

Both Perl and PHP can work with CGI but working with Perl-CGI is not 
something that we should discuss in this list since this is a *PHP* list.


IMHO you should start reading some aspects of web development to make 
some things clear before start asking questions in the lsit. This will 
improve your understanding and it help us to make suggestions.


--
Thodoris



Re: [PHP] cgi vs php

2009-02-05 Thread Vikas Sharma
Y

In cgi i can use perl ,c etc
suppose i use perl

now how efficiency differs?
How cgi written in perl  and php is differ in working in context of web
service?

other difference?.

but their differ.

On Thu, Feb 5, 2009 at 6:45 PM, Jay Blanchard  wrote:

> [snip]
> can anybody tell me the benefits of php over cgi or vice versa?
> i need to compare both?
> [/snip]
>
> CGI is a gateway to be used by languages
> PHP is a language
>



-- 
vikas sharma


RE: [PHP] cgi vs php

2009-02-05 Thread Jay Blanchard
[snip]
can anybody tell me the benefits of php over cgi or vice versa?
i need to compare both?
[/snip]

CGI is a gateway to be used by languages
PHP is a language

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cgi vs php

2009-02-05 Thread Vikas Sharma
can anybody tell me the benefits of php over cgi or vice versa?
i need to compare both?

-- 
vikas sharma


[PHP] Howto build statically linked PHP CGI (without shared libs)

2008-09-10 Thread santi

Dear Srs,

I'm trying to compile a statically linked, without shared libs, CGI version
of PHP, I've already tested with 5.2.6 and 5.2.7-dev.

Is there any option in ./configure to compile PHP with this feature?

Also I have tried passing CC and CFLAGS environment variables with
"-static" flags.. but the CGI builds using shared libs, example:

# file /tmp/php-cgi
/tmp/php-cgi: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped

# ldd /tmp/php-cgi | head
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00335000)
libc-client.so.0 => /usr/lib/libc-client.so.0 (0x001c8000)
libexslt.so.0 => /usr/lib/libexslt.so.0 (0x00367000)
libz.so.1 => /usr/lib/libz.so.1 (0x00323000)
libm.so.6 => /lib/tls/libm.so.6 (0x002fe000)
libaspell.so.15 => /usr/lib/libaspell.so.15 (0x00767000)
libpspell.so.15 => /usr/lib/libpspell.so.15 (0x00111000)
librt.so.1 => /lib/tls/librt.so.1 (0x006b2000)
libmysqlclient.so.14 => /usr/lib/mysql/libmysqlclient.so.14
(0x00376000)
libmcrypt.so.4 => /usr/lib/libmcrypt.so.4 (0x00113000)

How can I compile statically the CGI version of PHP? Thanks!!

Regards,

--
Santi Saez
http://woop.es


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: How to pass POST data to php-cgi

2008-03-16 Thread Hui Chen
I solved the problem myself.

Following command works:

export CONTENT_LENGTH=4; export REQUEST_METHOD=POST; export SCRIPT_FILENAME=
test.php ; export CONTENT_TYPE=application/x-www-form-urlencoded;  echo s=44
| php-cgi

output:

X-Powered-By: PHP/5.2.3-1ubuntu6.3
Content-type: text/html

44

a working C fork/exec example is also attached.

=== test.c ===

#include 
#include 
#include 

main()
{
int outfd[2];
int infd[2];
int oldstdin, oldstdout;
pipe(outfd); // Where the parent is going to write to
pipe(infd); // From where parent is going to read
if(!fork())
{
close(0);
close(1);
dup2(outfd[0], 0); // Make the read end of outfd pipe as stdin
dup2(infd[1],1); // Make the write end of infd as stdout
setenv("CONTENT_LENGTH", "4", 1);
setenv("REQUEST_METHOD", "POST", 1);
setenv("SCRIPT_FILENAME", "test.php", 1);
setenv("CONTENT_TYPE", "application/x-www-form-urlencoded", 1);
execl("/usr/bin/php-cgi","/usr/bin/php-cgi", NULL);
}
else
{

char output[1000];
close(outfd[0]); // These are being used by the child
write(outfd[1],"s=444", 5); // Write to child's stdin
close(outfd[1]);
close(infd[1]);
output[read(infd[0],output,1000)] = 0; // Read from child's stdout
printf("%s", output);
}
}


On Sun, Mar 16, 2008 at 4:30 PM, Hui Chen <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I'm writing a simple httpd with php support via cgi/fastcgi. I tried
> several ways to pass POST data to php-cgi (by writing to child process's
> stdin from parent process), however, none of them worked
>
> Here's the most simple not working example:
>
> $ export CONTENT_LENGTH=4; export HTTP_METHOD=POST; echo 's=33' | php-cgi
> test.php
>
> and test.php has only one line:
>
> 
>
> Running it gave me:
>
> X-Powered-By: PHP/5.2.3-1ubuntu6.3
> Content-type: text/html
>
> 
> Notice:  Undefined index:  s in /home/chen/temp/test.php on
> line 1
>
> Please help me figure out what's missing. Part of php-cgi's phpinfo()
> output is attached, I will provide more if you need.
>
> Thanks in advance,
> Hui
>
> =phpinfo() output==
> _SERVER["TERM"]xterm
> _SERVER["SHELL"]/bin/bash
> _SERVER["SSH_TTY"]/dev/pts/1
> _SERVER["CONTENT_LENG"]4
> _SERVER["LD_LIBRARY_PATH"]/usr/local/lib
>
> _SERVER["LS_COLORS"]no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:
> _SERVER["LANG"]en_US.UTF-8
> _SERVER["HISTCONTROL"]ignoredups
> _SERVER["SHLVL"]1
> _SERVER["CONTENT_LENGTH"]4
> _SERVER["LESSOPEN"]| /usr/bin/lesspipe %s
> _SERVER["HTTP_METHOD"]POST
> _SERVER["CONTENT_TYPE"]application/x-www-f­orm-urlencoded
> _SERVER["LESSCLOSE"]/usr/bin/lesspipe %s %s
> _SERVER["_"]/usr/bin/php-cgi
> _SERVER["PHP_SELF"]no value
> _SERVER["REQUEST_TIME"]1205702297
> _SERVER["argv"]Array
> (
> [0] => phpinfo.php
> )
> 
>
> _SERVER["argc"]1
> _ENV["TERM"]xterm
> _ENV["SHELL"]/bin/bash
> _ENV["SSH_TTY"]/dev/pts/1
> _ENV["CONTENT_LENG"]4
> _ENV["LD_LIBRARY_PATH"]/usr/local/lib
>
> _ENV["LS_COLORS"]no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:
> _ENV["LANG"]en_US.UTF-8
> _ENV["HISTCONTROL"]ignoredups
> _ENV["SHLVL"]1
> _ENV["CONTENT_LENGTH"]4
> _ENV["LESSOPEN"]| /usr/bin/lesspipe %s
> _ENV["HTTP_METHOD"]POST
> _ENV["CONTENT_TYPE"]application/x-www-f­orm-urlencoded
> _ENV["LESSCLOSE"]/usr/bin/lesspipe %s %s
> _ENV["_"]/usr/bin/php-cgi
>
>


[PHP] How to pass POST data to php-cgi

2008-03-16 Thread Hui Chen
Hi,

I'm writing a simple httpd with php support via cgi/fastcgi. I tried several
ways to pass POST data to php-cgi (by writing to child process's stdin from
parent process), however, none of them worked

Here's the most simple not working example:

$ export CONTENT_LENGTH=4; export HTTP_METHOD=POST; echo 's=33' | php-cgi
test.php

and test.php has only one line:



Running it gave me:

X-Powered-By: PHP/5.2.3-1ubuntu6.3
Content-type: text/html


Notice:  Undefined index:  s in /home/chen/temp/test.php on
line 1

Please help me figure out what's missing. Part of php-cgi's phpinfo() output
is attached, I will provide more if you need.

Thanks in advance,
Hui

=phpinfo() output==
_SERVER["TERM"]xterm
_SERVER["SHELL"]/bin/bash
_SERVER["SSH_TTY"]/dev/pts/1
_SERVER["CONTENT_LENG"]4
_SERVER["LD_LIBRARY_PATH"]/usr/local/lib
_SERVER["LS_COLORS"]no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:
_SERVER["LANG"]en_US.UTF-8
_SERVER["HISTCONTROL"]ignoredups
_SERVER["SHLVL"]1
_SERVER["CONTENT_LENGTH"]4
_SERVER["LESSOPEN"]| /usr/bin/lesspipe %s
_SERVER["HTTP_METHOD"]POST
_SERVER["CONTENT_TYPE"]application/x-www-f­orm-urlencoded
_SERVER["LESSCLOSE"]/usr/bin/lesspipe %s %s
_SERVER["_"]/usr/bin/php-cgi
_SERVER["PHP_SELF"]no value
_SERVER["REQUEST_TIME"]1205702297
_SERVER["argv"]Array
(
[0] => phpinfo.php
)


_SERVER["argc"]1
_ENV["TERM"]xterm
_ENV["SHELL"]/bin/bash
_ENV["SSH_TTY"]/dev/pts/1
_ENV["CONTENT_LENG"]4
_ENV["LD_LIBRARY_PATH"]/usr/local/lib
_ENV["LS_COLORS"]no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:
_ENV["LANG"]en_US.UTF-8
_ENV["HISTCONTROL"]ignoredups
_ENV["SHLVL"]1
_ENV["CONTENT_LENGTH"]4
_ENV["LESSOPEN"]| /usr/bin/lesspipe %s
_ENV["HTTP_METHOD"]POST
_ENV["CONTENT_TYPE"]application/x-www-f­orm-urlencoded
_ENV["LESSCLOSE"]/usr/bin/lesspipe %s %s
_ENV["_"]/usr/bin/php-cgi


Re: [PHP] Re: php-cgi limitations

2006-03-09 Thread Max Schwanekamp

El Bekko wrote:

Max Schwanekamp wrote:
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, 

Are you sure that app won't work under PHP5?

Thanks for the reply.  The app in question is FogBugz, and they state 
emphatically that it does not yet work under PHP5.  I guess there's only 
one way to find out, really - test test test.


--
Max Schwanekamp
http://www.neptunewebworks.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php-cgi limitations

2006-03-09 Thread El Bekko

Max Schwanekamp wrote:
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... :)



Are you sure that app won't work under PHP5?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php-cgi limitations

2006-03-09 Thread Max Schwanekamp
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

2006-01-17 Thread Tim Traver

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

2006-01-10 Thread Tim Traver

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  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] Using .htaccess files with PHP CGI

2005-10-18 Thread Jason Kovacs
I am using PHP5 as a CGI and I can't seem to figure out
how to set INI values through httpd.conf or .htaccess files.
Since PHP isn't built as a module, the php_admin_value
and php_value directives don't exist.

If I had a module version of PHP along side the CGI, this
would not help because as far as I know Apache won't parse
those php directives and pass them to the CGI instance.

I know I can call the CGI binary using a Handler and pass
var=value arguments using the '-d' flag, but I want to be able
to set them differently per Virtual Host.

Specifically, I want to set 'session.save_path' for each virtual
host to a directory other than the one set in php.ini that only
apache can read/write to since my suexec'd php cgi binary
can only write session data to a directory owned by the
virtual host user.

How can this be done?  Any help would be appreciated, thanks.

-Jason Kovacs


Re: [PHP] cgi chmod problem

2005-09-25 Thread Al

Mikey wrote:

Al wrote:

I've got a php script that checks certain file permissions and if not 
OK for writing, chmods as required.


I can use ftp_site(); but, prefer not to because the code is not 
readily transportable.  Requires ftp login.


I'd like a simple cgi file that can be called by my script as needed.

My cgi file works OK if I call directly in my cgi-bin directory.  e.g.,


$file= '/EditPage/test2.php';
$perms= 0746;




if(!file_exists($pfile)) echo "font-weight:bold\">$pfile does not exist.";

chmod($pfile, $perms);

echo "New file permissions for $pfile:  ". substr(sprintf('%o', 
fileperms($pfile)), -3);




But, I can't get the cgi file to execute when using "include 
/path/perm.cgi". in the php test function.


I guess it is because the cgi assumes it is running in the directory 
with the php that called it.


Linux php3.9.11 virtual host

Anyone have a suggestion. 



My guess would be that your webserver isn't running as the same user as 
your shell account - for details on how to fix this, please have go at 
STFA,


Mikey

They are the same.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cgi chmod problem

2005-09-25 Thread Mikey

Al wrote:

I've got a php script that checks certain file permissions and if not 
OK for writing, chmods as required.


I can use ftp_site(); but, prefer not to because the code is not 
readily transportable.  Requires ftp login.


I'd like a simple cgi file that can be called by my script as needed.

My cgi file works OK if I call directly in my cgi-bin directory.  e.g.,


$file= '/EditPage/test2.php';
$perms= 0746;



if(!file_exists($pfile)) echo "font-weight:bold\">$pfile does not exist.";

chmod($pfile, $perms);


echo "New file permissions for $pfile:  ". substr(sprintf('%o', 
fileperms($pfile)), -3);



But, I can't get the cgi file to execute when using "include 
/path/perm.cgi". in the php test function.


I guess it is because the cgi assumes it is running in the directory 
with the php that called it.


Linux php3.9.11 virtual host

Anyone have a suggestion. 


My guess would be that your webserver isn't running as the same user as 
your shell account - for details on how to fix this, please have go at STFA,


Mikey

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cgi chmod problem

2005-09-25 Thread Al

I've got a php script that checks certain file permissions and if not OK for 
writing, chmods as required.

I can use ftp_site(); but, prefer not to because the code is not readily 
transportable.  Requires ftp login.

I'd like a simple cgi file that can be called by my script as needed.

My cgi file works OK if I call directly in my cgi-bin directory.  e.g.,


$file= '/EditPage/test2.php';
$perms= 0746;



if(!file_exists($pfile)) echo "$pfile does not 
exist.";

chmod($pfile, $perms);

echo "New file permissions for $pfile:  ". substr(sprintf('%o', 
fileperms($pfile)), -3);


But, I can't get the cgi file to execute when using "include /path/perm.cgi". 
in the php test function.

I guess it is because the cgi assumes it is running in the directory with the 
php that called it.

Linux php3.9.11 virtual host

Anyone have a suggestion.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] CGI vs Apache module

2004-12-14 Thread Sandy Keathley
We have a Redhat server, which only allows PHP 4.3.2 to be 
installed by RPM.  I manually compiled and installed 4.3.9 using 
the configure params as the RPM install.  It compiled the CGI 
version, which seems to run, but Apache (2.0) doesn't recognize it.
phpinfo() still reports 4.3.2.

Any ideas accepted on making 4.3.9 the default version!

Thanks,

Sandy Keathley

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] CGI vs Apache module

2004-12-14 Thread Richard Lynch
Sandy Keathley wrote:
> We have a Redhat server, which only allows PHP 4.3.2 to be
> installed by RPM.  I manually compiled and installed 4.3.9 using
> the configure params as the RPM install.  It compiled the CGI
> version, which seems to run, but Apache (2.0) doesn't recognize it.
> phpinfo() still reports 4.3.2.
>
> Any ideas accepted on making 4.3.9 the default version!

Unless you actually *WANT* PHP as CGI, go back and re-compile as Module.

Right before you do "make install" you'll need to RPM un-install PHP, so
you don't confuse things.

You'll need to re-start Apache for sure, and if that doesn't work, you may
need to change the httpd.conf settings by hand.

I don't know where RPM-makers hide your httpd.conf file, but you should be
able to find it and edit it to find the PHP parts and fix them up.

-- 
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


Re: [PHP] CGI vs Apache module

2004-12-14 Thread Greg Donald
On Tue, 14 Dec 2004 15:09:21 -0600, Sandy Keathley
<[EMAIL PROTECTED]> wrote:
> We have a Redhat server, which only allows PHP 4.3.2 to be
> installed by RPM.  I manually compiled and installed 4.3.9 using
> the configure params as the RPM install.

Did you remove the PHP rpm(s) first?

> It compiled the CGI
> version, which seems to run, but Apache (2.0) doesn't recognize it.
> phpinfo() still reports 4.3.2.

Did you restart Apache?

> Any ideas accepted on making 4.3.9 the default version!

What was your ./configure command?


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP-CGI: custom 404 error?

2004-10-15 Thread Christophe Chisogne
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: custom 404 error?

2004-10-15 Thread Jared
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



[PHP] CGI / PHP max_exec_time

2004-07-17 Thread Head
hello list,

im running a php script from CLI/CGI on linux which has a variable execution
time, some times it doesnt terminates by itself so i have to set a
max_execution_time to terminate the script. My problem is that the
max_exec_time on CGI versions is always 0 (never time out) which produces
zombie php prozesses.

any help/sugesstions ?

thanks - Head

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP cgi

2004-07-02 Thread Vail, Warren
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



Re: [PHP] PHP cgi

2004-07-02 Thread Curt Zirzow
* 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] PHP cgi

2004-07-02 Thread 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?

TIA,
Steve


[PHP] php-cgi+suexec and fastcgi

2004-06-04 Thread Adrian Teasdale
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+suexec and fastcgi

2004-06-04 Thread Adrian Teasdale
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, apache suexec, filesystem problems

2004-05-21 Thread Peter Risdon
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] creation of php-cli and php-cgi

2004-04-19 Thread Carel, Michael P. (Digitel-GSM)
Hi,

I'm having a problem compiling php with cli and cgi support. When i compiled
php in redhat 7.3 it creates both php-cgi and php-cli in sapi/cgi and
sapi/cli directories, but when i compiled it in Redhat Advance  Server only
php-cli was created. I used the same config command parameters in both Linux
version. Is there a way that i can surely create both of this? I need
php-cgi in running php scripts in a nanoweb server.

Please help us and thanks in advance..

Below is the configure parameters that i used in php-4.3.6:
./configure --with-mysql --with-apache=../apache_1.3.XX --with-gd
--with-jpeg-dir=ext/gd/libgd --with-zlib --with-cgi --enable-cgi
--enable-cli --enable-sockets --enable-pcntl 




Regards,
Mike

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] CGI Error

2004-03-23 Thread Alex Hogan
Hi All,

I am getting this error when I trying to pass some url params;

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:

And nothing

Has anybody seen this before?  I did a search and it seems that there are a
few references to it, but nobody seems to have an explanation.

alex hogan


** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
** 




RE: [PHP] cgi error --- please help

2004-01-28 Thread Gryffyn, Trevor
Odd that it would work after you hit REFRESH, though.  If it was the CLI
version, wouldn't youg et the bad headers error every time you refreshed
the browser?

Could always try manually initiating the headers using the header()
command.  That may be your own course of action if, for some reason, you
don't have access to the web server and the installation of PHP there to
upgrade it to the proper version..  Or if you just can't figure out why
it's giving you this error, header() might be a workaround.

-TG


> -Original Message-
> From: Len Borowski [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, January 28, 2004 4:52 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] cgi error --- please help
> 
> 
> I recently had this error. Turns out that my php binary was the
> CLI(command line interface only) version, not the cgi version 
> and so it
> wasn't sending the headers before parsing the php file.  You 
> should look
> at getting the right php binary.
> 
> Also, if you have a question, you don't make 2 seperate posts 
> asking the
> same question.
> 
> -Len
> 
> 
> 
> On Wed, 2004-01-28 at 15:17, Dale Hersh wrote:
> > CGI Error
> > The specified CGI application misbehaved by not returning a 
> complete set of
> > HTTP headers.
> > 
> > I am getting this error and I can't figure out what is 
> causing the problem.
> > If I hit refresh on the broswer, the page loads just fine. 
> Any ideas???
> > 
> > Thanks,
> > Dale
> > 
> > RUNNING IIS 6.0 & MSSQL 2000
> 
> -- 
> 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] cgi error --- please help

2004-01-28 Thread Len Borowski
I recently had this error. Turns out that my php binary was the
CLI(command line interface only) version, not the cgi version and so it
wasn't sending the headers before parsing the php file.  You should look
at getting the right php binary.

Also, if you have a question, you don't make 2 seperate posts asking the
same question.

-Len



On Wed, 2004-01-28 at 15:17, Dale Hersh wrote:
> CGI Error
> The specified CGI application misbehaved by not returning a complete set of
> HTTP headers.
> 
> I am getting this error and I can't figure out what is causing the problem.
> If I hit refresh on the broswer, the page loads just fine. Any ideas???
> 
> Thanks,
> Dale
> 
> RUNNING IIS 6.0 & MSSQL 2000

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] cgi error --- please help

2004-01-28 Thread Dale Hersh
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers.

I am getting this error and I can't figure out what is causing the problem.
If I hit refresh on the broswer, the page loads just fine. Any ideas???

Thanks,
Dale

RUNNING IIS 6.0 & MSSQL 2000

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] CGI ERROR

2004-01-28 Thread Dale Hersh
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers.

I am getting this error and I can't figure out what is causing the problem.
If I hit refresh on the broswer, the page loads just fine. Any ideas???

Thanks,
Dale

RUNNING IIS6.0 & MSSQL 2000

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] CGI Error -- need some ideas

2004-01-28 Thread Dale
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers.

I am getting this error and I can't figure out what is causing the problem.
If I hit refresh on the broswer, the page loads just fine. Any ideas???

Thanks,
Dale

NOTE:
RUNNING IIS 6.0 WITH MSSQL 2000 ON NEW DELL SERVER

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] CGI ERROR

2004-01-27 Thread - Edwin -
On Tue, 27 Jan 2004 18:41:39 -0800
"Dale Hersh" <[EMAIL PROTECTED]> wrote:

> CGI Error
> The specified CGI application misbehaved by not returning a
> complete set of HTTP headers.
> 
> I am getting this error and I can't figure out what is causing
> the problem. If I hit refresh on the broswer, the page loads
> just fine. Any ideas???

A bug on your server? A bug on your browser? A bug on your
script? ...

--

- E -
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] CGI ERROR

2004-01-27 Thread Dale Hersh
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers.

I am getting this error and I can't figure out what is causing the problem.
If I hit refresh on the broswer, the page loads just fine. Any ideas???

Thanks,
Dale

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Headers and sessions in php .cgi

2004-01-10 Thread Justin Patrin
BøRge Strand wrote:
Hi there,

I have a problem setting my headers right with php running as .cgi. I
have to specify a Content-type for the cgi file to work. But how
should I do both that and start a session?
I have a few options:

#! /usr/local/bin/php

This way $_SESSION['count'] stays unset even though I say
$_SESSION['count'] = 1; in my program.
To swap the two lines won't work because I heard \n\n terminates the
header portion. Anyway, here goes:
#! /usr/local/bin/php

Now I get "Warning: session_start(): Cannot send session cookie -
headers already sent by... line 3" and then "Warning: session_start():
Cannot send session cache limiter - headers already sent...".
I have tried replacing print 'Content-type: text/html' . "\n\n"; by
print 'Content-type: text/html' . "\n"; (one \n instead of two) with
exactly the same result. With no \n at all I only get "Warning:
session_start(): Cannot send session cache limiter - headers already
sent".
The next thing I try is to replace print 'Content-type: text/html' and
the \n's by sending the same text in header(). This variety gives me a
"500 Internal Server Error" independant on the number of \n's.
Anyway, here's all my code. No matter what I do it always prints "Your
visit number 1". $_SESSION['count'] doesn't get increased at all!

#! /usr/local/bin/php
' . "\n";
print '' . "\n";
if (!isset($_SESSION['count']))
{
$_SESSION['count'] = 1;
}
else
{
$_SESSION['count']++;
}
print 'Your visit number ' . $_SESSION['count'] . "\n";
print '' . "\n";
print '' . "\n";
?>

I hope you can help me out getting my headers straight.

Regards, 

Børge
You should be using header as such:

header('Content-type: text/html');

You don't need and should not include the newlines. The reason that 
other things aren't set is that two newlines ends headers (includeing 
cookies and such) which breaks sessions.

If you simply use header() all of this is dealt with for you as it 
should be. Just make sure that you don't print or echo anything before 
using it (or starting a session).

--
paperCrane 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Headers and sessions in php .cgi

2004-01-10 Thread Børge Strand

> > I have a problem setting my headers right with php running as
> > .cgi. I have to specify a Content-type for the cgi file to work.
> > But how should I do both that and start a session?
> 
> Try using header() instead of print to set Content-Type.
> 
> Hope that helps.

Thanks Chris. I tried that (see original post). Then I get a 500 error
in my browser and bad header in error_log.

Guess I'll have to take session_start() apart and see what it does.
This all worked in 4.2, though, where I used .cgi files without a
die-hard need for Content-type.

As I said in a previous post, everything works when I run my program
as a .php file without Content-type. So I guess there's a conflict
between the Content-type header and those inserted by session_start()
in 4.3.4.

Thanks for any help, I'm on a bad deadline and my ISP changed PHP
version without telling!

-- 
Børge

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Headers and sessions in php .cgi

2004-01-10 Thread Børge Strand

> >I have a problem setting my headers right with php running as .cgi. I
> >have to specify a Content-type for the cgi file to work. But how
> >should I do both that and start a session?
> >
> >I have a few options:
> >
> >#! /usr/local/bin/php
> > >session_start();
> >print 'Content-type: text/html' . "\n\n";
> >
> >This way $_SESSION['count'] stays unset even though I say
> >$_SESSION['count'] = 1; in my program.
> >
> >To swap the two lines won't work because I heard \n\n terminates the
> >header portion. Anyway, here goes:
> 
> Stupid question: Have you tried

Well, there's one thing I have found out here and that is that there's
no such thing as a stupid question. I've tried searching for
Content-type and session_start without getting any wiser :-(

> header ('Content-type: text/html');
> 
> I'm pretty sure it will work.

Tried it, didn't word I'm afraid. The text inside doesn't contain
anything that's treated differently by " and '. 


--
Børge

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Headers and sessions in php .cgi

2004-01-10 Thread Chris Shiflett
--- Børge Strand <[EMAIL PROTECTED]> wrote:
> I have a problem setting my headers right with php running as
> .cgi. I have to specify a Content-type for the cgi file to work.
> But how should I do both that and start a session?

Try using header() instead of print to set Content-Type.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
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] Headers and sessions in php .cgi

2004-01-10 Thread David Otton
On Sat, 10 Jan 2004 17:44:18 +0100 (MET), you wrote:

>I have a problem setting my headers right with php running as .cgi. I
>have to specify a Content-type for the cgi file to work. But how
>should I do both that and start a session?
>
>I have a few options:
>
>#! /usr/local/bin/php
>session_start();
>print 'Content-type: text/html' . "\n\n";
>
>This way $_SESSION['count'] stays unset even though I say
>$_SESSION['count'] = 1; in my program.
>
>To swap the two lines won't work because I heard \n\n terminates the
>header portion. Anyway, here goes:

Stupid question: Have you tried

header ('Content-type: text/html');

I'm pretty sure it will work.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Headers and sessions in php .cgi

2004-01-10 Thread Børge Strand

Hi there,

I have a problem setting my headers right with php running as .cgi. I
have to specify a Content-type for the cgi file to work. But how
should I do both that and start a session?

I have a few options:

#! /usr/local/bin/php
' . "\n";
print '' . "\n";

if (!isset($_SESSION['count']))
{
$_SESSION['count'] = 1;
}
else
{
$_SESSION['count']++;
}

print 'Your visit number ' . $_SESSION['count'] . "\n";
print '' . "\n";
print '' . "\n";
?>


I hope you can help me out getting my headers straight.


Regards, 

Børge

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Different php.ini with php - cgi

2003-12-10 Thread Bc. Radek Krejča
Hello,

  I have PHP as Apache so and I wand to use it in the command line as
  CGI. As apache module I have running with safe mode in the command
  line I want to use PHP without SAFE MODE. My PHP is compiled with so
  modules.

  If I use this construction:

  #!/usr/local/bin/php -c /root/ -q
  http://www.ceskedomeny.cz
 http://www.skdomeny.com
 http://www.starnet.cz
 ICQ: 65895541 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] CGI script not running under suexec

2003-12-05 Thread Anas Mughal
I had been running a CGI version of PHP version 3 for many months with 
no issues. (I had custom extensions in the CGI version.)

Well, my hosting company decided to enable suexec on Apache (running on 
Redhat Linux). As I understand, with suexec enabled, only the owner of a 
particular CGI script can execute that script.

Well, we have made sure that the script is owned by the appropriate user 
and group. Unfortunately, we keep on getting the following error:

>>>
Internal Server Error
The server encountered an internal error or misconfiguration and was 
unable to complete your request.

Please contact the server administrator, [EMAIL PROTECTED] and 
inform them of the time the error occurred, and anything you might have 
done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use 
an ErrorDocument to handle the request.
<<<

suexec_log has the following log message:

[2003-12-05 09:22:52]: info: (target/actual) uid: (islamicv/islamicv) 
gid: (islamicv/islamicv) cmd: iv_php
[2003-12-05 09:22:52]: error: cannot stat program: (iv_php)

apache error_log file has the following message:

[Fri Dec  5 09:26:06 2003] [error] [client 67.85.201.18] Premature end 
of script headers: /web/islamicv/public_html/cgi-bin/iv_php



Could someone please advise as to what is going wrong?
(I did NOT modify this script for months. It works fine when suexec is 
swithced off.)

Thank you very much.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] CGI error when loading iFRAME

2003-11-15 Thread Marek Kilimajer
Miroslav I. wrote:
Hi, people

#The problem:
There is an error message that stops proper loading of one iFRAME, I
couldn't understand what is the problem.
Complete error message issued:
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:<<
###Additional:
PHP Version 4.3.3 is running on Windows 2000 server
This is a common problem with php on iis, google for the error string to 
get possible solutions.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] CGI error when loading iFRAME

2003-11-14 Thread Miroslav I.

Hi, people

#The problem:
There is an error message that stops proper loading of one iFRAME, I
couldn't understand what is the problem.
Complete error message issued:
>>CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:<<

- In one of two FRAMEs of "main.PHP" , "zero.PHP" page is loaded.
- "zero.PHP" has 3 iFRAMEs.
- Both the first and the second iframe has its own self refering PHP file
(if one of the PHP files name is "first.PHP" its form has:
action="first.PHP").
- One of the PHP files, e.g.: "first.PHP" loads the "third.PHP" file in the
third iFRAME when a condition was met, using expression like:
echo 'top.frames[1].frames[1].location="third.PHP";
';
- Sometimes loading of the "third.PHP" issues mentioned CGI error.

##What is the problem, why the error?

###Additional:
PHP Version 4.3.3 is running on Windows 2000 server

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php cgi

2003-10-23 Thread Michael P. Carel
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



Re: [PHP] php cgi configuration w/ htaccess

2003-10-20 Thread Curt Zirzow
* 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
\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



[PHP] php cgi configuration w/ htaccess

2003-10-20 Thread Andrew Warner
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] CGI Error, IIS

2003-09-14 Thread John W. Holmes
nabil wrote:

Why this happen with me with IIS
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Although it's not a bug, read this:

http://bugs.php.net/bug.php?id=12061

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] CGI Error, IIS

2003-09-14 Thread Curt Zirzow
* Thus wrote nabil ([EMAIL PROTECTED]):
> Why this happen with me with IIS
> CGI Error
> The specified CGI application misbehaved by not returning a complete set of
> HTTP headers. The headers it did return are:

check your IIS logs.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] CGI Error, IIS

2003-09-14 Thread nabil
Why this happen with me with IIS
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] CGI timeout problem

2003-07-29 Thread John W. Holmes
imran wrote:
CGI Timeout

The specified CGI application exceeded the allowed time for processing.
The server has deleted the process.
"
does it mean that I have to use set_time_limit so the script doesn't time out ? I don't really understand why I should do that.
You may be reaching an IIS imposed time limit instead of a PHP one. 
Usually the PHP error is different (but I use ISAPI instead of CGI).

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] CGI timeout problem

2003-07-29 Thread imran
hello,

I wrote a very simple upload script and it perfectly works for small files. But if the 
file is too huge (I tried with 8Mbytes), my browser displays:
"
The page cannot be displayed
...
Cannot find server or DNS Error
Internet Explorer 
"

instead of uploading the file and submitting the form to my "upload.php" file. I set 
my upload_max_size to 10MB both in php.ini and in my form. And my web server is 
running under IIS 5.

here is one of my user feedback:
"
CGI Timeout

The specified CGI application exceeded the allowed time for processing.
The server has deleted the process.
"

does it mean that I have to use set_time_limit so the script doesn't time out ? I 
don't really understand why I should do that.

thanks,



[PHP] CGI Timeout

2003-07-29 Thread imran
Hi,
i facing a error during uploading a big size file (abt 200 MB). i incred =
upload file size in php.ini and also incred connection time in IIS (web =
server), but i getting again this below written error msg.

any one known abt this...

CGI Timeout
The specified CGI application exceeded the allowed time for processing. The server has 
deleted the process.


thnx

gnome






Re: [PHP] PHP CGI mode and command line variables

2003-07-24 Thread CDitty
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:


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

2003-07-23 Thread Chris Shiflett
--- 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:



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

2003-07-23 Thread CDitty
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

2003-07-23 Thread Chris Shiflett
--- 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



[PHP] PHP CGI mode and command line variables

2003-07-23 Thread CDitty
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


[PHP] problem: The PHP CGI cannot be accessed directly.

2003-07-15 Thread pehepe php
My system is windows 98 second edition
im using pws
i built php 4.2.2
when ý struggle to reach any .php file for example 127.0.0.1/sample.php
this error occur:


Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means 
that a page will only be served up if the REDIRECT_STATUS CGI variable is 
set, e.g. via an Apache Action directive.

_
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Piping to a PHP cgi-binary... broken in v4.3.2?

2003-02-24 Thread Dan Hardiker
Hey all,

echo "" | /path/to/php

That works on php v4.2.x but Ive got 3 machines on v4.3.x and none of them
seem to respond to the piping of the php config.


v4.2.x Response

[13:56:[EMAIL PROTECTED]:~$ echo "" |
/usr/local/bin/php
X-Powered-By: PHP/4.2.3
Content-type: text/html

hi[13:56:[EMAIL PROTECTED]:~$

v4.3.x Response

[13:58:[EMAIL PROTECTED]:~$ echo "" |
/usr/local/bin/php
Status: 404
Content-type: text/html
X-Powered-By: PHP/4.3.2-dev

No input file specified.
[13:59:[EMAIL PROTECTED]:~$


Anyone else with the same results on a v4.3.x cgi-binary?
Is this modified behavoir limited to me, or expected?


-- 
Dan Hardiker [EMAIL PROTECTED]
ADAM Software & Systems Engineer
First Creative



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php ISA v.s. php CGI

2003-01-31 Thread Victor
What is the difference between PHP ISAPI filter and PHP CGI (which one
would be better to install on IIS 5?)

-thanks,

- vic

__ 
Post your free ad now! http://personals.yahoo.ca

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP_SELF on a php CGI

2002-12-10 Thread info
Hello Leif, hello all,

i compiled successfully php-4.3-dev deom tarball as CGI  on RedHat7.3

register_globals is on

And here is how my php behave:

When I run the following script: info70.php

1) from commandline
then  [SCRIPT_NAME] => info70.php
is set correctly

2) direkt via http request from browser
then PHP_SELF = htdocs3/bildvote/admin/info70.php

zend and php-logo isn´t depicted.

3) via http script is in the htdocs (/usr/local/apache/htdocs) directory
  PHP_SELF = 

What can I do? How can I use the superglobal array?

Oliver Etzel
.eu-Domains are coming
www.t-host.com




[PHP] Re: php cgi question - solved

2002-10-16 Thread David Cook

Well I sorted out the permissions on that directory structure, and the web
based cgi performed as the command line one did, I havent had too long to
find out if any weird things are going to start happening with the mail
apps, but I'm hopeful that this was the solution...

Thanks for all the help Marco (even if it did end up being a umm bit O/T as
far as php went... sorry :(

Regards

David Cook
"David Cook" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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] Re: php cgi question

2002-10-14 Thread David Cook

Okies, FINALLY I think I have the reason (though not the solution as yet)

Marco, you were spot on, which I hadn't pursued properly, only looking at
the immediate parent directory permissions. In fact the whole ~vpopmail
structure down to the individual users directory has a VERY restrictive set
of permissions only the owner (vpopmail) can list read and write to any of
the directories leading down to the
~vpopmail/domains/some.email.domain/some.user/ etc.. etc... no group
permissions at ALL.

I have asked on the vpopmail list what the effect may be of re-setting group
list access (at least) to the structure may be as I dont want to break
anything on a running server... lol... so yep.. permissions it was indeed
(apparantly anyways), I reckon this is a proven case now, just got to work
out the solution as I can't setuid for a web enabled cgi to the vpopmail
user without getting stuck in suEXEC etc...

I dont know why the heck I hadnt tried just cat'ing the file.. lack of sleep
perhaps.. lol

Will let you know how it goes (if you are interested)

Regards, and thanks for all the help
David Cook

"Marco Tabini" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Ok, that's a big step forward then. It's possible that your user does
> not have access to the directory tree where the file resides? Have you
> tried listing that directory and or opening the file (for example with
> cat) while using that file? If you can narrow it down to a permission
> problem (and, at this point, I think that's exactly where the problem
> is), that it should just be a matter of trying a few things out.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: php cgi question

2002-10-13 Thread Marco Tabini

Ok, that's a big step forward then. It's possible that your user does
not have access to the directory tree where the file resides? Have you
tried listing that directory and or opening the file (for example with
cat) while using that file? If you can narrow it down to a permission
problem (and, at this point, I think that's exactly where the problem
is), that it should just be a matter of trying a few things out.


On Sun, 2002-10-13 at 23:23, David Cook wrote:
> hmmm safe mode is disabled - for the apache module version
> 
> from phpinfo()
> safe_mode Off Off
> 
> > Just out of curiosity--have you tried su-ing to the Apache user and
> > executing your script as that user?
> yep, same result (although I had to change the apache user for a few minutes
> so it had a shell.. lol) as if I ran it off the web (file does not exist),
> this still seems to tie into permissions perhaps, but I am having trouble
> nailing enough data down so far to point to specifics.
> 
> I didnt make this server from scratch, it came pre-installed with a lot of
> the items on it as part of a co-lo deal, the next few I build however will
> be from the ground up even if it takes longer... and probably without using
> RPM's for a lot of it... I've learned a fair bit the last 9 months or so
> about the shortcomings as well as the benefits of using RPM's.
> 
> Thanks again for the thoughts, will test out some more stuff (this is just
> plain getting me determined to work it out... stubborn I spose)
> 
> Regards
> 
> David
> 
> 
> 
> -- 
> 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] Re: php cgi question

2002-10-13 Thread David Cook

hmmm safe mode is disabled - for the apache module version

from phpinfo()
safe_mode Off Off

> Just out of curiosity--have you tried su-ing to the Apache user and
> executing your script as that user?
yep, same result (although I had to change the apache user for a few minutes
so it had a shell.. lol) as if I ran it off the web (file does not exist),
this still seems to tie into permissions perhaps, but I am having trouble
nailing enough data down so far to point to specifics.

I didnt make this server from scratch, it came pre-installed with a lot of
the items on it as part of a co-lo deal, the next few I build however will
be from the ground up even if it takes longer... and probably without using
RPM's for a lot of it... I've learned a fair bit the last 9 months or so
about the shortcomings as well as the benefits of using RPM's.

Thanks again for the thoughts, will test out some more stuff (this is just
plain getting me determined to work it out... stubborn I spose)

Regards

David



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: php cgi question

2002-10-13 Thread Marco Tabini

I think you might be unable to access documents outside the root if
you're in safe mode.

Just out of curiosity--have you tried su-ing to the Apache user and
executing your script as that user?

On Sun, 2002-10-13 at 21:36, David Cook wrote:
> Hi again all
> 
> Just a bit more info, trying to track some more things down.
> 
> I made a few changes, changed getmail so that it would allow the getmailrc
> file to be group writable, made a few changes to the user/group structure
> (including making apache a member of a specific new group, and then setting
> that group read/write on the getmailrc file (in theory now, apache should
> have read/write permissions to the file via the group), and did a bit more
> testing.
> 
> Results,
> 
> Executing the cgi script from command line still works (in that it displays
> results, whereas from the web the cgi STIL says that the file doesnt exist
> (this is via a quick if(file_exists($getmailfile)) etc.. etc..(least I didnt
> break anything else) :)
> 
> I find this interesting, as the file definately DOES exist, and further,
> theoretically the web server should have access via the group permissions.
> 
> I was a little curious if this may be a bahaviour of the apache php module,
> in that it is incapable of working with files outside docroot? this should
> not be the case though, as with a number of the other modules I am using,
> and have written, files get written to temp (while they are being uploaded)
> and other files are written outside docroot for other purposes, without any
> real problems so far, this is getting curiouser and curiouser as Alice said
> 
> Any suggestions or thoughts anyone?
> 
> Puzzled.
> 
> 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] Re: php cgi question

2002-10-13 Thread David Cook

Hi again all

Just a bit more info, trying to track some more things down.

I made a few changes, changed getmail so that it would allow the getmailrc
file to be group writable, made a few changes to the user/group structure
(including making apache a member of a specific new group, and then setting
that group read/write on the getmailrc file (in theory now, apache should
have read/write permissions to the file via the group), and did a bit more
testing.

Results,

Executing the cgi script from command line still works (in that it displays
results, whereas from the web the cgi STIL says that the file doesnt exist
(this is via a quick if(file_exists($getmailfile)) etc.. etc..(least I didnt
break anything else) :)

I find this interesting, as the file definately DOES exist, and further,
theoretically the web server should have access via the group permissions.

I was a little curious if this may be a bahaviour of the apache php module,
in that it is incapable of working with files outside docroot? this should
not be the case though, as with a number of the other modules I am using,
and have written, files get written to temp (while they are being uploaded)
and other files are written outside docroot for other purposes, without any
real problems so far, this is getting curiouser and curiouser as Alice said

Any suggestions or thoughts anyone?

Puzzled.

David Cook



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php cgi question

2002-10-13 Thread Marco Tabini

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 question

2002-10-13 Thread David Cook

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

2002-10-13 Thread David Cook

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




Re: [PHP] php cgi question

2002-10-13 Thread Marco Tabini

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




[PHP] Re: php cgi question

2002-10-13 Thread David Cook

Just a quick addition, both the submit/link were very basic, they both
worked like this


$location = "/cgi-bin/getmailtest.cgi";
// $location = "getmail.php";
echo "$location";
print("Click here to test the cgi\n");

print("");
print("press the button to try the cgi as a redirect this way");
print("");

(that was because I was messing round with differing locations of the cgi,
different extensions etc.. made it easier to set the actual cgi as a
variable, thats all)

Eventually if I can get this to work, it will have to accept a variable as
well being passed (the identifier), something like
getmailtest.cgi?id=$identifier

Thanks again

Hope someone can help

David Cook





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Calling PHP (cgi) from a perl script and passsing parameters

2002-10-10 Thread Jim Carey

sorry - seems my earlier post was base64 - apologies to all :-( - here it is
again


yes - am using 4.2.1

output from phpinfo() shows:

_SERVER["argv"] Array
(
)

_SERVER["argc"] 0

which agrees with the $argc and $argv output.

details on the build include:

Build Date Jul 18 2002 08:29:02
Configure Command './configure' '--prefix=/usr/local/php'
'--with-config-file-path=/usr/local/bin/' '--enable-ftp' '--without-gd'
'--with-mysql'
Server API CGI

the php.ini shows register_globals on and register_argc_argv on

works fine if I call the php mod directly from the command line - and parses
the passed variable fine - just doesnt do it when called using the tick (or
system function) from Perl


Jim Carey
www.OZbcoz.com discount domain registration



> -Original Message-
> From: Sascha Cunz [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 11 October 2002 9:28 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] Calling PHP (cgi) from a perl script and passsing
> parameters
>
>
> What you're referring is CLI, not CGI Version of PHP.
>
> Anyway, i assume, you're using a PHP version 4.2 or higher.
> Have a look at the $_SERVER['argc'] and $_SERVER['argv'].
>
> Sascha
>
> Am Donnerstag, 10. Oktober 2002 23:57 schrieb Jim Carey:
> > Hi,
> >
> > have been having problems passing parameters to a PHP script from a Perl
> > script . I call the PHP script using (as an example):
>
> > $a=`/home/ozbcoz/http/testphp.php fred=testing`;
> > print "$a";
> >
> >
> > then I have a PHP script showing:
> >
> > #!/usr/local/php/bin/php -q
> >  >
> > print "count=$argc";
> > print "0=$argv[0]";
> > print "1=$argv[1]";
> > print "2=$argv[2]";
> > phpinfo();
> > ?>
> >
> > the outout comes out as:
> >
> > count=0
> > 0=
> > 1=
> > 2=
> > plus the phpinfo bumpf - which shows argc as 0 and an empty
> array for argv
> >
> > sny clues anyone ?
> >
> > Jim Carey
> > www.OZbcoz.com discount domain registration
> >
>
>
> --
> 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] Calling PHP (cgi) from a perl script and passsing parameters

2002-10-10 Thread Jim Carey

yes - am using 4.2.1

output from phpinfo() shows:

_SERVER["argv"] Array
(
)
  
_SERVER["argc"] 0  

which agrees with the $argc and $argv output.

details on the build include:

Build Date Jul 18 2002 08:29:02 
Configure Command './configure' '--prefix=/usr/local/php' 
'--with-config-file-path=/usr/local/bin/' '--enable-ftp' '--without-gd' '--with-mysql' 
 
Server API CGI 

the php.ini shows register_globals on and register_argc_argv on

works fine if I call the php mod directly from the command line - and parses the 
passed variable fine - just doesnt do it when called using the tick (or system 
function) from Perl


Jim Carey
www.OZbcoz.com discount domain registration



> -Original Message-
> From: Sascha Cunz [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 11 October 2002 9:28 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] Calling PHP (cgi) from a perl script and passsing
> parameters
> 
> 
> What you're referring is CLI, not CGI Version of PHP.
> 
> Anyway, i assume, you're using a PHP version 4.2 or higher.
> Have a look at the $_SERVER['argc'] and $_SERVER['argv'].
> 
> Sascha
> 
> Am Donnerstag, 10. Oktober 2002 23:57 schrieb Jim Carey:
> > Hi,
> > 
> > have been having problems passing parameters to a PHP script from a Perl
> > script . I call the PHP script using (as an example):
>  
> > $a=`/home/ozbcoz/http/testphp.php fred=testing`; 
> > print "$a"; 
> > 
> > 
> > then I have a PHP script showing: 
> > 
> > #!/usr/local/php/bin/php -q 
> >  >  
> > print "count=$argc"; 
> > print "0=$argv[0]"; 
> > print "1=$argv[1]"; 
> > print "2=$argv[2]"; 
> > phpinfo(); 
> > ?> 
> > 
> > the outout comes out as: 
> > 
> > count=0 
> > 0= 
> > 1= 
> > 2= 
> > plus the phpinfo bumpf - which shows argc as 0 and an empty 
> array for argv
> > 
> > sny clues anyone ?
> > 
> > Jim Carey
> > www.OZbcoz.com discount domain registration
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


Re: [PHP] Calling PHP (cgi) from a perl script and passsing parameters

2002-10-10 Thread Sascha Cunz

What you're referring is CLI, not CGI Version of PHP.

Anyway, i assume, you're using a PHP version 4.2 or higher.
Have a look at the $_SERVER['argc'] and $_SERVER['argv'].

Sascha

Am Donnerstag, 10. Oktober 2002 23:57 schrieb Jim Carey:
> Hi,
> 
> have been having problems passing parameters to a PHP script from a Perl
> script . I call the PHP script using (as an example):
 
> $a=`/home/ozbcoz/http/testphp.php fred=testing`; 
> print "$a"; 
> 
> 
> then I have a PHP script showing: 
> 
> #!/usr/local/php/bin/php -q 
>   
> print "count=$argc"; 
> print "0=$argv[0]"; 
> print "1=$argv[1]"; 
> print "2=$argv[2]"; 
> phpinfo(); 
> ?> 
> 
> the outout comes out as: 
> 
> count=0 
> 0= 
> 1= 
> 2= 
> plus the phpinfo bumpf - which shows argc as 0 and an empty array for argv
> 
> sny clues anyone ?
> 
> Jim Carey
> www.OZbcoz.com discount domain registration
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




  1   2   3   >