In this article, I will show how to install NGINX, PHP and CUBRID-PHP Driver from source code in order to establish the web server environment. There are other ways to accomplish the same task, for instance, via the package manager of you operating system.

Configure PHP

First, let's get PHP Engine installed.

1. Download PHP source package.

The PHP version needs to be 5.3 or 5.4. For example, php-5.4.11.tar.gz. When using PHP with NGINX, the FASTCGI is needed to process the PHP requests. The PHP-FPM is a FastCGI implementation, and the current PHP 5.3 and 5.4 already include the FPM part in the source code. More infomation about PHP-FPM can be found here.

2. Build PHP.

The concise build command is as below. You can add other options if neccessary. The --enable-fpm, in our case, is the important option that enables the PHP-FPM.

3. Configure the fastcgi section in nginx.conf.

After NGINX is installed, we need to configure the FASTCGI related parameters. The NGINX configuration file can be found at /home/<user>/nginx/conf/nginx.conf. You can refer to the below simple configuration for fastcgi.

4. Use your web browser to navigate to http://localhost/test2.php to retrieve the sample data from a database. Note that the db_class table is a system table in CUBRID that exists in every database, so no need to create it manually.

This concludes this tutorial on how to install NGINX, PHP, and CUBRID PHP driver. If you have questions, feel free to ask at CUBRID Q&A site, Facebook, or Twitter.