Product Documentation

FairCom SQL for PHP PDO

Previous Topic

Next Topic

Instructions for CentOS

The instructions for installing and configuring PHP on CentOS 6, 7, 8, are slightly different than the instructions for most flavors of Linux/Unix. Be sure to use these procedures if you are installing on one of these CentOS versions.

These instructions assume you are using a version of PHP 7 from remirepo. Note that on CentOS 8, PHP 7 is provided by the default repositories. If you prefer to have the very latest version of PHP, though, the Remi repository makes that available.

Make sure your installed version of php-devel is exactly the same version as your PHP 7, To see what version of PHP you have installed, enter the following command:
php -v
If PHP 7 is not installed, you can install the version of PHP 7 you desire using the following:

yum-config-manager --enable remi-php__

sudo yum install php.....

Then execute the following to install the files which are needed for building PHP extensions:

sudo yum install php-devel-

Then execute the following to install the php-pdo extension:

sudo yum install php-pdo

For these procedures, the php.ini file should not be changed. Do not add FairCom entries to extension_dir and the extensions area of that file. Instead, perform the following steps for CentOS 6,7,8:

  1. Create file /etc/php.d/30-pdo_ctsql.ini with a single line:

    Make sure this file has the same permissions as the other files in that directory.

  2. Some builds of CentOS do NOT include the static version of libc, which is needed for building the library. If the following build instructions give a link error "cannot find -lstdc+", you need to install the static version of libc, as follows:

    sudo yum install glibc-static libstdc+-static

  3. Make sure that a “__-pdo.ini” file also exists in that folder, with a file number that is lower than the file you created in step 1. Calling the file “20-pdo.ini” would be fine. It should contain a single line:


    Make sure this file has the same permissions as the other files in that directory.

  4. Build and install the c-tree PHP PDO extension ( under your version of PHP following these instructions: Compile the PHP PDO Extension. Be sure it has the same permissions as the other .so files in that folder: /usr/lib64/php/modules/
  5. It is important the file must be in one of the following folders:

    - Its original location when the PHP module was built

    - In a directory part of the library path

    The pdo_ctsql module you just built should already know the location of, because the build added the directory to the module library path. So, unless you have renamed or deleted the folder, you should be OK. Note that later, in deployment situations, you might need to put in a more generic place (IE: you may have built on a different machine).

  6. Make sure the previous steps worked by launching PHP, as follows:
    php -v
    No error messages or warnings should be printed.
    If PHP is unable to load dynamic library 'pdo_ctsql', it could mean that php-pdo is not installed
  7. At this point, you should run at least one of the tutorials from the command line, as follows:
    php -f ../tutorials/PHP_Tutorial1.php
    It should print the HTML source code of a web page. If an “ ctsqlConnect: -20212 Error in Network Daemon” error is shown, it means the c-tree server is not running. Start the c-tree server and re-do this step.

    Here is what the correct output of this command should look like:
    <title>PHP Tutorial 1</title>
    Logon to server...<br>
    Create table...<br>
    Delete records...<br>
    Add records...<br>
    Display records...<br>
    <TABLE border=1>
    <TR><TD>1000</TD><TD>Bryan Williams</TD></TR>
    <TR><TD>1001</TD><TD>Michael Jordan</TD></TR>
    <TR><TD>1002</TD><TD>Joshua Brown</TD></TR>
    <TR><TD>1003</TD><TD>Keyon Dooling</TD></TR>
    If you wish, you can repeat this step for each of the four PHP tutorials.
    Testing from the command line allows you to see the error messages, even if PHP fails to launch (because it is misconfigured). Note that the tutorial files do not need to be copied to the web server's documents directory in order to do this test.
  8. Restart your web server. For example, with Apache you would use the following command:
    sudo systemctl restart httpd