Php5

From SonicWiki
Jump to: navigation, search

PHP 5

By default, the web server cluster shared by Sonic.net customers will interpret .php files using a fully-patched version of PHP 4. To use applications and scripts requiring PHP 5.x functionality, the PHP 5 interpreter must be explicitly specified.

.htaccess

To have the Sonic.net shared web cluster interpret .php files using PHP 5, a .htaccess directive must be issued. Create a text file named ".htaccess" with the following contents:

If you want to use PHP 5.6:

   Action php-cgi /cgi-bin/php56
   AddHandler php-cgi .php 

If you want to use PHP 5.5:

   Action php-cgi /cgi-bin/php55
   AddHandler php-cgi .php 

If you want to use PHP 5.3:

   Action php-cgi /cgi-bin/php53
   AddHandler php-cgi .php 

If you want to use PHP 5.2:

   Action php-cgi /cgi-bin/php5
   AddHandler php-cgi .php 


Place the .htaccess file into your site's main directory (most frequently /home/WWW_pages/username/ or /home/WWW_pages/username/example.com)

Custom php.ini file (optional)

This configuration reads the PHP configuration from the file /usr/local/lib/httpd/cgi-bin/php.ini If you want to use your own custom php.ini file with your own custom settings, perform the following steps:

a) At the command line on shell.sonic.net create a symbolic link in your cgi directory using the command

   ln -s /opt/php5/bin/php ~/public_cgi/php5

b) Copy the php.ini file into your cgi directory

   cp /usr/local/lib/httpd/cgi-bin/php.ini ~/public_cgi/

c) Edit the file ~/public_cgi/php.ini to make whatever customizations you want

d) In your .htaccess file replace the reference to /cgi-bin/php5 to be the one you just created in your own cgi directory, i.e.

   AddHandler php-cgi .php
   Action php-cgi /cgi-bin/USERNAME/php5

where you substitute your Sonic.net user name for USERNAME

TLS 1.2

If your website needs to execute PHP code that communicates with another site using TLS 1.2 (e.g. for PayPal IPN), it is required that your uses PHP 5.5 or greater. PHP 5.5 is built using a recent version of OpenSSL which supports modern TLS protocols and has a modern certificate authority bundle for verifying the validity of SSL certificates on remote sites.

See Also: Allow url include