我正在尝试为PHP 5.1.4中的一些旧项目设置开发环境。 它需要在Apache下运行CGI(或fastcgi),我想有cli二进制文件。 我的configuration选项是:
./configure \ --prefix=/usr/local/php-dev \ --with-config-file-path=/usr/local/php-dev/etc \ --enable-bcmath \ --enable-calendar \ --enable-dbase \ --enable-exif \ --enable-fastcgi \ --enable-force-cgi-redirect \ --enable-ftp \ --enable-gd-native-ttf \ --enable-mbstring \ --enable-memory-limit \ --enable-soap \ --enable-track-vars \ --enable-trans-sid \ --enable-versioning \ --enable-xslt \ --with-curl=/usr/local/php-libs/curl-7.12.2 \ --with-freetype \ --with-freetype-dir \ --with-gd \ --with-iconv \ --with-jpeg-dir \ --with-mhash \ --with-mime-magic \ --with-mssql=/usr/local/php-libs/freetds-0.64 \ --with-mysql=/usr/local/mysql5 \ --with-mysql-sock=/var/run/mysql/mysql.sock \ --with-openssl \ --with-pdo-mysql=/usr/local/mysql5 \ --with-pear \ --with-ttf \ --with-xslt-sablot=/usr/local/sablot-1.0.3 \ --with-zlib
安装完成后,我只在/usr/local/php-dev/bin有这些文件:
pear peardev pecl php php-config phpize
我也希望也php-cgi或php-cli 。 从命令行运行./php -v ,显示:
PHP 5.1.4 (cgi-fcgi) (built: Sep 23 2010 09:46:33) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
所以我只有CGI版本,当我尝试运行CLI特定的脚本时,variables$argv和$argc是NULL 。
有没有一种方法来同时使用CLI和CGI版本? (系统:slackware 13.0)
从http://www.php.net/manual/en/features.commandline.introduction.php :
CLI / CGI二进制文件的名称,位置和存在性将根据您的系统安装PHP而有所不同。 默认情况下,执行make时,CGI和CLI都将分别构build,并分别放置在您的PHP源代码目录中,分别为sapi / cgi / php-cgi和sapi / cli / php。 你会注意到两者都被命名为php。 在安装过程中会发生什么情况取决于您的configuration行。 如果在configuration过程中select了一个SAPI模块(如apxs),或者使用了–disable-cgi选项,那么在make install期间将CLI复制到{PREFIX} / bin / php,否则将CGI放置在那里。 因此,例如,如果–with – apxs在您的configuration行中,那么在make install期间将CLI复制到{PREFIX} / bin / php。 如果要覆盖CGI二进制文件的安装,请在安装后使用make install-cli。 或者,你可以在configuration行中指定–disable-cgi。
那么,你有没有尝试make install-cli ? 你跟这两个人有什么关系吗?