PHP Doku:: Laufzeiteinstellungen - configuration.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchInstallation und KonfigurationLaufzeiteinstellungen

Ein Service von Reinhard Neidl - Webprogrammierung.

Installation und Konfiguration

<<Bug reports

Die Konfigurationsdatei>>




16 BenutzerBeiträge:
- Beiträge aktualisieren...
salivatears at gmail dot com
1.12.2010 4:18
For windows with limited file permission (Windows XP)

1. Install Apache in your folder profile "C:\Documents and Settings\your_profile"

2. Add the following directives to you httpd.conf
PHPINIDir "C:\Documents and Settings\your_profile\php"

LoadModule php5_module "C:\Documents and Settings\your_profile\php\php5apache2_2.dll"

AddType application/x-httpd-php .php

3. Edit the following directive to you php.ini
extension_dir = "C:\Documents and Settings\your_profile\php\ext"

4. Move the file libmysql.dll from C:\Documents and Settings\your_profile\php\ to C:\Documents and Settings\your_profile\php\ext\

5. Restart httpd using command line
marc_zampetti at timeinc dot com
19.03.2010 21:06
As of PHP 5.3.x (the only versions I have tested this with) on Linux and Apache 2.2 using module, this is what you need to do in order to completely isolate the PHP configuration.

For OS Environment in which Apache is started:

For the Apache Module Config (i.e. httpd.conf):

## The path to the dir that contains php.ini (not the path to the file)
PHPINIDir /path/to/dir/with/php_ini_file

LoadModule php5_module /path/to/

<FilesMatch "\.php$">
  SetHandler application/x-httpd-php

PHPINIDir (note not PHPIniDir as has been previously reported) tells the module what dir to look for php.ini. You can confirm this by looking at the output of phpinfo() for the "Configuration File (php.ini) Path".
The PHP_INI_SCAN_DIR OS env setting specifies where the other PHP ini files should be loadeded from. This ONLY works if set before Apache is started. You can confirm with the "Scan this dir for additional .ini files" item in the phpinfo() output.

Setting these two settings will allow you to have your PHP config completely isolated to the apache instance, and thus multiple instances of apache on the same host can have completely different PHP configs.
24.10.2008 7:10
PHP 5.2.6 & Apache 2.2
If you tried everything above and you server is not executing php script, look in php.ini at value:

short_open_tag = Off
;it does not recognise '<?', only '<? php' or '<script>'

Some editors come with '
<?' as default, like mine did. After two days I finally found out...
php at chrismonster dot com
27.07.2008 19:33
w2k, apache 1.3.29, php 5.2.6: c:\php\php.ini was not found until the environment variable PHPRC was set to "c:\php", even though php was used as a module, not CGI.

just adding c:\php to the path was not adequate.

phpinfo() still shows "Configuration File (php.ini) Path" to be C:\WINNT, but "Loaded Configuration File" now correctly displays "C:\php\php.ini".

initially the problem appeared to be simply that the mysql extension was not loading; in fact, the problem was more fundamental (php.ini not found) but because php will still work with defaults, this was not obvious.
pg_vlad at hotmail dot com
2.07.2008 6:41
On my Debian system I wrestled with something similar after apt-get ting updates for PHP and MYSQL, turns out the apt-get install worked great but broke my libphp module under apache. Once this module was deleted, I was able to rebuild it under PHP using ./configure

All works well now.
6.02.2008 23:03

Having tried EVERYTHING on every php / mysql site to get php5.2.5 to talk to mysql server 5.0 (including all php.ini settings, all dlls, and many more ...)

Please try this: set Apache2.2 service Startup Type to MANUAL.  If not, it does not see to reload php.ini, no matter how many times you stop and start.

After 2 days, I finally see mysql info for <?php phpinfo(); ?>

Hope this helps!!
jaw at jawspeak dot com - Jonathan Andrew Wolte
26.06.2007 2:01
Be sure to use double quotes in the php.ini file. For instance:

(lines broken for readability)

this will work:
# xdebug debugging

this won't:
# xdebug debugging

You'll get this error:
Failed loading '/usr/local/php5/lib/php/extensions/
no-debug-non-zts-20060613/':  (null)

So... double quotes are the way! I know this is obvious, but it's a good thing to remember for the php.ini file.
alvaro at demogracia dot com
16.06.2007 14:01
About Apache 2.0 module:

For whatever reason, the Windows installer for PHP/5.2.3 tries to set the PHPIniDir directive using "\\" as directory separator:

PHPIniDir "C:\\Archivos de programa\\PHP\\"

It didn't work for me until I edited httpd.conf and replaced it with "/":

PHPIniDir "C:/Archivos de programa/PHP/"
henrick at streamsec dot se
1.04.2007 14:07
In order to get PHP 5.2 stable running on Windows Server 2003 x64 (IIS 6.0), I discovered three things (in addition to the other comments above):

* Some PHP web applications make use of the SCRIPT_NAME server variable which is not available under CGI. You have to use php5isapi.dll, which is a 32 bit dll, so you have to run IIS in 32 bit mode. Confer This applies to all ISAPI extensions and not just ASP.NET.

* It appears you must leave the doc_root entry in php.ini blank. At least, that is what finally made my installation work. (Note that others have suggested to set it to e.g. C:\inetpub\wwwroot or equivalent. That won't work if your server hosts more than one domain, each placed in a separate directory.)

* If you are e.g. using MySQL you will have to edit php.ini. In order for it to be found, you must set the PHPRC system environment variable or the registry entry. Note that if you edit the registry using regedit.exe, the PHP key should be placed under the [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node] key. This happens automatically if you set it using a 32 bit legacy application.
gprochnow AT PINT DOT COM
29.03.2007 22:19
Run php 4 and php 5.2.x on the same machine with IIS 6.0 as ISAPI.

1. Extract the ZIP packages of both php 4 & php 5 (not the Windows Installer) to c:\php4 & c:\php5 respectively

2. Setup the corresponding php.ini files in c:\php4 and c:\php5

3. Add the Web Service Extensions for php4 and php5. For php4 use c:\php4\sapi\php4isapi.dll, php5 use c:\php5\php5isapi.dll

4. Add the following registry keys:



5. Add c:\php4 to the PATH environment variable.

6. Associate each web site in IIS with the corresponding php version.

7. Reboot

Note: That should work, test with phpinfo() in each site. You may need to refer to the php documentation if we missed any other settings.
cduke420 at gmail dot com
8.01.2007 7:16
[ When php run as Apache Module ]
SetEnv PHPRC /home/user/dir-containing-phpinifile

[ When php run as CGI ]
Place your php.ini file in the dir of your cgi'd php binary, in this case /cgi-bin/
AddHandler php-cgi .php .htm
Action php-cgi /cgi-bin/php5.cgi

[ PHP run as cgi with wrapper (for FastCGI) ]
Your wrapper script should look something like:
exec /user/htdocs/cgi-bin/php.cgi -c /home/user/php.ini

original article:
18.11.2006 13:21
Setting php.ini location for PHP working as Apache module (without use SetEnv directive in httpd.conf):

Before start Apache, set the PHPRC environment variable to the path where php.ini should be loaded, for example:

    export PHPRC

In Debian we can do this way:

    In /etc/init.d/apache (the script that loads apache web server) we have this line:

    ENV="env -i LANG=C PATH=/bin:/usr/bin:/usr/local/bin"

    Set to this:

    ENV="env -i LANG=C PATH=/bin:/usr/bin:/usr/local/bin PHPRC=/etc/php4/apache-another-path"

Then wen you reload apache the php.ini will be loaded in the directory configured in PHPRC environment variable.
Trevor Blackbird >
11.04.2006 12:50
You can use also use the predefined PHP_SAPI constant instead of php_sapi_name().
c dot affolter at stepping-stone dot ch
13.03.2006 14:38
For those people who want to use the PHPRC environment variable:
You have to specify the path to the directory containing your php.ini, not the direct path to the php.ini.

Example (php.ini resides in /your/path/php.ini):
export PHPRC=/your/path

export PHPRC=/your/path/php.ini
randy AT rcs-comp DOT com
26.05.2005 21:47
(copied from another page)
Please note that the SetEnv PHPRC "directory/to/phpini/" only works when using PHP as CGI, but _not_ when you use the PHP Apache Module!
Jorrit Schippers
26.05.2004 13:33
For IIS users: If you experience high parsetimes, try to set output_buffering to On. IIS has problems with scripts outputting many small pieces of text, and with output_buffering = On, PHP sends the whole page to IIS in one piece.

PHP Powered Diese Seite bei
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)