4D PHP

Version:
21.0.5
License:

MIT License

Last Update:
2

Description

PHP (Hypertext Preprocessor) is a server-side scripting language designed primarily for web development. This component provides a class-based generic API with callback functions to use PHP from 4D as a one-shot command, a local FastCGI server (PHP Execute), or as an interactive worker process.

README

version
platform
license
downloads

  • the source code of this component is licensed under the MIT license.
  • see php.net for the licensing of PHP.

php

Use PHP as one-shot CLI, FastCGI, or interactive worker process.

Building PHP for macOS

The macOS PHP build system builds the latest stable
PHP CLI and FastCGI interpreters from source for Apple Silicon and Intel, combines
them into universal binaries, and supports Developer ID signing and Apple
notarization. Third-party dependencies are linked statically; macOS system
libraries remain dynamic.

Packaging PHP for Windows

The Windows PHP packaging system downloads and
verifies the latest official x64 NTS distribution, configures its DLL extensions
for relocatable 4D workers, records vendor Authenticode status, and packages it
only after native Windows CLI and FastCGI checks succeed.

Usage

$CGI:=cs.PHP.PHP_CGI.new(cs.PHP._PHP_CGI_Controller).cgi()

$php:="<?php\n\nfunction sum(int $a, int $b): int {\nreturn $a + $b;\n}\n"

$phpFile:=Folder(fk desktop folder).file("test.php")
$phpFile.setText($php)

var $returnValue : Text
If (PHP Execute($phpFile.platformPath; "sum"; $returnValue; 5; 3))
	ALERT($returnValue)
End if

to test CGI mode

#DECLARE($params : Object)

If (Count parameters=0)
	CALL WORKER(1; Current method name; {})
Else 
	$form:=cs.PHP.CGI_PHPForm.new()
End if

to test interactive

#DECLARE($params : Object)

If (Count parameters=0)
	CALL WORKER(1; Current method name; {})
Else 
	$form:=cs.PHP.Interactive_PHPForm.new()
End if

to test one-shot

#DECLARE($params : Object)

If (Count parameters=0)
	CALL WORKER(1; Current method name; {})
Else 
	$form:=cs.PHP.Run_PHPForm.new()
End if