Hetzner - DokuWiki

KonsoleH:PHP-Konfiguration/en
(Auto-update from VCS)
(Auto-update from VCS)
 
Zeile 19: Zeile 19:
 
<li>File ending .php72 -> PHP7.2</li>
 
<li>File ending .php72 -> PHP7.2</li>
 
<li>File ending .php71 -> PHP7.1</li>
 
<li>File ending .php71 -> PHP7.1</li>
<li>File ending .php70 -> PHP7.0</li>
 
 
<li>File ending .php56 -> PHP5.6</li>
 
<li>File ending .php56 -> PHP5.6</li>
 
<li>File ending .php53 -> PHP5.3</li>
 
<li>File ending .php53 -> PHP5.3</li>
Zeile 34: Zeile 33:
  
 
<pre>FcgidWrapper "/home/httpd/cgi-bin/php56-fcgi-starter.fcgi" .php</pre>
 
<pre>FcgidWrapper "/home/httpd/cgi-bin/php56-fcgi-starter.fcgi" .php</pre>
 
<h3>PHP7.0</h3>
 
 
<pre>FcgidWrapper "/home/httpd/cgi-bin/php70-fcgi-starter.fcgi" .php</pre>
 
  
 
<h3>PHP7.1</h3>
 
<h3>PHP7.1</h3>
Zeile 72: Zeile 67:
 
<li><b>PHP5.3-CLI</b>: /usr/bin/php53</li>
 
<li><b>PHP5.3-CLI</b>: /usr/bin/php53</li>
 
<li><b>PHP5.6-CLI</b>: /usr/bin/php56</li>
 
<li><b>PHP5.6-CLI</b>: /usr/bin/php56</li>
<li><b>PHP7.0-CLI</b>: /usr/bin/php70</li>
 
 
<li><b>PHP7.1-CLI</b>: /usr/bin/php71</li>
 
<li><b>PHP7.1-CLI</b>: /usr/bin/php71</li>
 
<li><b>PHP7.2-CLI</b>: /usr/bin/php72</li>
 
<li><b>PHP7.2-CLI</b>: /usr/bin/php72</li>

Aktuelle Version vom 6. November 2019, 07:31 Uhr



Inhaltsverzeichnis

PHP configuration

In this section you can change the most important PHP configuration settings for your account.

Please note: We assume no responsibility for PHP scripts no longer functioning correctly as a result of incorrect settings. You confirm that you have understood the purpose of each of these configuration variables, as well as the possible effects on your scripts.

Some of the settings have an effect on the security of your account.

PHP version

You can set up the standard PHP version. All files ending in «.php» are automatically parsed with this PHP version. In addition the following attributions are standard:

  • File ending .php73 -> PHP7.3
  • File ending .php72 -> PHP7.2
  • File ending .php71 -> PHP7.1
  • File ending .php56 -> PHP5.6
  • File ending .php53 -> PHP5.3

It is also possible to set up the PHP version in the directory. Set up a file in the desired directory called «.htaccess» with the following content:

PHP5.3

FcgidWrapper "/home/httpd/cgi-bin/php53-fcgi-starter.fcgi" .php

PHP5.6

FcgidWrapper "/home/httpd/cgi-bin/php56-fcgi-starter.fcgi" .php

PHP7.1

FcgidWrapper "/home/httpd/cgi-bin/php71-fcgi-starter.fcgi" .php

PHP7.2

FcgidWrapper "/home/httpd/cgi-bin/php72-fcgi-starter.fcgi" .php

PHP7.3

FcgidWrapper "/home/httpd/cgi-bin/php73-fcgi-starter.fcgi" .php

Configure other extensions (like .html) for PHP

If you want to parse .html files or any other file extension by PHP you need to add the following to your .htaccess

FcgidWrapper "/home/httpd/cgi-bin/php71-fcgi-starter.fcgi" .html
FcgidWrapper "/home/httpd/cgi-bin/php71-fcgi-starter.fcgi" .htm
<FilesMatch "\.(html|htm)$">
 SetHandler fcgid-script
</FilesMatch>

(Example for PHP 7.1 and .htm/.html files)

PHP-CLI (command line)

You can use the follwing PHP command line interpreter (CLI):

  • PHP-CLI (newest PHP version): /usr/bin/php
  • PHP5.3-CLI: /usr/bin/php53
  • PHP5.6-CLI: /usr/bin/php56
  • PHP7.1-CLI: /usr/bin/php71
  • PHP7.2-CLI: /usr/bin/php72
  • PHP7.3-CLI: /usr/bin/php73

PHP options

Not all of the configuration settings offered are available for all versions of PHP. Each setting is accompanied by a help text that explains which version of PHP each setting corresponds to. You are also informed if a setting is not available for your chosen default version of PHP. The setting might however be used if a version of PHP as directory has been enabled via .htaccess.

display_errors

If this directive is activated, PHP errors are visible in the browser.

register_globals

If this option is activated, the passed variables (GET, POST, Cookie, environment and integrated EGPCS or GPC) are automatically imported and also registered as variables in the global namespace. Thereby the parameters can be accessed in the same way as the global variables. Warning: With bad programming this function can lead to malicious code being introduced into your account!

More information can be found at http://de.php.net/manual/de/security.globals.php.

allow_url_fopen

If this option is activated, content from foreign sites can be incorporated.

Warning: With bad programming this function can lead to malicious code being introduced into your account!

allow_url_include

If this option is activated, content from foreign sites can also be incorporated per include. (allowurlfopen also needs to be active!)

Warning: With bad programming this function can lead to malicious code being introduced into your account!

magic_quotes_gpc

If this option is activated, information between inverted commas is masked. This reduces the likelihood of successful attack on badly programmed PHP scripts. Only deactivate this option if you insert scripts which do not function with active magicquotesgpc. Warning: With bad programming this function can lead to malicious code being introduced into your account!

expose_php

If this directive is activated, the used php version is disclosed in HTTP page headers.

mbstring.func_overload

This option is needed by some scripts to handle UTF8 data correctly.See http://php.net/mbstring.overload in the PHP manual for further details.

memory_limit

The maximum available storage for your PHP scripts. Only increase this value if necessary.

max_execution_time

The maximum available time (in seconds) for running your PHP scripts. Only increase this value if necessary.

upload_max_filesize

The maximum size for the upload of files. Only increase this value if necessary.

max_file_uploads

The number of simultanous uploads. Increase or lower only if really needed.

extension/zend_extension

Lets you embed php extensions «ImageMagick», «MongoDB», OPCache», «Zend Optimizer/Zen Guard», «IonCube Loader», «eAccelerator», «APCu» or «Source Guardian» if needed. The additional modules are required by some scripts or generally improve PHP performance. To see if this is the case, check the respective script documentation. Warning: Not all combinations of these extensions are compatible. If you encounter problems on activation of one of these extensions, please deactivate the respective extension.

More settings

A great number of PHP settings can be set directly via .htaccess file:

php_value [Setting_1] [value]
php_flag [Setting_2] [0 or 1]

php_value is used for all settings requiring a value (number or string), php_flag is used for PHP settings which can only be turned on or off. A comprehensive overview of all configuration settings which can be set may be found in the PHP manual at http://php.net/manual/en/ini.list.php

PHP error log

To log php errors you need to first add a empty log file (e.g. over FTP). After that add the following lines to your .htaccess file to enable logging:

php_flag  log_errors on
php_value error_log  /usr/home/«login»/php.log

(in this example the file is php.log and is in the home folder of the account. You need to replace «login» with the ftp user name of the account)



© 2019. Hetzner Online GmbH. Alle Rechte vorbehalten.