Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 \

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


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)

share|improve this question
up vote 2 down vote accepted


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?

share|improve this answer
Thanks, it was in sapi folder. This documentation fragment should be moved to – dev-null-dweller Sep 24 '10 at 14:10
You can add a documentation bug report at Although real bug fixes might take a while. from personal experience a reasonable documentation fix takes only couple of days to roll out. – Wrikken Sep 24 '10 at 22:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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