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 服务器 - 编程 » PHP 支持 » SQL Anywhere PHP 扩展 » 如何在 UNIX 和 Mac OS X 上构建 SQL Anywhere PHP 扩展 » 如何编译 Apache 和 PHP

 

将 PHP 作为 CGI 可执行文件进行编译

如果正在使用 PHP 不支持的 Web 服务器,或者要在命令 shell 中而不在 Web 页上执行 PHP 脚本,则应将 PHP 作为 CGI 可执行文件进行编译。

前提条件

执行此任务没有前提条件。

 任务
  1. 确保设置了适用于 SQL Anywhere 的环境。

    根据您使用的 shell,从 SQL Anywhere 的安装目录(缺省情况下为 /opt/sqlanywhere16)输入相应的命令。在 Mac OS X 上,缺省目录为 /Applications/SQLAnywhere16/System

    如果正在使用此 shell... ...使用此命令
    sh, ksh, bash
     . ./bin32/sa_config.sh
    csh, tcsh
    source ./bin32/sa_config.csh
  2. 将 PHP 作为 CGI 可执行文件进行配置,与 SQL Anywhere PHP 扩展一起使用。

    从提取 PHP 文件的目录中运行以下命令:

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

    以下示例适用于 PHP 5.2.11 版。必须将 php-5.2.11 改为为正在使用的 PHP 版本。

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

    配置脚本将尝试确定 SQL Anywhere 安装的版本及位置。如果检查此命令的输出,应看到与以下内容类似的几行:

    checking for SQL Anywhere support... yes
    checking     SQL Anywhere install dir... /opt/sqlanywhere16
    checking     SQL Anywhere version... 16
  3. 编译可执行文件:

    $ make
  4. 安装组件。

    $ make install

结果

PHP 已成功编译为 CGI 可执行文件。

 另请参见