| Author |
Message |
< Yaws mailing list ~ [erlang-questions] YAWS with PHP on Windows XP problem |
| colm |
Posted: Fri Aug 07, 2009 1:46 pm |
|
|
|
User
Joined: 19 May 2008
Posts: 33
|
Carl,
I duplicated your config on Windows XP and was able to get it working
on yaws-1.84. However I firstly had to work-around a problem with my
php-cgi binary which was giving me empty HTTP response which may or
may not be what you are running into.
When I created a shell script and manually defined the same
environment variables that yaws was passing to the php binary I got
the following error :
###
<b>Security Alert!</b> The PHP CGI cannot be accessed directly.
<p>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.</p>
<p>For more information as to <i>why</i> this behaviour exists, see
the <a href="http://php.net/security.cgi-bin">manual page for CGI
security</a>.</p>
<p>For more information about changing this behaviour or re-enabling
this webserver,
consult the installation file that came with this distribution, or visit
<a href="http://php.net/install.windows">the manual page</a>.</p>
###
Speculatively I patched yaws to define the REDIRECT_STATUS environment
variable (with a value of "1") and when I recompiled yaws and
re-requested my test.php it worked fine.
I then realized that this behavior must be configurable in php.ini but
I wasn't sure where php was looking for the php.ini. When I printed
out phpinfo() in my php script I could see it was looking for php.ini
in C:\WINDOWS. When I copied the sample php.ini to that location and
altered it to have the following setting :
cgi.force_redirect = 0
... then my php script worked fine with an unpatched yaws.
I'm not sure if this is the same issue you were running into but I
just wanted to confirm that it is possible to get php working on
Windows in yaws-1.84.
Colm
On Tue, Aug 4, 2009 at 2:28 PM, Carl McDade<carlmcdade@gmail.com> wrote:
> Is this being worked on? Or is it marked for testing/improvement in a
> later version?
>
> On Wed, Jul 29, 2009 at 6:49 AM, Carl McDade<carlmcdade@gmail.com> wrote:
>> Just to make sure I rolled back from 1.84 to 1.82 and received the same result.
>>
>> On Wed, Jul 29, 2009 at 6:19 AM, Carl McDade<carlmcdade@gmail.com> wrote:
>>> Hi,
>>>
>>> Confirming: I just tried this on Vista,PHP-CGI.exe and got the same
>>> result, which is a blank page and no error outside of the path error
>>> in the interactive window.
>>>
>>> /Carl
>>>
>>>
>>>
>>> On Tue, Jul 21, 2009 at 3:14 AM, andrew mmc<andrewmmc@gmail.com> wrote:
>>>> Forgive me if I'm stating the obvious now, but I think the first problem was
>>>> because the file extension was cgi, it tried to execute the file, which it
>>>> couldn't do because it is on windows. |
|
|
| Back to top |
|
| colm |
Posted: Fri Aug 07, 2009 2:37 pm |
|
|
|
User
Joined: 19 May 2008
Posts: 33
|
2009/8/7 "Przemysław \"eRIZ\" Pawliczuk" <eriz@pcinside.pl>:
> Hi! [2009-08-07]
>
> Colm Dougan wrote:
>> I duplicated your config on Windows XP and was able to get it working
>> on yaws-1.84. However I firstly had to work-around a problem with my
>> php-cgi binary which was giving me empty HTTP response which may or
>> may not be what you are running into.
>
> Hmm, yes - that's the point - empty page.
>
>>
>> When I created a shell script and manually defined the same
>> environment variables that yaws was passing to the php binary I got
>> the following error :
>
> Okay - can you post your example configuration?
For my yaws config I used the file you posted here verbatim :
http://pastie.org/550492.txt
I only changed the "webroot" path from D:\ to C:\
> I assume CGI headers defined by SET directive in shellscript.
>
> But the question is: did you configured shell script as php-cgi wrapper
> in YAWS conf?
No, the shell script I discussed in my previous email was only for
debugging on the command-line. This was unrelated to running within
yaws.
The php script I rendered from yaws was just a vanilla php file (with
a php file extension) which has the following contents :
<?php
phpinfo();
?>
You don't need any kind of wrapper script. The php binary will look
at environment variables to know where the php file is.
Colm
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Fri Aug 07, 2009 3:02 pm |
|
|
|
Guest
|
Hi! [2009-08-07]
Colm Dougan wrote:
> I duplicated your config on Windows XP and was able to get it working
> on yaws-1.84. However I firstly had to work-around a problem with my
> php-cgi binary which was giving me empty HTTP response which may or
> may not be what you are running into.
Hmm, yes - that's the point - empty page.
>
> When I created a shell script and manually defined the same
> environment variables that yaws was passing to the php binary I got
> the following error :
Okay - can you post your example configuration? I assume CGI headers
defined by SET directive in shellscript.
But the question is: did you configured shell script as php-cgi wrapper
in YAWS conf?
> I'm not sure if this is the same issue you were running into but I
> just wanted to confirm that it is possible to get php working on
> Windows in yaws-1.84.
Nice news. ;]
Regards,
Przemysław "eRIZ" Pawliczuk
--
JID: eriz//pcinside.pl
WWW: http://eriz.pcinside.pl
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Fri Aug 07, 2009 3:05 pm |
|
|
|
Guest
|
|
| Back to top |
|
| hiveminds |
Posted: Sat Aug 08, 2009 8:36 am |
|
|
|
User
Joined: 15 Apr 2009
Posts: 12
Location: Sweden
|
2009/8/8 Carl McDade <carlmcdade@gmail.com>:
> Okay,
>
> There is something I am not getting here. Can someone me do a step-by
> step? |
|
|
| Back to top |
|
| Guest |
Posted: Sat Aug 08, 2009 2:01 pm |
|
|
|
Guest
|
Hi! [2009-08-08]
Carl McDade pisze:
> 2009/8/8 Carl McDade <carlmcdade@gmail.com>:
>> Okay,
>>
>> There is something I am not getting here. Can someone me do a step-by
>> step? I have
You have to disable cgi.force_redirect setting in php.ini. Default -
it's enabled - so PHP cannot operate with YAWS.
I wrote a note about YAWS + PHP + Rewrite on WXP in Polish:
http://eriz.pcinside.pl/weblog/alternatywa-dla-apache-yaws-php-rewrite-209.html
But main clauses are clear, IMHO - you can always try to translate using
BabelFish or Google.
Regards,
Przemysław "eRIZ" Pawliczuk
--
JID: eriz//pcinside.pl
WWW: http://eriz.pcinside.pl
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist |
|
|
| Back to top |
|
| colm |
Posted: Sat Aug 08, 2009 2:45 pm |
|
|
|
User
Joined: 19 May 2008
Posts: 33
|
2009/8/8 Carl McDade <carlmcdade@gmail.com>:
> 2009/8/8 Carl McDade <carlmcdade@gmail.com>:
>> Okay,
>>
>> There is something I am not getting here. Can someone me do a step-by
>> step? |
|
|
| Back to top |
|
| hiveminds |
Posted: Sat Aug 08, 2009 2:52 pm |
|
|
|
User
Joined: 15 Apr 2009
Posts: 12
Location: Sweden
|
Thanks! people.
I got it working and posted the info on my blog for reference.
* Log out
* Entries
* Comments
Erlang
Erlang and PHP on Yaws webserver
By Carl McDade ⋅ August 8, 2009 ⋅ Post a comment ⋅
This is from the joint efforts on the Yaws mailing list. It simplifies
getting PHP up and running on the Yaws webserver. You can now try out
Erlang in transition from PHP or use them together.
PHP :
1. download windows version 5.3.0 non-threaded version
2. unzip to C:\php530
3. create php info file under doc root E:\yaws\www\phpinfo,php
4. Just like IIS cgi redirection need to be set to off.
; cgi.force_redirect is necessary to provide security running PHP
as a CGI under
; most web servers. Left undefined, PHP turns this on by default. You can
; turn it off here AT YOUR OWN RISK
; **You CAN safely turn this off for IIS, in fact, you MUST.**
; http://php.net/cgi.force-redirect
cgi.force_redirect = 0
Yaws:
1. set conf doc root ( E:\yaws\www )
2. set conf cgi ( php yaws cgi )
3. set php binary path ( php_exe_path = "C:\php530\php-cgi.exe" )
4. start Yaws in interactive ( yaws -i )
5. Yaws conf in the root of the Yaws install needs to look similar to:
php_exe_path = "C:\php530\php-cgi.exe"
<server localhost>
port = 8080
listen = 0.0.0.0
docroot = "E:/yaws/www"
allowed_scripts = php yaws cgi
appmods = <cgi-bin, yaws_appmod_cgi>
</server>
/Carl
On Sat, Aug 8, 2009 at 4:44 PM, Colm Dougan<colm.dougan@gmail.com> wrote:
> 2009/8/8 Carl McDade <carlmcdade@gmail.com>:
>> 2009/8/8 Carl McDade <carlmcdade@gmail.com>:
>>> Okay,
>>>
>>> There is something I am not getting here. Can someone me do a step-by
>>> step? I have
>>>
>>> PHP :
>>>
>>> 1. download windows version 5.3.0 non-threaded
>>> 2. unzip to C:\php530
>>> 3 create php info file E:\yaws\www\phpinfo,php
>
> You also need to :
>
> * copy the php.ini-production from your c:\php530 directory to
> c:\WINDOWS\php.ini
> * now edit c:\windows\php.ini and find the line that looks like this :
>
> ;cgi.force_redirect = 1
>
> Change it to :
>
> cgi.force_redirect = 0
>
> i.e. remove the leading semi-colon and change the 1 to 0.
>
> Save the changes and try running your php from yaws again.
>
> Colm
>
--
Carl McDade
Lead Developer
FireOrb CMS - www.fireorb.info
__________________________
Publisher and Editor
Hiveminds Magazine -www.hiveminds.co.uk
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Mon Aug 10, 2009 12:37 pm |
|
|
|
Guest
|
|
| Back to top |
|
|
|