Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:web:web-hosting:web-management:configure-php [2016/10/13 15:42]
dedibox
en:web:web-hosting:web-management:configure-php [2019/09/25 18:07] (current)
dedibox [Error 500]
Line 25: Line 25:
  
   * [[http://​demo.online.net/​index.php4|PHP4]]   * [[http://​demo.online.net/​index.php4|PHP4]]
-  * [[http://​demo.online.net/​index.php5|PHP5.2]] +  * [[http://​demo.online.net/​index.php52|PHP5.2]] 
-  * [[http://​demo.online.net/​index.php|PHP5.4]]+  * [[http://​demo.online.net/​index.php54|PHP5.4]] 
 +  * [[http://​demo.online.net/​index.php55|PHP5.5]] 
 +  * [[http://​demo.online.net/​index.php56|PHP5.6]] 
 +  * [[http://​demo.online.net/​index.php70|PHP7.0]] 
 +  * [[http://​demo.online.net/​index.php71|PHP7.1]]
  
 The default version of PHP for all new hostings is PHP 5. The default version of PHP for all new hostings is PHP 5.
Line 38: Line 42:
  
     * A small how-to guide (beginner level): [[http://​www.phpbuilder.com/​columns/​mattias20000105.php3|Part 1]], [[http://​www.phpbuilder.com/​columns/​mattias20000312.php3|Part 2]]     * A small how-to guide (beginner level): [[http://​www.phpbuilder.com/​columns/​mattias20000105.php3|Part 1]], [[http://​www.phpbuilder.com/​columns/​mattias20000312.php3|Part 2]]
-    * Another [[http://​www.onlamp.com/​pub/​a/​php/​2001/​04/​26/​sessions.html|tutoriel]] +    * Another [[http://​www.onlamp.com/​pub/​a/​php/​2001/​04/​26/​sessions.html|tutorial]] 
     * The [[http://​www.php.net/​manual/​en/​ref.session.php|official documentation]] about sessions     * The [[http://​www.php.net/​manual/​en/​ref.session.php|official documentation]] about sessions
     * [[http://​www.phpbuilder.com/​columns/​evert20000816.php3|Mini Shopping Basket with only PHP4 Sessions]] (expert level)     * [[http://​www.phpbuilder.com/​columns/​evert20000816.php3|Mini Shopping Basket with only PHP4 Sessions]] (expert level)
Line 77: Line 81:
  
 Because of this you can use the variable **$DOCUMENT_ROOT** ​ Because of this you can use the variable **$DOCUMENT_ROOT** ​
-that points to the root of the Web site in which your script is being hosted.+that points to the root of the website ​in which your script is being hosted.
  
   Example : You want to know the path of your site http://​www.mysite.ext/​afolder/​anotherfolder   Example : You want to know the path of your site http://​www.mysite.ext/​afolder/​anotherfolder
Line 89: Line 93:
 For this, a default directory is added to the search list of included files. For this, a default directory is added to the search list of included files.
  
-It is not created by default, to create it, you need only to create a directory "​include"​ (without quotation marks and all lowercase letters) in the websites ​folder (for example: www/​include).+It is not created by default, to create it, you need only to create a directory "​include"​ (without quotation marks and all lowercase letters) in the website'​s ​folder (for example: www/​include).
  
-One such directory is only usable within the site where it was created. This means the main website'​s directory (which is named "​www/​include"​) is not accessible from a secondary ​Web site (like blog.domain.ext).+One such directory is only usable within the site where it was created. This means the main website'​s directory (which is named "​www/​include"​) is not accessible from a secondary ​website ​(like blog.domain.ext).
  
 Example: Example:
Line 209: Line 213:
  
 We assume in this example that the domain is "​domain.ext"​. We assume in this example that the domain is "​domain.ext"​.
- 
-The sender of the message (From) must be the email account you use to authenticate. 
  
 <code php> <code php>
Line 216: Line 218:
  
 // Put here your valid email address // Put here your valid email address
-$to = "​contact@domai.ext";+$to = "​contact@domain.ext";
  
 // Subject of the message ​ // Subject of the message ​
Line 272: Line 274:
 <?php <?php
  
-/* Initialisation des variables */+/* Initialization of the variables */
 $from = "​webmaster@domain.ext";​ // the sender, $from = "​webmaster@domain.ext";​ // the sender,
 replace domain.ext with your domain name replace domain.ext with your domain name
 $to = "​you@domain.ext";​ // recipient, put your mail address in here $to = "​you@domain.ext";​ // recipient, put your mail address in here
  
-/* Preperation ​*/+/* Preparation ​*/
 $subject = "Test of the mail() function of PHP"; // The subject of the mail $subject = "Test of the mail() function of PHP"; // The subject of the mail
 $email = NULL; $email = NULL;
Line 322: Line 324:
 Online offers you different PHP versions: Online offers you different PHP versions:
  
-  * The version ​4 which is used by default for files with the extensions ​.php3 and .php4 +  * The version ​5.6 
-  * The version ​5.2 is used by default for files with the extension ​.php52 +  * The version ​7. 
-  * The version ​5.4 used by default for files with the extension ​.php54+  * The version ​7.1
  
-The default version for "​.php"​ is 5.4 for new hosting accounts+<note important>​Versions prior to PHP 5.6 are deprecated, so we recommend that you update the code of your site\\ 
-For older accounts the version ​can be changed ​by a simple ​request ​at the support.+If an older version ​is required ​by you, you will need to make a request ​to the support ​to use it</​note>​
  
-For all new account the version ​can be changed directly from your panel :+The default ​version ​for "​.php"​ is 7.1 for new hosting accounts.
  
-{{ :en:​web:​web-hosting:​web-management:​php_version_en1.png?​700 |}}+For older accounts the version can be changed directly from your panel :
  
-And then select the Php version of your choice ​:+{{ :en:​web:​web-hosting:​web-management:​php_version_en1.png |}}
  
-{{ :​en:​web:​web-hosting:​web-management:​php_version_en2.png?900 |}}+And then select the PHP version of your choice : 
 + 
 +{{ :​en:​web:​web-hosting:​web-management:​php_version_en2.png |}} 
 + 
 +==== Change the PHP version of a Cloud hosting ==== 
 + 
 +By default all our Cloud hostings use the version 5.6 of PHP. 
 + 
 +However, version 7.1 is also available.\\ 
 +To use it, you have to add a ''​.htaccess''​ file in the root of the concerned directory.  
 + 
 +You have to add the following line:  
 +<​code>​ 
 +AddHandler ${php7} php 
 +</​code>​ 
 +Once you have uploaded the .htaccess file, the directory in question will use PHP 7.1. 
 + 
 +----
  
 You are able to check the PHP version used in your hosting by using the  You are able to check the PHP version used in your hosting by using the 
Line 342: Line 361:
 ===== Configuration of PHP ===== ===== Configuration of PHP =====
  
-** This is only available ​for subscribers of PRO or UNLIMITED hosting packages ​**+Configuring PHP is possible ​for all our offers. However, ensure you are running at least **PHP version 5.3 and above**.\\
  
-You can configure PHP completely towards your need. +Simply upload a "​.user.ini"​ file to the folder corresponding to your sub domain (Folder "/​www"​ for example).\\ 
-Simply upload a "​.user.ini"​ file to the folder corresponding to your sub domain (Folder "/​www"​ for example). +The majority of options are configurable,​ except for those with an impact on the resources of the server. 
-The majority of options are configurable,​ except for them having ​an impact on the resources of the server.+ 
 +You can modify all values with **PHP_INI_ALL** changeable option you can find here :\\ 
 +http://​php.net/​manual/​en/​ini.list.php
 ===== Restrictions ===== ===== Restrictions =====
  
Line 354: Line 375:
   * activated in PHP 4   * activated in PHP 4
   * not activated in PHP 5.2   * not activated in PHP 5.2
-  * does not extist ​anymore in PHP 5.4 (http://​php.net/​manual/​en/​features.safe-mode.php)+  * does not exist anymore in PHP 5.4 (http://​php.net/​manual/​en/​features.safe-mode.php)
  
 ==== chown ==== ==== chown ====
Line 378: Line 399:
 === Error in the htaccess file === === Error in the htaccess file ===
  
-You can get this error because of your .htaccess file has errors ​like the following:+You can get this error because of your .htaccess file has errors, such as the following:
    * Presence of unauthorized Directive    * Presence of unauthorized Directive
    * Presence of a syntax error    * Presence of a syntax error
-   * .htaccess File transferred in binary, instead of the transfer as text +   * .htaccess File transferred in binary, instead of transfer as text 
-   ​* ​lack of a final blank line+   ​* ​Lack of a final blank line
  
 You can stop these errors by renaming the .htaccess file to htaccessX.txt You can stop these errors by renaming the .htaccess file to htaccessX.txt
  
 You will then create an empty .htaccess file and add the lines one by one until you find the lines that caused the error 500. You will then create an empty .htaccess file and add the lines one by one until you find the lines that caused the error 500.
 +
 +=== Error in a PHP Script ===
 +An error 500 can come from an error in the PHP code. In order to debug it, you can change the `error_reporting` and `display_errors` in a user.ini file as described in "​[[configure-php#​configuration_of_php|Configuration of PHP]]"
  
 === Timeout === === Timeout ===
Line 394: Line 418:
  
 If your CMS uses the phpmailer class (XOOPS, WAnewsletter for example) you will have to update it. If your CMS uses the phpmailer class (XOOPS, WAnewsletter for example) you will have to update it.
-Replace the phpmailer directory present in your CMS with  the latest version proposed here [[http://sourceforge.net/project/showfiles.php?​group_id=26031&​package_id=252700]].+Replace the phpmailer directory present in your CMS with  the latest version proposed here [[https://github.com/PHPMailer/PHPMailer]].