Try replacing
#!/usr/bin/php
with
#!/usr/bin/php-cgi
In your script. This should fix your issues :)



________________________________
From: Rueyan Yeh <[email protected]>
To: Daniel Lo Nigro <[email protected]>
Cc: [email protected]
Sent: Thu, 9 June, 2011 1:07:46 PM
Subject: Re: [Cherokee] Help for the PHP CGI program

Hi Daniel,

   Thanks for the information.
   The following is my PHP version:
-------------------------------------------
/ # php -v
PHP 5.3.6 (cli) (built: Mar 24 2011 10:23:56)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
/ # php-cgi -v
PHP 5.3.6 (cgi-fcgi) (built: Mar 24 2011 10:23:52)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
/ #
----------------------------------------------------

   Yes, the PHP is for "cli".
   But I have the php-cgi also.
   Should I rebuild the PHP (but with what option?)? 

Best regards,

   ruey-an


2011/6/9 Daniel Lo Nigro <[email protected]>

You should be able to set up PHP using FastCGI by following the instructions
>at http://www.cherokee-project.com/doc/cookbook_php.html
>
>If you still want to use PHP via CGI, please make sure your PHP build is a CGI
>build. Run "/usr/bin/php -v" and check the output. You'll get something like
>this:
>
>dantest:/# php -v
>PHP 5.3.6-6~dotdeb.1 with Suhosin-Patch (cli) (built: Apr  4 2011 12:43:25)
>Copyright (c) 1997-2011 The PHP Group
>Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
>   with XCache v1.3.1, Copyright (c) 2005-2010, by mOo
>
>Make sure it says "cgi" or "cgi-fcgi" in the brackets. If it says "cli", you'll
>need to recompile, unless you have a PHP CGI binary as well (it might be at
>/usr/bin/php-cgi). A CLI build of PHP does not populate $_GET and $_POST, nor
>does it output HTTP headers.
>
>
>
>________________________________
>From: Rueyan Yeh <[email protected]>
>To: Daniel Lo Nigro <[email protected]>
>Cc: [email protected]
>Sent: Thu, 9 June, 2011 12:36:29 PM
>Subject: Re: [Cherokee] Help for the PHP CGI program
>
>
>Hi Daniel,
>
>  Thanks for your suggestion.
>  Actually, I use the Cherokee as a method to configure the machine only.
>  My customers prefer to use PHP.
>  By the way, sorry, I don't know the difference between the PHP and FastCGI.
>
>  My question is that, when I use the "POST" method, if the cgi program is
>written by Perl, then it can receive the input value.
>  But if the cgi program is written via PHP, then it cannot receive the input
>value.
>  I have no idea what's wrong here? The setting of Cherokee or my PHP (both is
>built by myself for ARM)?
>
>Best regards,
>
>  ruey-an
>
>
>2011/6/9 Daniel Lo Nigro <[email protected]>
>
>Is there any particular reason you're using PHP via CGI? I have not seen PHP
>>used this way in a very long time, as it's rather slow compared to FastCGI. 
The
>>recommended approach is normally to use PHP via FastCGI (which Cherokee is 
able
>>to set up for you).
>>
>>
>>
>>________________________________
>>From: Rueyan Yeh <[email protected]>
>>To: [email protected]
>>Sent: Thu, 9 June, 2011 11:56:29 AM
>>Subject: [Cherokee] Help for the PHP CGI program
>>
>>
>>
>>
>>
>>Hi,
>>>
>>>   Sorry, if you have answer, please send to me directly, thanks!
>>>   my email: [email protected]
>>>
>>>Best regards,
>>>
>>>   ruey-an
>>>
>>>
>>>
>>>2011/6/1 Rueyan Yeh <[email protected]>
>>>
>>>Hi,
>>>>
>>>>   Could someone help to answer my question? Thanks!
>>>>
>>>>   My system uses the Cherokee Web Server built by myself.
>>>>---------------------------------------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>Cherokee Web Server 1.0.20 (Feb 18 2011): Listening on port ALL:80, TLS
>>>>disabled, IPv6 disabled, using epoll, 4096 fds system limit, max. 2041
>>>>connections, 5 threads, 408 connections per thread, standard scheduling
>policy
>>>>----------------------------------------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   When run (X86 browser) the program: (test.html)
>>>>---------------------------------------------------------
>>>><html>
>>>><form action="cgi-bin/phptest.cgi" method="get">
>>>>Name: <input type="text" name="fname" />
>>>>Age: <input type="text" name="age" />
>>>><input type="submit" />
>>>></form>
>>>></html>
>>>>-------------------------------------------------------
>>>>  The phptest.cgi program:
>>>>--------------------------------------------------------
>>>>#!/usr/bin/php
>>>><?php
>>>>echo "Content-type:text/html\n\n";
>>>>
>>>>echo "<html>\n";
>>>>echo "<head>\n";
>>>>echo "<title>CGI - PHP info return </title>\n";
>>>>echo "</head>\n";
>>>>echo "<body bgcolor=white>\n";
>>>>
>>>>date_default_timezone_set("Asia/Taipei");
>>>>echo date("Y/m/d") . "<br />";
>>>>echo date("Y.m.d") . "<br />";
>>>>echo date("Y-m-d") . "<br />";
>>>>
>>>>$myname=$_GET["fname"];
>>>>echo 'Hello ' . $_GET["fname"] . "<br />";
>>>>echo 'Hello ' . $_GET["age"] . "<br />";
>>>>echo 'myname ' . $myname .  "<br />";
>>>>
>>>>echo "</body>\n";
>>>>echo "</html>\n";
>>>>
>>>>?>
>>>>----------------------------------------------------------------------
>>>>
>>>>   My Browser shows:
>>>>------------------------------------
>>>>http://192.168.1.198/cgi-bin/phptest.cgi?fname=ggg&age=ff
>>>>2011/06/01
>>>>2011.06.01
>>>>2011-06-01
>>>>Hello
>>>>Hello
>>>>myname
>>>>--------------------------------
>>>>
>>>>   My question is that why I cannot get the value of "fname" and "age" via
>the
>>
>>>>$_GET function.
>>>>
>>>>   When using the PERL, I can get these values, so I think the Cherokee is
>>>>working.
>>>>
>>>>Best regards,
>>>>
>>>>   ruey-an
>>>>
>>>
>>
>>
>
>

_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to