Installationsanleitungen

 

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

PHP Version 4.3.8 steht unter /usr/local/share/php/4.3.8 bereit. Unter /usr/local/share/php/4.3.8/bin/ finden sich die Binaries sowie diverse Dienstprogramme, die normalerweise nicht benötigt werden.

  • php4</tt> ist die CGI Version, bei
  • php</tt> handelt es sich um die CLI Version.
    php</tt> ist NUR für Kommandozeilenscripts geeignet und kann NICHT mit Apache benutzt werden.
  • Unter mod_php</tt> liegt das Modul libphp4.so</tt> für Apache. Es kann von GenossInnen mit eigener httpd.conf</tt> benutzt werden.

Pfade

Nachladbare Extensions, (extension_dir) liegen unter /usr/local/share/php/4.3.8/lib/php/20020429, Ini-Dateien unter /usr/local/share/php/4.3.8/etc/. Dabei gibt es pro SAPI eine eigene ini-Datei, die sich am Namen unschwer erkennen lässt.

  • php-apache.ini</tt> ist für das Apachemodul,
  • php-cgi.ini</tt> für die Verwendung von php über CGI mit Apache und
  • php-cli.ini</tt> ist für CLI (Command Line Interface).

Weitere Information zu PHP auf der Kommondozeile.

PEAR liegt unter /usr/local/share/php/pear und ist im include_path und safe_mode_include_dir enthalten.

Die Einstellungen in den ini-Dateien entsprechen vorzugsweise der jetzigen Standard-Konfiguration, ausgenommen davon natürlich abhängige Pfadangaben.

Einkompilierte Extensions

  • bcmath
  • bz2
  • calendar
  • ctype
  • dba
  • exif
  • filepro
  • ftp
  • gettext
  • iconv
  • mbstring
  • mcal (bei nur bei den CGI und CLI Versionen)
  • openssl
  • overload *
  • pcre
  • posix
  • session
  • shmop
  • sockets
  • standard
  • sysvsem
  • sysvshm
  • tokenizer *
  • wddx
  • xml
  • yp
  • zlib

* overload und tokenizer sind neu verfügbare Standardkomponenten von PHP.

Nachladbare Extensions

  • curl.so
  • domxml.so
  • gd.so
  • imap.so
  • mcal.so (Nur beim Apache-Modul)
  • mhash.so
  • mcrypt.so
  • ming.so
  • mysql.so
  • odbc.so
  • pgsql.so
  • xslt.so

Alle ladbaren Module/Extensions(/usr/local/share/php/4.3.8/lib/php/20020429) stehen in den ini-Dateien ganz am Ende, sind aber auskommentiert. Bei Bedarf können die Extensions in einer eigenen ini-Datei aktiviert werden, oder mittelsdl() geladen werden.

Unterschiede mod_php versus CLI/CGI

Unter mod_php stehen alle oben genannten Extensions zur Verfügung, bei CLI/CGI ist mcal in der entsprechenden ini-Datei eingetragen.

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.8/bin/ der wrapperphp438stub, der in das cgi-bin Verzeichnis der eigenen Domain kopiert werden muss (~/doms/DOMAIN.TLD/cgi/), die passende ini-Datei ist php-cgi.ini die ebenfalls kopiert werden sollte (s.o.).

Hinweis: php438stub liest php-cgi.ini als erste Datei, auch wenn am gleichen Ort noch eine php.ini liegt. Damit lassen sich in unterschiedlichen Verzeichnissen andere php-Versionen parallel zu php-4.3.8 nutzen.

Eine .htaccess Datei mit folgendem Inhalt in einem Domainverzeichnis (~/doms/DOMAIN.TLD/subs/) anlegen:

 

AddType application/x-httpd-phpcgi .php

Action application/x-httpd-phpcgi /cgi-bin/php438stub

 

Benutzung libphp4.so mit eigener httpd.conf

Als Paketadmin in ~/etc/http/httpd.conf das Apachemodul für php-4.3.8 aktivieren:

 

LoadModule php4_module /usr/local/share/php/4.3.8/mod_php/libphp4.so

 

Über Einträge in ~/etc/httpd/xyz00.conf lassen sich Einstellungen für mod_php über die Anweisungen php_admin_flag, php_admin_value, php_flag und php_value an die eigenen Bedürfnisse anpassen. Weiteregehende Informationen zu diesen Anweisungen finden sich im PHP-Manual.

Hinweis: Webserver mittels rc httpd stop und rc httpd start neustarten 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 undPHP_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.8/etc/ gibt es im Vergleich zu php-4.1.2 folgende neue/veränderte Einstellungen:

allow_call_time_pass_reference = Off

expose_php = Off

error_reporting = E_ALL

display_errors = Off

log_errors = On

in Verbindung mit einem sinnvollen Dateinamen bei error_log = filename

variables_order = "GPCS"

d.h. Environment-Variablen werden nicht mehr registriert (_ENV).

register_globals = Off

register_argc_argv = Off

(nur in der php-apache.ini)

Language Options

unserialize_callback_func=

The unserialize callback function will called (with the undefindclass' name as parameter), if the unserializer finds an undefined classwhich should be instanciated.

A warning appears if the specified function is not defined, or ifthe function doesn't include/implement the missing class. So only setthis entry, if you really want to implement such a callback-function.

serialize_precision = 100

When floats & doubles are serialized store serialize_precisionsignificant digits after the floating point. The default value ensuresthat when floats are decoded with unserialize, the data will remain thesame.

disable_classes =

This directive allows you to disable certain classes for securityreasons. It receives a comma-delimited list of class names. Thisdirective is NOT affected by whether Safe Mode is turned On or Off.

Resource Limits

max_input_time = 60

Maximum amount of time each script may spend parsing request data

Error handling and logging

log_errors_max_len = 1024

Set maximum length of log_errors. In error_log information aboutthe source is added. The default is 1024 and 0 allows to not apply anymaximum length at all.

ignore_repeated_errors = Off

Do not log repeated messages. Repeated errors must occur in same file on same line until ignore_repeated_source is set true.

report_memleaks = On

If this parameter is set to Off, then memory leaks will not beshown (on stdout or in the log). This has only effect in a debug compile, and if error reporting includes E_WARNING in the allowed list.

docref_root = "/phpmanual/"
docref_ext = .html

If html_errors is set On PHP produces clickable error messages thatdirect to a page describing the error or function causing the error indetail. You can download a copy of the PHP manual from www.php.net/docs.php and change docref_root to the base URL of your local copy including theleading '/'. You must also specify the file extension being usedincluding the dot.

Paths and Directories

; cgi.force_redirect = 1

cgi.force_redirect is necessary to provide security running PHP asa CGI under most web servers. Left undefined, PHP turns this on bydefault. You can turn it off here AT YOUR OWN RISK

**You CAN safely turn this off for IIS, in fact, you MUST.**

; cgi.nph = 1

if cgi.nph is enabled it will force cgi to always sent Status: 200 with every request.

; cgi.redirect_status_env = ;

if cgi.force_redirect is turned on, and you are not running underApache or Netscape (iPlanet) web servers, you MAY need to set anenvironment variable name that PHP will look for to know it is OK tocontinue execution. Setting this variable MAY cause security issues,KNOW WHAT YOU ARE DOING FIRST.

; cgi.fix_pathinfo=0

cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED supportfor CGI. PHP's previous behaviour was to set PATH_TRANSLATED toSCRIPT_FILENAME, and to not grok what PATH_INFO is. For moreinformation on PATH_INFO, see the cgi specs. Setting this to 1 willcause PHP CGI to fix it's paths to conform to the spec. A setting ofzero causes PHP to behave as before. Default is zero. You should fixyour scripts to use SCRIPT_FILENAME rather than PATH_TRANSLATED.

; fastcgi.impersonate = 1

FastCGI under IIS (on WINNT based OS) supports the ability toimpersonate security tokens of the calling client. This allows IIS todefine the security context that the request runs under. mod_fastcgiunder Apache does not currently support this feature (03/17/2002) Setto 1 if running under IIS. Default is zero.

;cgi.rfc2616_headers = 0

cgi.rfc2616_headers configuration option tells PHP what type ofheaders to use when sending HTTP response code. If it's set 0 PHP sendsStatus: header that is supported by Apache. When this option is set to1 PHP will send RFC2616 compliant header.

Fopen wrappers

; user_agent="PHP"

Define the User-Agent string

default_socket_timeout = 60

Default timeout for socket based streams (seconds)

; auto_detect_line_endings = Off

If your scripts have to deal with files from Macintosh systems, oryou are running on a Mac and need to deal with files from unix or win32systems, setting this flag will cause PHP to automatically detect theEOL character in those files so that fgets() and file() will workregardless of the source of the file.

[MySQL]

mysql.connect_timeout = 60

Maximum time (in secondes) for connect timeout. -1 means no limimt

mysql.trace_mode = Off

Trace mode. When trace_mode is active (=On), warnings for table/index scans and SQL-Erros will be displayed.

[PostgresSQL]

pgsql.auto_reset_persistent = Off

Detect broken persistent links always with pg_pconnect(). Need a little overhead.

pgsql.ignore_notice = 0

Ignore PostgreSQL backends Notice message or not.

pgsql.log_notice = 0

Log PostgreSQL backends Noitce message or not. Unless pgsql.ignore_notice=0, module cannot log notice message.

[Session]

; session.use_only_cookies = 1

This option enables administrators to make their users invulnerableto attacks which involve passing session ids in URLs; defaults to 0.

session.gc_probability = 1
session.gc_divisor = 100

Define the probability that the 'garbage collection' process is started on every session initialization.

The probability is calculated by using gc_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 = 1
session.bug_compat_warn = 1

PHP 4.2 and less have an undocumented feature/bug that allows youto to initialize a session variable in the global scope, albeit register_globals is disabled. PHP 4.3 and later will warn you, if this feature is used. You can disable the feature and the warningseperately. At this time, the warning is only displayed, ifbug_compat_42 is enabled.

[mbstring]

;mbstring.language = Japanese

language for internal character representation.

;mbstring.encoding_translation = Off

enable automatic encoding translation accoding tombstring.internal_encoding setting. Input chars are converted tointernal encoding by setting this to On.

Note: Do not use automatic encoding translation for portable libs/applications.

;mbstring.func_overload = 0

overload(replace) single byte functions by mbstring functions.mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), etc.Possible values are 0,1,2,4 or combination of them. For example, 7 foroverload everything.

  • 0: No overload
  • 1: Overload mail()</tt> function
  • 2: Overload str*()</tt> functions
  • 4: Overload ereg*()</tt> functions

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ßt dass zum Beispiel weiterhin register_globals auf on stehen. Bei Problemen und Fragen hilft support@ oder technik@ bestimmt weiter.

Viel Spaß

Mai 2004, Friedhelm Betz

Geändert am: 17.10.2005, 15:42 Uhr
Nach oben
Druckversion