I am using the php4-cgi Debian package which is based on PHP 4.3.4.
I have problems when running php4 on the command line. If I say something
like
$ php4 index.cgi
a number of variables are not initialized. For example, $HTTP_GET_VARS is
not set. To get it set, here's my workaround:
global $HTTP_GET_VARS;
parse_str(getenv("QUERY_STRING"),$HTTP_GET_VARS);
But, my real problem is that $HTTP_POST_VARS is not set -- I have no easy
workaround for that. If I set the REQUEST_METHOD environment variable to
"POST" and CONTENT_LENGTH to some value, the above command ("php4
index.cgi") does not read the post data from the standard input, as one
would suppose.
If I can successfully get the above missing variables to be defined when
on the command line, I should be able to figure out why php4 CGI scripts
don't work from thttpd. (Interestingly, php3 scripts work fine.)
(Ultimately, I would like to get phpwiki to work on thttpd, but I think
the above problems are unrelated to this combination per-se. Note that
phpwiki requires that register_globals be set to "on" to work.)
Just for the record, here's the output from "php4 -i":
phpinfo()
PHP Version => 4.3.4
System => Linux darkstar 2.4.19 #10 Wed Sep 11 15:45:42 EDT 2002 i686
Build Date => Mar 27 2004 08:01:43
Configure Command => '../configure' '--prefix=/usr' '--prefix=/usr' '--with-regex=php' '--enable-force-cgi-redirect' '--with-config-file-path=/etc/php4/cgi' '--disable-rpath' '--enable-memory-limit' '--disable-debug' '--with-layout=GNU' '--with-pear=/usr/share/php' '--enable-calendar' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-bcmath' '--with-bz2' '--enable-ctype' '--with-db4' '--with-iconv' '--enable-exif' '--enable-filepro' '--enable-ftp' '--with-gettext' '--enable-mbstring' '--with-pcre-regex=/usr' '--enable-shmop' '--enable-sockets' '--enable-wddx' '--disable-xml' '--with-expat-dir=/usr' '--enable-yp' '--with-zlib' '--without-pgsql' '--with-kerberos=/usr' '--with-openssl=/usr' '--with-exec-dir=/usr/lib/php4/libexec' '--disable-static' '--without-mm' '--without-mysql' '--without-sybase-ct'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php4/cgi/php.ini
PHP API => 20020918
PHP Extension => 20020429
Zend Extension => 20021010
Debug Build => no
Thread Safety => disabled
Registered PHP Streams => php, http, ftp, https, ftps, compress.bzip2, compress.zlib
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
__________________________________________________ _____________________
Configuration
PHP Core
Directive => Local Value => Master Value
allow_call_time_pass_reference => On => On
allow_url_fopen => On => On
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
asp_tags => Off => Off
auto_append_file => no value => no value
auto_prepend_file => no value => no value
browscap => no value => no value
default_charset => no value => no value
default_mimetype => text/html => text/html
define_syslog_variables => Off => Off
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => On => On
display_startup_errors => Off => Off
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => On => On
error_append_string => no value => no value
error_log => no value => no value
error_prepend_string => no value => no value
error_reporting => 2039 => 2039
expose_php => On => On
extension_dir => /usr/lib/php4/20020429 => /usr/lib/php4/20020429
file_uploads => On => On
gpc_order => GPC => GPC
highlight.bg => #FFFFFF => #FFFFFF
highlight.comment => #FF8000 => #FF8000
highlight.default => #0000BB => #0000BB
highlight.html => #000000 => #000000
highlight.keyword => #007700 => #007700
highlight.string => #DD0000 => #DD0000
html_errors => On => On
ignore_repeated_errors => Off => Off
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => Off => Off
include_path => .:/usr/share/php:/usr/share/pear => .:/usr/share/php:/usr/share/pear
log_errors => Off => Off
log_errors_max_len => 1024 => 1024
magic_quotes_gpc => On => On
magic_quotes_runtime => Off => Off
magic_quotes_sybase => Off => Off
max_execution_time => 30 => 30
max_input_time => 60 => 60
memory_limit => 8M => 8M
open_basedir => no value => no value
output_buffering => no value => no value
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 12 => 12
register_argc_argv => On => On
register_globals => On => On
report_memleaks => On => On
safe_mode => Off => Off
safe_mode_exec_dir => no value => no value
safe_mode_gid => Off => Off
safe_mode_include_dir => no value => no value
sendmail_from => me@localhost.com => me@localhost.com
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
serialize_precision => 100 => 100
short_open_tag => On => On
SMTP => localhost => localhost
smtp_port => 25 => 25
sql.safe_mode => Off => Off
track_errors => Off => Off
unserialize_callback_func => no value => no value
upload_max_filesize => 2M => 2M
upload_tmp_dir => no value => no value
user_dir => no value => no value
variables_order => EGPCS => EGPCS
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
y2k_compliance => On => On
bcmath
BCMath support => enabled
bz2
BZip2 Support => Enabled
BZip2 Version => 1.0.2, 30-Dec-2001
calendar
Calendar support => enabled
ctype
ctype functions => enabled
dba
DBA support => enabled
Supported handlers => cdb cdb_make db4 inifile flatfile
exif
EXIF Support => enabled
EXIF Version => 1.4 $Id: exif.c,v 1.118.2.25 2003/09/22 23:28:07 iliaa Exp $
Supported EXIF Version => 0220
Supported filetypes => JPEG,TIFF
ftp
FTP support => enabled
gettext
GetText Support => enabled
iconv
iconv support => enabled
iconv implementation => glibc
iconv library version => 2.3.2
Directive => Local Value => Master Value
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1
mbstring
Multibyte Support => enabled
Multibyte (japanese) regex support => enabled
mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.
Directive => Local Value => Master Value
mbstring.detect_order => no value => no value
mbstring.encoding_translation => Off => Off
mbstring.func_overload => 0 => 0
mbstring.http_input => pass => pass
mbstring.http_output => pass => pass
mbstring.internal_encoding => ISO-8859-1 => no value
mbstring.language => neutral => neutral
mbstring.substitute_character => no value => no value
openssl
OpenSSL support => enabled
OpenSSL Version => OpenSSL 0.9.7d 17 Mar 2004
overload
User-Space Object Overloading Support => enabled
pcre
PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 4.5 01-December-2003
posix
Revision => $Revision: 1.51.2.2 $
session
Session Support => enabled
Registered save handlers => files user
Directive => Local Value => Master Value
session.auto_start => Off => Off
session.bug_compat_42 => On => On
session.bug_compat_warn => On => On
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.entropy_file => no value => no value
session.entropy_length => 0 => 0
session.gc_divisor => 100 => 100
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => /tmp => /tmp
session.serialize_handler => php => php
session.use_cookies => On => On
session.use_only_cookies => Off => Off
session.use_trans_sid => Off => Off
shmop
shmop support => enabled
sockets
Sockets Support => enabled
standard
Regex Library => Bundled library enabled
Dynamic Library Support => enabled
Path to sendmail => /usr/sbin/sendmail -t -i
Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
default_socket_timeout => 60 => 60
safe_mode_allowed_env_vars => PHP_ => PHP_
safe_mode_protected_env_vars => LD_LIBRARY_PATH => LD_LIBRARY_PATH
url_rewriter.tags => a=href,area=href,frame=src,input=src,form=,fieldse t= => a=href,area=href,frame=src,input=src,form=,fieldse t=
user_agent => no value => no value
tokenizer
Tokenizer Support => enabled
wddx
WDDX Support => enabled
WDDX Session Serializer => enabled
xml
XML Support => active
XML Namespace Support => active
EXPAT Version => expat_1.95.6
yp
YP Support => enabled
zlib
ZLib Support => enabled
Compiled Version => 1.2.1
Linked Version => 1.2.1
Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value
Additional Modules
Module Name
filepro
sysvsem
sysvshm
Environment
Variable => Value
USER => robert
LOGNAME => robert
HOME => /home/robert
PATH => .:/home/robert/bin:/home/robert/bin/linux:/usr/local/lang:/bin:/usr/bin:/usr/ucb:/usr/old:/usr/etc:/etc:/sbin:/usr/sbin:/usr/5bin
SHELL => /usr/bin/tcsh
PLATFORM => linux
TRASHDIR => /home/robert/trash
LD_LIBRARY_PATH => /home/robert/lib/local/darkstar:/home/robert/lib:/home/robert/lib/local:/home/robert/lib/gnu:/home/robert/lib/public
REMOTEHOST =>
TERMINFO => /home/robert/.terminfo
MANPATH => /home/robert/man:/usr/man:/usr/share/man:/home/robert/man/X11:/home/robert/man/cat1:/home/robert/man/index.bt:/home/robert/man/index.db.gz:/home/robert/man/local:/home/robert/man/man1:/home/robert/man/perl:/home/robert/man/whatis
SHLVL => 2
HOSTTYPE => i386-linux
VENDOR => intel
OSTYPE => linux
MACHTYPE => i386
PWD => /home/robert
GROUP => robert
HOST => darkstar
PHP Variables
Variable => Value
PHP_SELF =>
_SERVER["USER"] => robert
_SERVER["LOGNAME"] => robert
_SERVER["HOME"] => /home/robert
_SERVER["PATH"] => .:/home/robert/bin:/home/robert/bin/linux:/usr/local/lang:/bin:/usr/bin:/usr/ucb:/usr/old:/usr/etc:/etc:/sbin:/usr/sbin:/usr/5bin
_SERVER["SHELL"] => /usr/bin/tcsh
_SERVER["PLATFORM"] => linux
_SERVER["TRASHDIR"] => /home/robert/trash
_SERVER["LD_LIBRARY_PATH"] => /home/robert/lib/local/darkstar:/home/robert/lib:/home/robert/lib/local:/home/robert/lib/gnu:/home/robert/lib/public
_SERVER["REMOTEHOST"] =>
_SERVER["TERMINFO"] => /home/robert/.terminfo
_SERVER["MANPATH"] => /home/robert/man:/usr/man:/usr/share/man:/home/robert/man/X11:/home/robert/man/cat1:/home/robert/man/index.bt:/home/robert/man/index.db.gz:/home/robert/man/local:/home/robert/man/man1:/home/robert/man/perl:/home/robert/man/whatis
_SERVER["SHLVL"] => 2
_SERVER["HOSTTYPE"] => i386-linux
_SERVER["VENDOR"] => intel
_SERVER["OSTYPE"] => linux
_SERVER["MACHTYPE"] => i386
_SERVER["PWD"] => /home/robert
_SERVER["GROUP"] => robert
_SERVER["HOST"] => darkstar
_SERVER["PHP_SELF"] =>
_SERVER["SCRIPT_NAME"] =>
_SERVER["SCRIPT_FILENAME"] =>
_SERVER["PATH_TRANSLATED"] =>
_SERVER["DOCUMENT_ROOT"] =>
_SERVER["argv"] => Array
(
)
_SERVER["argc"] => 0
_ENV["USER"] => robert
_ENV["LOGNAME"] => robert
_ENV["HOME"] => /home/robert
_ENV["PATH"] => /usr/barra/frame3.1/bin:.:/home/robert/bin:/home/robert/bin/linux:/usr/local/lang:/usr/atria/bin:/disks/lazarus/home/sybase:/usr/lang:/bin:/usr/bin:/usr/ucb:/usr/old:/usr/etc:/etc:/sbin:/usr/sbin:/net/t_rex/disk2/arms/import/gnu/bin:/usr/5bin
_ENV["SHELL"] => /usr/bin/tcsh
_ENV["PLATFORM"] => linux
_ENV["TRASHDIR"] => /home/robert/trash
_ENV["LD_LIBRARY_PATH"] => /home/robert/lib/local/darkstar:/home/robert/lib:/home/robert/lib/local:/home/robert/lib/gnu:/home/robert/lib/public
_ENV["REMOTEHOST"] =>
_ENV["TERMINFO"] => /home/robert/.terminfo
_ENV["MANPATH"] => /home/robert/man:/usr/man:/usr/share/man:/home/robert/man/X11:/home/robert/man/cat1:/home/robert/man/index.bt:/home/robert/man/index.db.gz:/home/robert/man/local:/home/robert/man/man1:/home/robert/man/perl:/home/robert/man/whatis
_ENV["SHLVL"] => 2
_ENV["HOSTTYPE"] => i386-linux
_ENV["VENDOR"] => intel
_ENV["OSTYPE"] => linux
_ENV["MACHTYPE"] => i386
_ENV["PWD"] => /home/robert
_ENV["GROUP"] => robert
_ENV["HOST"] => darkstar
PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file: LICENSE
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact li*****@php.net.