PHP arg reading rewrite since VS wiped it

This commit is contained in:
Bitl 2020-10-11 10:55:32 -07:00
parent 4b5f2a9739
commit 67fedf0009
2 changed files with 11 additions and 3 deletions

View File

@ -7,6 +7,7 @@ using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Web;
using System.Windows.Forms;
#endregion
@ -157,11 +158,17 @@ public class SimpleHTTPServer
}
}
private string ProcessPhpPage(string phpCompilerPath, string pageFileName)
private string ProcessPhpPage(string phpCompilerPath, string pageFileName, string query)
{
Process proc = new Process();
proc.StartInfo.FileName = phpCompilerPath;
proc.StartInfo.Arguments = "-d \"display_errors=1\" -d \"error_reporting=E_PARSE\" \"" + pageFileName + "\"";
var args = HttpUtility.ParseQueryString(query);
string argString = "";
foreach (var k in args.AllKeys)
{
argString += args[k] + " ";
}
proc.StartInfo.Arguments = "-d \"display_errors=1\" -d \"error_reporting=E_PARSE\" \"" + pageFileName + "\" " + argString;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
@ -201,7 +208,7 @@ public class SimpleHTTPServer
if (ext.Extension == ".php")
{
string output = ProcessPhpPage(GlobalPaths.ConfigDirData + "\\php\\php.exe", filename);
string output = ProcessPhpPage(GlobalPaths.ConfigDirData + "\\php\\php.exe", filename, context.Request.Url.Query);
byte[] input = ASCIIEncoding.UTF8.GetBytes(output);
//Adding permanent http response headers
string mime;

View File

@ -78,6 +78,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />