1

I'm trying to set up development environment for some old projects in PHP 5.1.4. It needs to run as CGI (or fastcgi) under apache and I would like to have cli binary. My configure options are:

./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

After installing it, I have only these files in /usr/local/php-dev/bin:

pear
peardev
pecl
php
php-config
phpize

I would expect also php-cgi or php-cli. When running ./php -v from command line it shows:

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

So I only have CGI version and when I try to run CLI specific scripts, variables $argv and $argc are NULL.

Is there a way to have both CLI and CGI versions? (system: slackware 13.0)

2

From http://www.php.net/manual/en/features.commandline.introduction.php:

The name, location and existence of the CLI/CGI binaries will differ depending on how PHP is installed on your system. By default when executing make, both the CGI and CLI are built and placed as sapi/cgi/php-cgi and sapi/cli/php respectively, in your PHP source directory. You will note that both are named php. What happens during make install depends on your configure line. If a module SAPI is chosen during configure, such as apxs, or the --disable-cgi option is used, the CLI is copied to {PREFIX}/bin/php during make install otherwise the CGI is placed there. So, for example, if --with--apxs is in your configure line then the CLI is copied to {PREFIX}/bin/php during make install. If you want to override the installation of the CGI binary, use make install-cli after make install. Alternatively you can specify --disable-cgi in your configure line.

So, did you try make install-cli? Do you have a sapi dir with those two?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.