PHP is included in many common Linux and Unix distributions. The latest version of PHP 5 can be downloaded from the PHP website.
To configure PHP 5 to run FairCom Edge PHP follow these steps:
Note: These instructions are not valid for CentOS versions 6, 7, and 8. If followed, they will render PHP non-operational on those systems. If you are installing on one of those CentOS versions, see Instructions for CentOS (page ).
Before following these steps, you should have first compiled and installed the c-tree PHP extension (ctsql.so) under your version of PHP, (following these instructions: Compile PHP and the SQL PHP 5 Extension (Windows)).
Open php.ini with your favorite text editor. In most installations you will find the server (SAPI) version of php.ini in /etc/php5/apache2/php.ini. Note that in Linux installations of PHP, there is often a separate php.ini file for SAPI (PHP served from a web server), and for CLI (PHP run from the Command Line). If you intend to test things from the command line (step 7, below), be sure to make the following changes to the CLI version of php.ini (usually /etc/php/cli/php.ini) as well as the SAPI version of php.ini.
Search for extension_dir.
If the extension_dir line is commented out (; on the beginning of the line) leave it that way as the “make install” step during the build should have copied “ctsql.so” into the default extension folder.
If this line is not commented, it's better to copy ctsql.so into your default PHP extensions directory.
Search for extensions area and add extension=ctsql.so to configure the FairCom DB SQL PHP module into your PHP:
Note that your copy of php.ini might have the extensions end with “.so” and it might not, depending on the version of PHP you are using. For this reason, we recommend that you follow the pattern of the other extensions already listed in the file. For example, find the existing “mysql” extension line, copy it, remove the leading semicolon, and then change two letters to make it say “ctsql”
Save changes to php.ini and close your text editor. If desired, change the other php.ini file as well.
It is important the libctsqlapi.so 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 ctsql module you just built should already know the location of libctsqlapi.so, because the build added the libctsqlapi.so directory to the ctsql.so module library path. Note that later, in deployment situations, you might need to put libctsqlapi.so in a more generic place (IE: you may have built ctsql.so on a different machine)
Make sure the previous steps worked by launching PHP, as follows: php -v No error messages or warnings should be printed.
If you modified the CLI version of php.ini in steps 1-4, you can run the tutorials from the command line, as follows: php -f ../tutorials/PHP_Tutorial1.php If you wish, you can repeat this step for each of the four PHP tutorials. It should print the HTML source code of a web page. If an “ctsql_connect() - SQL ERROR: [-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. If an “PHP Fatal error: Call to undefined function ctsql_connect()...” error is shown, it probably means that you did not edit the CLI version of php.ini in steps 1-4. 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.
From the root shell restart your web server with the following command: /etc/init.d/apache2 restart It should respond with: "Forcing reload of web server (apache2)... waiting ."
Instructions for CentOS
The instructions for installing and configuring PHP 5 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 5 from remirepo (https://rpms.remirepo.net).
Note: 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 5: First install the version of PHP 5 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
Edit file /etc/php.ini and add a single line: extension=ctsql.so Do not change the “extension_dir” entry.
Some builds of CentOS do NOT include the static version of libc, which is needed for building the ctsql.so 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
Build and install the c-tree PHP extension (ctsql.so) under your version of PHP, (following these instructions: Compile the PHP Extension (page )). Be sure it has the same permissions as the other .so files in that folder: /usr/lib64/php/modules/
It is important the libctsqlapi.so 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 ctsql module you just built should already know the location of libctsqlapi.so, because the build added the libctsqlapi.so directory to the ctsql.so 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 libctsqlapi.so in a more generic place (IE: you may have built ctsql.so on a different machine).
Make sure the previous steps worked by launching PHP, as follows: php -v No error messages or warnings should be printed.
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 “ctsql_connect() - SQL ERROR: [-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: <html> <head> <title>PHP Tutorial 1</title> </head> <body> <h4>INIT</h4> Logon to server...<br> <h4>DEFINE</h4> Create table...<br> <h4>MANAGE</h4> Delete records...<br> Add records...<br> Display records...<br> <TABLE border=1> <TR><TH>Number</TH><TH>Name</TH></TR> <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> </TABLE> <h4>DONE</h4> Logout...<br> </body> </html> 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.
Restart your web server. For example, with Apache you would use the following command: sudo systemctl restart httpd