KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Quick way to compile your own PHP interpreter on Mac OS X
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac OS X
Published On: November 12, 2010

If you would like to use an external PHP interpreter in 4D v12 you must make sure it is compiled for FastCGI.

On a Windows machine, this is easily accomplished by using the installer provided by php.net and choosing "Other CGI" as the server type during the installation process.

On a Mac OS X machine however, the php.net website does not offer a binary installer. They provide the source instead and you must compile it.

Although compiling from source does offer the most customization available; some people may prefer not to go through the all the hoops of configuring the environment and compiling the source.

One easy way of of accomplishing the task of getting PHP5 compiled on a Mac OS X machine is to use the Mac Ports Repository.

Once the Mac Ports Repository is set up, simply install PHP with FastCGI using the following terminal command:

sudo port install php5 +fastcgi


This will install the PHP5 interpreter with the FastCGI binary into the Mac Ports root (usually /opt/local/).

If the default Mac Ports root path is used then the FastCGI PHP interpreter will be able to be launched using the following command:

sudo /opt/local/bin/php-cgi -b 127.0.0.1:8088


Where 127.0.0.1 is the ip address to listen on and 8088 is the port number to listen on.

Once the FastCGI binary is running you can modify the Database Settings in the 4D Database to use the external server and to use the port specified: