Tech Tip: PHP Execute Removed in 4D 21
PRODUCT: 4D | VERSION: 21 | PLATFORM: Win
Published On: February 10, 2026
4D 21 removes the PHP Interpretter which the PHP Execute command relied on to function. This is due to various reasons including the speed at which the interpreter can be updated and having an outdated interpretter can lead to vulnerbilities. As such, it is up to the deleoper to install and maintain a PHP interpreter themselves.
To replace the PHP Execute command, which now has a warning to not sure, it is suggested that System Workers be used intead to call the PHP interpreter. Windows machines can download and install the PHP interpreter as an executable file and include it in the resources folder from php.net at:
https://www.php.net/downloads.php
The following is an example method that can be used to replace the PHP Execute command:
The method can be used similarly to the PHP Execute command with similar parameter ordering, except that the results for the third parameter is now a pointer to a text variable. This method should allow for easy replacement of the deprecated PHP Execute command.
To replace the PHP Execute command, which now has a warning to not sure, it is suggested that System Workers be used intead to call the PHP interpreter. Windows machines can download and install the PHP interpreter as an executable file and include it in the resources folder from php.net at:
https://www.php.net/downloads.php
The following is an example method that can be used to replace the PHP Execute command:
| // ---------------------------------------------------- // Method: PHP_ExecuteWin // Description // A simple replacement for PHP Execute command // Uses similar parameter structure // // Requires PHP installed in resources folder from // https://windows.php.net/download // // Update $tPHPexe and $tPHPini with updated files/paths if needed // // Parameters // $tPHPPath: Script path or "" to execute a PHP function // $tFunction: PHP function to be executed // $ptrResultText: Text formatted Result of PHP execution // ... : Additional optional parameters to PHP function // // Output // $fSuccess: True if execution succeded, False if not // ---------------------------------------------------- #DECLARE($tPHPPath : Text; $tFunction : Text; $ptrResultText : Pointer; ... : Variant)->$fSuccess : Boolean var data : Text var $tPHPexe; $tPHPini; $tParameters : Text var $onData : 4D.Function var $options : Object var $worker : 4D.SystemWorker var $i : Integer $tPHPexe:=Get 4D folder(Current resources folder)+"PHP\\php.exe" $tPHPini:=Get 4D folder(Current resources folder)+"php.ini" $onData:=Formula(data+=$2.data) $options:=New object("onData"; $onData) $worker:=4D.SystemWorker.new($tPHPexe+" -a -c "+$tPHPini; $options) $worker.wait(1) $worker.postMessage("include '"+$tPHPPath+"';\r\n") $worker.wait(1) If ($tFunction#"") $tParameters:="" For ($i; 4; Count parameters) $tParameters:=$tParameters+JSON Stringify(${$i})+"," End for $worker.postMessage("echo "+$tFunction+"("+$tParameters+");\r\n") $worker.wait(1) End if $worker.terminate() $ptrResultText->:=data If ($worker.error=Null) $fSuccess:=True End if |
The method can be used similarly to the PHP Execute command with similar parameter ordering, except that the results for the third parameter is now a pointer to a text variable. This method should allow for easy replacement of the deprecated PHP Execute command.