I would like to install and use a content handler for PHP (.php) files.
The content handler can be registered, but unfortunately the execute function of the content handler is NOT called.
TIWMimeTypes::RegisterType(L".php", L"text/php; charset=UTF-8", false);
THandlers::Add(L"/", L"*.php", new TIWH_Php());
However, it works with the same PHP files but with a different file extension (.myPhp).
TIWMimeTypes::RegisterType(L".myphp", L"text/php; charset=UTF-8", false);
THandlers::Add(L"/", L"*.myphp", new TIWH_Php());
ServerController.BlockedDocExtensions property by default contains .php extension. The reason is that 99.9999999999% of all attack/exploit kits available out there - that are used by someone trying to gain access to your application and/or server - uses several requests all targeting some .php file. IntraWeb by default refuses to process those requests.
Use the ServerController.OnConfig event to remove .php extension from BlockedDocExtensions:
procedure TIWServerController.IWServerControllerBaseConfig(Sender: TObject);
begin
BlockedDocExtensions.Remove('.php');
end;
08-07-2022, 03:48 PM (This post was last modified: 08-08-2022, 06:15 AM by JuergenS.)
I integrated PHP 8.1.8 for Windows (php-cgi.exe) into a web application via a PHP handler (Iw::Content::Base::TContentBase) using TIWCGIRunner.
It works very well, almost all PHP examples from w3cschools.com can be run without any problems.
However, no PHP forms can be executed with POST, the following message is always output: "Warning: Undefined array key".
The form parameters are obviously not stored in the superglobals $_POST or $_REQUEST during POST.
I couldn't find any problem in the PHP configuration file, so I suspect a problem with the data transfer from TIWCGIRunner to php-cgi.exe.