Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Programming » PHP support » SQL Anywhere PHP extension » How to build the SQL Anywhere PHP extension on Unix and Mac OS X » How to compile Apache and PHP


Compiling PHP as a CGI executable

If you are using a web server that is not supported by PHP, or to execute PHP scripts in a command shell rather than on a web page, you should compile PHP as a CGI executable.


There are no prerequisites for this task.

  1. Make sure the environment is set up for SQL Anywhere.

    Depending on which shell you are using, enter the appropriate command from the directory where SQL Anywhere is installed (by default, this is /opt/sqlanywhere16). On Mac OS X, the default directory is /Applications/SQLAnywhere16/System.

    If you are using this shell... ...use this command
    sh, ksh, bash
     . ./bin32/
    csh, tcsh
    source ./bin32/sa_config.csh
  2. Configure PHP as a CGI executable and with the SQL Anywhere PHP extension.

    Run the following command from the directory where your PHP files were extracted:

    $ cd PHP-source-directory
    $ ./configure --with-sqlanywhere

    The following example is for PHP version 5.2.11. You must change php-5.2.11 to the version of PHP you are using.

    $ cd ~/php-5.2.11
    $ ./configure --with-sqlanywhere

    The configuration script will try to determine the version and location of your SQL Anywhere installation. If you examine the output of this command, you should see lines similar to the following:

    checking for SQL Anywhere support... yes
    checking     SQL Anywhere install dir... /opt/sqlanywhere16
    checking     SQL Anywhere version... 16
  3. Compile the executable:

    $ make
  4. Install the components.

    $ make install


PHP is successfully compiled as a CGI executable.

 See also