Hinweis: Diese PHP-Version wird aufgrund diverser Sicherheitslücken von Hostsharing nicht mehr unterstützt. Es empfiehlt sich die Installation der aktuellen bei Hostsharing verfügbaren PHP-Version.
PHP Version 4.3.9
PHP Version 4.3.9 steht unter /usr/local/share/php/4.3.9/ bereit.
Neben diversen Dienstprogramme, die man normalerweise nicht benötigt, liegen unter /usr/local/share/php/4.3.9/bin/ die Binaries:
- /usr/local/share/php/4.3.9/bin/php4 das ist die cgi Version,
- /usr/local/share/php/4.3.9/bin/php439stub ist der cgi-wrapper,
- /usr/local/share/php/4.3.9/bin/php hier handelt es sich um die CLI Version, sie ist nur für Kommandozeilenscripts geeignet und kann nicht mit Apache benutzt werde Weitere Information hierzu: PHP auf der Kommondozeile.
- /usr/local/share/php/4.3.9/mod_php/libphp4.so das Modul für Apache. Es kann nur mit eigener httpd.conf benutzt werden.
Nachladbare Extensions, (extension_dir) liegen unter /usr/local/share/php/4.3.9/lib/php/20020429
Ini-Dateien liegen unter /usr/local/share/php/4.3.9/etc/. Diese werden benutzt, wenn keine eigene ini-Datei verwendet wird. Dabei gibt es pro SAPI je eine eigene ini-Datei, die sich am Namen unschwer erkennen läßt:
- /usr/local/share/php/4.3.9/etc/php-cgi.ini für die Verwendung von php über CGI mit Apache,
- /usr/local/share/php/4.3.9/etc/php-cli.ini ist für CLI (Command Line Interface),
- /usr/local/share/php/4.3.9/etc/php-apache.ini ist für das Apachemodul
Die Einstellungen in den ini-Dateien orientieren sich an der jetzigen php-4.2.1 Standard-Konfiguration bei Hostsharing, ausgenommen davon natürlich abhängige Pfadangaben.
PEAR liegt unter /usr/local/share/php/pear und ist im include_path und safe_mode_include_dir enthalten.
Einkompilierte Extensions
- bcmath
- bz2
- calendar
- ctype
- dba
- exif
- filepro
- ftp
- gettext
- iconv
- mbstring
- openssl
- overload
- pcre
- posix
- session
- shmop
- sockets
- standard
- sysvsem
- sysvshm
- tokenizer
- wddx
- xml
- yp
- zlib
Nachladbare Extensions
- curl.so
- domxml.so
- gd.so (mit GIF read und write support)
- imap.so
- mcal.so
- mcrypt.so
- mhash.so
- ming.so
- mysql.so
- odbc.so
- pgsql.so
- xslt.so
Alle ladbaren Module/Extensions (/usr/local/share/php/4.3.9/lib/php/20020429)stehen in den ini-Dateien ganz am Ende, sind aber auskommentiert. BeiBedarf können die Extensions in einer eigenen ini-Datei aktiviertwerden (Semikolon löschen), oder mittels dl() geladen werden.
Unterschiede mod_php versus CLI/CGI
In php-apache.ini ist der safe_mode aktiviert, bei CGI/CLI nicht
Benutzung der CGI Version mit Apache
Für CGI liegt unter /usr/local/share/php/4.3.9/bin/ der wrapper php439stub, der am besten zusammen mit der passenden ini-Datei in das cgi-Verzeichnis einer eigenen Domain kopiert werden muss, z.B so:
xyz00-doms@hopi:~$ cp /usr/local/share/php/4.3.9/bin/php439stub /home/doms/example.com/cgi/
xyz00-doms@hopi:~$ cp /usr/local/share/php/4.3.9/etc/php-cgi.ini ~/doms/example.com/cgi/
(beide Angaben für das Zielverzeichnis tun denselben Dienst)
Selbstverständlich sollte man die ini-Datei noch dem eigenen Bedarf anpassen.
Hinweis: php439stub liest php-cgi.ini als erste Datei, auch wenn am gleichen Ort noch eine php.ini liegt. Damit lassen sich andere php-Versionen parallel zu php-4.3.9 nutzen.
Um PHP via CGI mit dem Standard-Apachen zu nutzen, muss man zusätzlich noch eine .htaccess Datei mit etwa folgendem Inhalt in einem Domainverzeichnis (~/doms/example.com/subs/ oder tiefer) anlegen:
AddType application/x-httpd-phpcgi .php
Action application/x-httpd-phpcgi /cgi-bin/php439stub
Anwender mit eigener http.conf können dies selbstverständlich auch dorthinein schreiben und brauchen dann die .htaccess Einträge nicht.
Benutzung libphp4.so mit eigener httpd.conf
Als Paketadmin in ~/etc/http/httpd.conf das Apachemodul für php-4.3.9 aktivieren:
LoadModule php4_module /usr/local/share/php/4.3.9/mod_php/libphp4.so
Über Einträge in ~/etc/httpd/xyz00.conflassen sich Einstellungen für mod_php über die Anweisungenphp_admin_flag, php_admin_value, php_flag und php_value an die eigenenBedürfnisse anpassen. Weiteregehende Informationen zu diesenAnweisungen finden sich im PHP-Manual.
Anstelle der php_*-Anweisungen kann man auch die Datei /usr/local/share/php/4.3.9/etc/php-apache.ini nach ~/etc/httpd/ kopieren und anpassen - selbstverständlich kann man auch beides machen.
Hinweis: Webserver mittels rc httpd stop und rc httpd start neu starten und darauf achten, dass kein altes PHP Modul mehr geladen ist.
Unterschiede zu php-4.1.2
Seit php-4.3.0 stehen aus Sicherheitsgründen mit safe_mode on und Basic Authentication die PHP_AUTH variablen PHP_AUT_USER und PHP_AUT_PASSW nicht mehr zur Verfügung. Mehr zu eventuellen Unterschieden findet sich im Changelog.
Bei der Graphikbibliothek gd steht die mit PHP geliefertere gd2 in Version 2.0.22 zur Verfügung. Damit lassen sich bei der Bildbearbeitung bessere Ergebnisse erzielen.
Bei PCRE wurde ebenfalls die mit PHP gelieferte Version verwendet, damit gibt es PCRE in Version 4.5.
In den verschiedenen .ini- Dateien in /usr/local/share/php/4.3.9/etc/ gibt es im Vergleich zu php-4.1.2 folgende neue/veränderte Einstellungen:
allow_call_time_pass_reference = Offexpose_php = Offerror_reporting = E_ALLdisplay_errors = Offlog_errors = Onin Verbindung mit einem sinnvollen Dateinamen beierror_log =filenamevariables_order = "GPCS"
d.h. Environment-Variablen werden nicht mehr registriert (_ENV).register_globals = Offregister_argc_argv = Off
(nur in der php-apache.ini)
Language Options
unserialize_callback_func=The unserialize callback function will called (with the undefined class' name as parameter), if the unserializer finds an undefined class which should be instanciated.
A warning appears if the specified function is not defined, or if the function doesn't include/implement the missing class. So only set this entry, if you really want to implement such a callback-function.serialize_precision = 100When floats & doubles are serialized store serialize_precision significant digits after the floating point. The default value ensures that when floats are decoded with unserialize, the data will remain thesame.disable_classes =This directive allows you to disable certain classes for security reasons. It receives a comma-delimited list of class names. This directive is NOT affected by whetherSafe Modeis turned On or Off.
Resource Limits
max_input_time = 60Maximum amount of time each script may spend parsing request data
Error handling and logging
log_errors_max_len = 1024Set maximum length of log_errors. In error_log information about the source is added. The default is 1024 and 0 allows to not apply any maximum length at all.ignore_repeated_errors = OffDo not log repeated messages. Repeated errors must occur in same file on same line untilignore_repeated_sourceis set true.report_memleaks = OnIf this parameter is set to Off, then memory leaks will not be shown (on stdout or in the log). This has only effect in a debug compile, and iferror reportingincludes E_WARNING in the allowed list.docref_root = "/phpmanual/"docref_ext = .htmlIfhtml_errorsis set On PHP produces clickable error messages that direct to a page describing the error or function causing the error in detail. You can download a copy of the PHP manual from www.php.net/docs.php and changedocref_rootto the base URL of your local copy including the leading '/'. You must also specify the file extension being used including the dot.
Paths and Directories
; cgi.force_redirect = 1cgi.force_redirect is necessary to provide security running PHP asa CGI under most web servers. Left undefined, PHP turns this on by default. You can turn it off here AT YOUR OWN RISK
**You CAN safely turn this off for IIS, in fact, you MUST.**; cgi.nph = 1if cgi.nph is enabled it will force cgi to always sent Status: 200 with every request.; cgi.redirect_status_env = ;ifcgi.force_redirectis turned on, and you are not running under Apache or Netscape (iPlanet) web servers, you MAY need to set an environment variable name that PHP will look for to know it is OK to continue execution. Setting this variable MAY cause security issues, KNOW WHAT YOU ARE DOING FIRST.; cgi.fix_pathinfo=0cgi.fix_pathinfo provides *real*PATH_INFO/PATH_TRANSLATEDsupport for CGI. PHP's previous behaviour was to setPATH_TRANSLATEDto SCRIPT_FILENAME, and to not grok whatPATH_INFOis. For more information onPATH_INFO, see the cgi specs. Setting this to 1 willcause PHP CGI to fix it's paths to conform to the spec. A setting of zero causes PHP to behave as before. Default is zero. You should fix your scripts to useSCRIPT_FILENAMErather thanPATH_TRANSLATED.; fastcgi.impersonate = 1FastCGI under IIS (on WINNT based OS) supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context that the request runs under.mod_fastcgiunder Apache does not currently support this feature (03/17/2002). Set to 1 if running under IIS. Default is zero.;cgi.rfc2616_headers = 0cgi.rfc2616_headersconfiguration option tells PHP what type of headers to use when sending HTTP response code. If it's set 0 PHP sends Status: header that is supported by Apache. When this option is set to 1 PHP will send RFC2616 compliant header.
Fopen wrappers
; user_agent="PHP"Define the User-Agent stringdefault_socket_timeout = 60Default timeout for socket based streams (seconds); auto_detect_line_endings = OffIf your scripts have to deal with files from Macintosh systems, or you are running on a Mac and need to deal with files from unix or win32systems, setting this flag will cause PHP to automatically detect the EOL character in those files so thatfgets()andfile()will work regardless of the source of the file.
[MySQL]
mysql.connect_timeout = 60Maximum time (in secondes) for connect timeout. -1 means no limitmysql.trace_mode = OffTrace mode. When trace_mode is active (=On), warnings for table/index scans and SQL-Erros will be displayed.
[PostgresSQL]
pgsql.auto_reset_persistent = OffDetect broken persistent links always withpg_pconnect(). Need a little overhead.pgsql.ignore_notice = 0Ignore PostgreSQL backend's Notice message or not.pgsql.log_notice = 0Log PostgreSQL backend's Noitce message or not. Unless pgsql.ignore_notice=0, module cannot log notice message.
[Session]
; session.use_only_cookies = 1This option enables administrators to make their users invulnerable to attacks which involve passing session ids in URLs; defaults to 0.session.gc_probability = 1session.gc_divisor = 100Define the probability that the 'garbage collection' process is started on every session initialization.
The probability is calculated by usinggc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the GC process starts on each request.session.bug_compat_42 = 1session.bug_compat_warn = 1PHP 4.2 and less have an undocumented feature/bug that allows you to to initialize a session variable in the global scope, albeitregister_globalsis disabled. PHP 4.3 and later will warn you, if this feature is used. You can disable the feature and the warning seperately. At this time, the warning is only displayed, ifbug_compat_42is enabled.
[mbstring]
;mbstring.language = Japaneselanguage for internal character representation.;mbstring.encoding_translation = Offenable automatic encoding translation according tombstring.internal_encodingsetting. Input chars are converted to internal encoding by setting this to On.
Note: Do not use automatic encoding translation for portable libs/applications.;mbstring.func_overload = 0overload(replace) single byte functions by mbstringfunctions.mail(),ereg(), etc are overloaded bymb_send_mail(),mb_ereg(), etc. Possible values are 0,1,2,4 or combination of them. For example, 7 for overload everything.
- 0: No overload
- 1: Overload
mail()function - 2: Overload
str*()functions - 4: Overload
ereg*()functions
phpinfo() - Anzeige
Unter http://php.hostsharing.net/ steht die Ausgabe von phpinfo() für mod_php und CGI zum Anschauen.
Allgemeine Hinweise
Irren ist menschlich; und daher kann es durchaus sein, dass hier nicht alle relevanten Neuerungen aufgezählt wurden. Die Konfiguration ist der jetzigen von php-4.1.2 angeglichen, das heißtm, dass zum Beispiel weiterhin register_globals auf on stehen.
September 2004, Friedhelm Betz

