Testing with a very simple PHP script with curl, the URL being 127.0.0.1/test4.php, there is a 500 error. However, when the URL is 127.0.0.1/test4.html, the response is as expected.
Testing with a command-line curl, the response is as expected.
I have narrowed it down to Hiawatha or a wrong Hiawatha setting.
Is there a problem with what I am doing that has a solution?
Hiawatha version: 9.3.1
Operating System: WindowsXPSP3-X32
The PHP script requested from the browser:
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,"127.0.0.1/test4.php");
curl_setopt($curl, CURLOPT_PORT , 80);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_exec ($curl);
curl_close ($curl);
?>
This is the script responding to the curl request- test4.php:
<?php echo time() . " "; var_dump($_POST); // should be an empty array ?>
Another file for testing text-based responses - test4.html:
var_dump($_POST); Should return exactly this.
The Hiawatha config:
ConnectionsTotal = 150
ConnectionsPerIP = 50
SystemLogfile = /cygdrive/l/Hiawatha/log/system.log
GarbageLogfile = /cygdrive/l/Hiawatha/log/garbage.log
ExploitLogfile = /cygdrive/l/Hiawatha/log/exploit.log
PIDfile = /cygdrive/l/Hiawatha/log/hiawatha.pid
WorkDirectory = /cygdrive/l/Hiawatha/work
Binding {
Port = 80
Interface = 127.0.0.1
MaxRequestSize = 1024
}
Binding {
Port = 443
SSLcertFile = /cygdrive/d/my.pem
}
CGIhandler = /cygdrive/l/PHP/php-cgi.exe:php
FastCGIserver {
FastCGIid = PHP5
ConnectTo = 10.1.10.10:2005
Extension = php
}
UrlToolkit {
ToolkitID = CubeCart5
RequestURI exists Return
Match /favicon.ico$ Return
Match ^(/[^/]+)/(.+)\.html?(\?(.+))$ Rewrite $1/index.php?seo_path=$2&$4
Match ^(/[^/]+)/(.+)\.html?$ Rewrite $1/index.php?seo_path=$2
}
Hostname = 127.0.0.1
WebsiteRoot = /cygdrive/l/WebServer
Alias = /htdocs-CC522:/cygdrive/l/WebServer/htdocs-CC522
Alias = /htdocs-CC514:/cygdrive/l/WebServer/htdocs-CC514
StartFile = index.php
AccessLogfile = /cygdrive/l/Hiawatha/log/access.log
LogFormat = extended
ErrorLogfile = /cygdrive/l/Hiawatha/log/error.log
UseFastCGI = PHP5
UseToolkit = CubeCart5
TimeForCGI = 60
This is how I start Hiawatha - a batch file:
@ECHO OFF
START "PHP FastCGI" /dL:\PHP /min L:\PHP\php-cgi.exe -b 10.1.10.10:2005
"L:\Hiawatha\bin\wigwam.exe" -q -c /cygdrive/l/Hiawatha/config
IF ERRORLEVEL 1 GOTO ERROR
"L:\Hiawatha\bin\hiawatha.exe" -d -c /cygdrive/l/Hiawatha/config
IF ERRORLEVEL 1 GOTO ERROR
GOTO END
:ERROR
PAUSE
:END
This is a bad response from FastCGI:
* About to connect() to 127.0.0.1 port 80 (#5)
* Trying 127.0.0.1...
* Adding handle: conn: 0x1d6f728
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 5 (0x1d6f728) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#5)
> GET /test4.php HTTP/1.1
Host: 127.0.0.1
Accept: */*
< HTTP/1.1 500 Internal Server Error
< Date: Thu, 06 Feb 2014 06:00:40 GMT
* Server Hiawatha v9.3.1 is not blacklisted
< Server: Hiawatha v9.3.1
< Connection: close
< Content-Length: 695
< Content-Type: text/html
<
* Closing connection 5
This is a good response from the command line:
D:\>curl -v 127.0.0.1/test4.php
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Adding handle: conn: 0x528930
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x528930) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET /test4.php HTTP/1.1
> User-Agent: curl/7.34.0
> Host: 127.0.0.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 06 Feb 2014 05:53:42 GMT
* Server Hiawatha v9.3.1 is not blacklisted
< Server: Hiawatha v9.3.1
< Connection: keep-alive
< Transfer-Encoding: chunked
< X-Powered-By: PHP/5.4.17
< Content-type: text/html
<
1391666022 array(0) {
}
* Connection #0 to host 127.0.0.1 left intact