running on custom webserver
5 posts
• Page 1 of 1
running on custom webserver
HI Guys,
i am new to phalanger but it sounds absolutely interesting.
We have developed a huge application runnning on a custom webserver (not IIS or Apache). it is 100% .Net).
One case is to host Webpages. we have integrated PHP by FAST CGI currently.
How can i run Web applications build in PHP with phalanger instead of PHP.
Is there a way to run the PHP files like call php.exe?
Any code sample is appreciated.
best regards
Kai
i am new to phalanger but it sounds absolutely interesting.
We have developed a huge application runnning on a custom webserver (not IIS or Apache). it is 100% .Net).
One case is to host Webpages. we have integrated PHP by FAST CGI currently.
How can i run Web applications build in PHP with phalanger instead of PHP.
Is there a way to run the PHP files like call php.exe?
Any code sample is appreciated.
best regards
Kai
- kaiwachter
- Posts: 2
- Joined: January 20th, 2014, 10:16 am
Re: running on custom webserver
Hi,
Phalanger has built-in request handler which caches/compiles/runs PHP file requested by web server;
In IIS the configuration is following:
You can reuse/call this handler in order to process web request.
To run php script file from command line, you have to first compile it
Phalanger has built-in request handler which caches/compiles/runs PHP file requested by web server;
In IIS the configuration is following:
- Code: Select all
<system.webServer>
<handlers>
<add name="PhalangerHandler" path="*.php" verb="*" type="PHP.Core.RequestHandler, PhpNetCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
You can reuse/call this handler in order to process web request.
To run php script file from command line, you have to first compile it
- Code: Select all
phpc.exe /target:exe file.php
- Code: Select all
file.exe
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: running on custom webserver
wow thats cool.
do you Need to set all the PHP variables also as Environment variables like we do that for the phpcgi file?
something like:
best regards
Kai
do you Need to set all the PHP variables also as Environment variables like we do that for the phpcgi file?
something like:
- Code: Select all
Process process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.FileName = "index.exe";
process.StartInfo.StandardOutputEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
var variables = CgiHelper.GetEnvironmentVariables(irequest, path, scriptName);
foreach (var item in variables)
{
process.StartInfo.EnvironmentVariables.Add(item.Key, item.Value);
}
// Start the process
process.Start();
best regards
Kai
- kaiwachter
- Posts: 2
- Joined: January 20th, 2014, 10:16 am
Re: running on custom webserver
when running web server, you don't want to run the .exe for every request (in case of .NET it would make huge overhead)
Please take a look on PHP.Core.RequestHandler class. You can reproduce steps done there. The only catch is, it makes use of System.Web.HttpContext and most of variables and states are filled from it. Including session handling and other web-related routines.
If you would like to use Phalanger in the context of your custom web server, without valid HttpContext instance, you might lose some features. (some functions rely on this class, checks HttpContext.Current etc.)
Please take a look on PHP.Core.RequestHandler class. You can reproduce steps done there. The only catch is, it makes use of System.Web.HttpContext and most of variables and states are filled from it. Including session handling and other web-related routines.
If you would like to use Phalanger in the context of your custom web server, without valid HttpContext instance, you might lose some features. (some functions rely on this class, checks HttpContext.Current etc.)
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: running on custom webserver
Variables are initialized on every request in PHP.Core.AutoGlobals, method Initialize. They come from System.Environment.GetEnvironmentVariables(), HttpContext.Request.ServerVariables, Request.QueryString, Request.Cookies
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 8 guests