KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using PHP in multiple copies of 4D on the same machine
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: December 28, 2018

4D allows the developer to write/execute PHP code within a 4D method. This is a wonderful way to leverage the vast amounts of PHP libraries that already exist.

When using PHP in 4D, the PHP code is executed via a FastCGI/PHP Server. By default, the FastCGI/PHP Server uses port 8002 (and is only accessible to the localhost via 127.0.0.1).

If you run multiple copies of 4D simultaneously on the same machine, the port will only be able to published by one of the instances of 4D, while the other instances will fail to acquire the port when they attempt to publish the FastCGI/PHP Server.

It is therefore recommended that you set a unique port for the PHP Server when using PHP within multiple copies of 4D running on the same machine. The configuration option is in the Database Settings on the PHP tab listed under "Port number":