Hi Erel,
I tried to follow your advice and I was able to partially implement what you suggested. I installed php on my pc (windows 7 64 bit) (in C: \ PHP \ php-cgi.exe),
I implemented an handler with shell (i work on your exemples):
Sub Process_Globals
Private srvr As Server
End Sub
Sub AppStart (Args() As String)
srvr.Initialize("srvr")
srvr.Port = 8888
srvr.StaticFilesFolder = File.Combine(File.DirApp, "www")
srvr.LogsFileFolder = File.Combine(File.DirApp, "logs")
srvr.AddHandler("/phppage", "phpPage", False)
srvr.Start
Log("Server started")
StartMessageLoop
End Sub
and the class module 'phpPage':
Sub Class_Globals
Private mreq As ServletRequest 'ignore
Private mresp As ServletResponse 'ignore
Private StdOut1 As String
End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
mreq = req
mresp = resp
Dim shl As Shell
shl.Initialize("shl", "php", Array As String("esempio2.php"))
shl.WorkingDirectory = "C:\Users\utente\Desktop\web app\prova server gg1\Objects\www"
shl.Run(10000) 'set a timeout of 10 seconds
StartMessageLoop 'need to call this as this is a console app.
resp.Write(StdOut1)
End Sub
Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success AND ExitCode = 0 Then
Log("Success")
Log(StdOut)
StdOut1=StdOut
Else
Log("Error: " & StdErr)
End If
'ExitApplication
StopMessageLoop
End Sub
(Note that I replaced 'ExitApplication' with 'StopMessageLoop')
then when i call in the browser:
http://localhost:8888/phppage
the php code esempio2.php :
<html>
<head>
<title>Test PHP</title>
</head>
<body>
<?php echo "Hello World!<p>"; ?>
<?Php phpinfo();?>
</body>
</html>
runs successfully.
It was what you meant?
Because in this way i can execute a php file explicitly called by its name in the code and place in the www folder.
Can i execute a php file without indicating its name in the code?
I can not understand how to pass all *.php files from www to PHP, is it possible to do that?
It is possible execute in the srver php-code inserted in html file?
In other words it is possible for the server to work with php script as you would with an apache server (WAMP)?
Can you show some code to do these things?
Thank you very much for your answers.