Re: [Erlyaws-list] YAWS with PHP on Windows XP problem

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Erlyaws-list] YAWS with PHP on Windows XP problem

Carl McDade
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<[hidden email]> 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.  When you changed the extension to
> php, yaws knew to pass through the file as a parameter to the php executable
> - the correct behaviour.
>
> I think the problem is now with php.  PHP has some default behaviour set for
> security reasons.  e.g. on *nix you have to explicitly compile it with the
> option to run as cgi.  It also by default will not allow itself to execute
> anything outside of its docroot, so perhaps the test file isn't in or below
> the docroot set in php.ini?
>
> Otherwise, perhaps some of the other cgi specific options there could have
> an effect?
>
>
> 2009/7/21 Claes Wikstrom <[hidden email]>
>>
>> > Yes, this path exists. And it's correct - YAWS throws an error with
>> > incorrect path.
>> >
>> > ("serwer" it's a Polish pronounceation of server, sorry for that - I've
>> >  to change it but later ;))
>> >
>>
>> Nice :-)
>>
>> > Still, problem is unresolved...
>>
>> I'll take a look at it - but not now. As I said before, this just
>> needs to be debugged. I.e yaws_cgi.erl needs to be debug modified
>> so that we
>>
>> 1. see what get's open_ported() ed
>> 2. figure out why that doesn't work.
>>
>>
>>
>> /klacke
>>
>>
>> ------------------------------------------------------------------------------
>> Enter the BlackBerry Developer Challenge
>> This is your chance to win up to $100,000 in prizes! For a limited time,
>> vendors submitting new applications to BlackBerry App World(TM) will have
>> the opportunity to enter the BlackBerry Developer Challenge. See full
>> prize
>> details at: http://p.sf.net/sfu/Challenge
>> _______________________________________________
>> Erlyaws-list mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Erlyaws-list mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>
>



--
Carl McDade
Lead Developer
____________________

FireOrb CMS
www.fireorb.info

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Reply | Threaded
Open this post in threaded view
|

Re: [Erlyaws-list] YAWS with PHP on Windows XP problem

Carl McDade
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<[hidden email]> 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<[hidden email]> 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.  When you changed the extension to
>> php, yaws knew to pass through the file as a parameter to the php executable
>> - the correct behaviour.
>>
>> I think the problem is now with php.  PHP has some default behaviour set for
>> security reasons.  e.g. on *nix you have to explicitly compile it with the
>> option to run as cgi.  It also by default will not allow itself to execute
>> anything outside of its docroot, so perhaps the test file isn't in or below
>> the docroot set in php.ini?
>>
>> Otherwise, perhaps some of the other cgi specific options there could have
>> an effect?
>>
>>
>> 2009/7/21 Claes Wikstrom <[hidden email]>
>>>
>>> > Yes, this path exists. And it's correct - YAWS throws an error with
>>> > incorrect path.
>>> >
>>> > ("serwer" it's a Polish pronounceation of server, sorry for that - I've
>>> >  to change it but later ;))
>>> >
>>>
>>> Nice :-)
>>>
>>> > Still, problem is unresolved...
>>>
>>> I'll take a look at it - but not now. As I said before, this just
>>> needs to be debugged. I.e yaws_cgi.erl needs to be debug modified
>>> so that we
>>>
>>> 1. see what get's open_ported() ed
>>> 2. figure out why that doesn't work.
>>>
>>>
>>>
>>> /klacke
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Enter the BlackBerry Developer Challenge
>>> This is your chance to win up to $100,000 in prizes! For a limited time,
>>> vendors submitting new applications to BlackBerry App World(TM) will have
>>> the opportunity to enter the BlackBerry Developer Challenge. See full
>>> prize
>>> details at: http://p.sf.net/sfu/Challenge
>>> _______________________________________________
>>> Erlyaws-list mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>>
>>
>> ------------------------------------------------------------------------------
>> Enter the BlackBerry Developer Challenge
>> This is your chance to win up to $100,000 in prizes! For a limited time,
>> vendors submitting new applications to BlackBerry App World(TM) will have
>> the opportunity to enter the BlackBerry Developer Challenge. See full prize
>> details at: http://p.sf.net/sfu/Challenge
>> _______________________________________________
>> Erlyaws-list mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>>
>>
>
>
>
> --
> Carl McDade
> Lead Developer
> ____________________
>
> FireOrb CMS
> www.fireorb.info
>



--
Carl McDade
Lead Developer
____________________

FireOrb CMS
www.fireorb.info

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Reply | Threaded
Open this post in threaded view
|

Re: [Erlyaws-list] YAWS with PHP on Windows XP problem

Carl McDade
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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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.  When you changed the extension to
>>> php, yaws knew to pass through the file as a parameter to the php executable
>>> - the correct behaviour.
>>>
>>> I think the problem is now with php.  PHP has some default behaviour set for
>>> security reasons.  e.g. on *nix you have to explicitly compile it with the
>>> option to run as cgi.  It also by default will not allow itself to execute
>>> anything outside of its docroot, so perhaps the test file isn't in or below
>>> the docroot set in php.ini?
>>>
>>> Otherwise, perhaps some of the other cgi specific options there could have
>>> an effect?
>>>
>>>
>>> 2009/7/21 Claes Wikstrom <[hidden email]>
>>>>
>>>> > Yes, this path exists. And it's correct - YAWS throws an error with
>>>> > incorrect path.
>>>> >
>>>> > ("serwer" it's a Polish pronounceation of server, sorry for that - I've
>>>> >  to change it but later ;))
>>>> >
>>>>
>>>> Nice :-)
>>>>
>>>> > Still, problem is unresolved...
>>>>
>>>> I'll take a look at it - but not now. As I said before, this just
>>>> needs to be debugged. I.e yaws_cgi.erl needs to be debug modified
>>>> so that we
>>>>
>>>> 1. see what get's open_ported() ed
>>>> 2. figure out why that doesn't work.
>>>>
>>>>
>>>>
>>>> /klacke
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Enter the BlackBerry Developer Challenge
>>>> This is your chance to win up to $100,000 in prizes! For a limited time,
>>>> vendors submitting new applications to BlackBerry App World(TM) will have
>>>> the opportunity to enter the BlackBerry Developer Challenge. See full
>>>> prize
>>>> details at: http://p.sf.net/sfu/Challenge
>>>> _______________________________________________
>>>> Erlyaws-list mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Enter the BlackBerry Developer Challenge
>>> This is your chance to win up to $100,000 in prizes! For a limited time,
>>> vendors submitting new applications to BlackBerry App World(TM) will have
>>> the opportunity to enter the BlackBerry Developer Challenge. See full prize
>>> details at: http://p.sf.net/sfu/Challenge
>>> _______________________________________________
>>> Erlyaws-list mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>>>
>>>
>>
>>
>>
>> --
>> Carl McDade
>> Lead Developer
>> ____________________
>>
>> FireOrb CMS
>> www.fireorb.info
>>
>
>
>
> --
> Carl McDade
> Lead Developer
> ____________________
>
> FireOrb CMS
> www.fireorb.info
>



--
Carl McDade
Lead Developer
FireOrb CMS - www.fireorb.info
__________________________

Publisher and Editor
Hiveminds Magazine -www.hiveminds.co.uk

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Reply | Threaded
Open this post in threaded view
|

Re: Re: [Erlyaws-list] YAWS with PHP on Windows XP problem

Colm Dougan
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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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<[hidden email]> 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.  When you changed the extension to
>>>> php, yaws knew to pass through the file as a parameter to the php executable
>>>> - the correct behaviour.
>>>>
>>>> I think the problem is now with php.  PHP has some default behaviour set for
>>>> security reasons.  e.g. on *nix you have to explicitly compile it with the
>>>> option to run as cgi.  It also by default will not allow itself to execute
>>>> anything outside of its docroot, so perhaps the test file isn't in or below
>>>> the docroot set in php.ini?
>>>>
>>>> Otherwise, perhaps some of the other cgi specific options there could have
>>>> an effect?
>>>>
>>>>
>>>> 2009/7/21 Claes Wikstrom <[hidden email]>
>>>>>
>>>>> > Yes, this path exists. And it's correct - YAWS throws an error with
>>>>> > incorrect path.
>>>>> >
>>>>> > ("serwer" it's a Polish pronounceation of server, sorry for that - I've
>>>>> >  to change it but later ;))
>>>>> >
>>>>>
>>>>> Nice :-)
>>>>>
>>>>> > Still, problem is unresolved...
>>>>>
>>>>> I'll take a look at it - but not now. As I said before, this just
>>>>> needs to be debugged. I.e yaws_cgi.erl needs to be debug modified
>>>>> so that we
>>>>>
>>>>> 1. see what get's open_ported() ed
>>>>> 2. figure out why that doesn't work.
>>>>>
>>>>>
>>>>>
>>>>> /klacke
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Enter the BlackBerry Developer Challenge
>>>>> This is your chance to win up to $100,000 in prizes! For a limited time,
>>>>> vendors submitting new applications to BlackBerry App World(TM) will have
>>>>> the opportunity to enter the BlackBerry Developer Challenge. See full
>>>>> prize
>>>>> details at: http://p.sf.net/sfu/Challenge
>>>>> _______________________________________________
>>>>> Erlyaws-list mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Enter the BlackBerry Developer Challenge
>>>> This is your chance to win up to $100,000 in prizes! For a limited time,
>>>> vendors submitting new applications to BlackBerry App World(TM) will have
>>>> the opportunity to enter the BlackBerry Developer Challenge. See full prize
>>>> details at: http://p.sf.net/sfu/Challenge
>>>> _______________________________________________
>>>> Erlyaws-list mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Carl McDade
>>> Lead Developer
>>> ____________________
>>>
>>> FireOrb CMS
>>> www.fireorb.info
>>>
>>
>>
>>
>> --
>> Carl McDade
>> Lead Developer
>> ____________________
>>
>> FireOrb CMS
>> www.fireorb.info
>>
>
>
>
> --
> Carl McDade
> Lead Developer
> FireOrb CMS - www.fireorb.info
> __________________________
>
> Publisher and Editor
> Hiveminds Magazine -www.hiveminds.co.uk
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org

Reply | Threaded
Open this post in threaded view
|

Re: [Erlyaws-list] [erlang-questions] Re: YAWS with PHP on Windows XP problem

Carl McDade
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<[hidden email]> wrote:

> 2009/8/8 Carl McDade <[hidden email]>:
>> 2009/8/8 Carl McDade <[hidden email]>:
>>> 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

________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org