How to check your PHP version and configure your PHP settings

You can check the php version set for your account. There are two ways you can do this and know the PHP version set for the account. By default, we have PHP 5.6 set on every of our shared hosting servers. To check what PHP version is selected for your account go to cPanel > Software section > Select PHP version menu:

Youu will also want to read
PHP Configuration in cPanel
The htaccess file and its uses
How to Backup My Website in cPanel

You will see the current PHP version above PHP extensions:

Another way to check PHP version is PHPinfo() function, commonly used to check the current state of PHP configuration. It can also be used for debugging purposes as it contains all EGPCS (Environment, GET, POST, Cookie, Server) data.

To run the function, follow the steps below:

Please note that the process varies slightly with the cPanel theme you are using.

The only theme available for our shared hosting accounts at the moment is the Paper Lantern theme.

1. Log into your cPanel account, go to Files section > File Manager menu:

2. Navigate to public_html directory, click on New File and create a phpinfo.php file:


3. Find the newly created file in the list and click on Code Editor:

4. Add the lines of the code provided below to the file and click on Save Changes:

<?php
phpinfo();
?>

5. To see the detailed information about PHP configuration of your account, open http://yourdomain.com/phpinfo.php link in your browser, replacing yourdomain.com with your main domain name.

NOTE: For security reasons, do not forget to delete the file once you check all the necessary information.

Also read:
Getting Familiar With the cPanel User Environment
Custom error page is not working
CPanel Security

How to Change Your PHP Version

You can modify your PHP version in cPanel. To do this simply follow the steps below:

Login to cPanel using the appropriate login credentials.

Navigate to the software section

Click on MultiPHP Manager

Select your and click pply.

Managing the PHP.ini File

What is php.ini ?

Overview
php.ini
Register Globals
Limits
View Settings

The php.ini file and changing PHP Settings

The php.ini file is a special file for PHP and various flavors such as suPHP (pronounced sue-p-h-p).

The php.ini file is where you declare changes to your PHP settings. You can use the default settings for the server, change specific settings by editing the existing php.ini, or create a new text file and name it php.ini.

Default Settings

The server is already configured with standard settings for PHP which your site will use by default. Unless you need to change one or more of the settings, there is no need to create or modify a php.ini file.

Create a php.ini File

This file should be created in your cPanel Home directory (/home/username/). For VPS Plesk users the file should already exist in the following directory:

/var/www/vhost/$DOMAIN/etc/php.ini

Be sure to replace "username" with your actual cPanel user name, and "$DOMAIN" with your actual domain.

Also read:
CPanel Login Tutorial
CPanel Account Information Tutorial

How to create a new php.ini file in cPanel:

Login to cPanel.
In the Files section, click on the File Manager icon.
Select Home Directory and click Go.
Click the New File button at the top of the page.
In the field called New File Name, enter php.ini and click Create New File.
Click the file named php.ini.
Select the Edit button at the top of the page and click the Edit button in the pop-up box.

You can now input the contents of your php.ini file and click save. For a complete set of default php.ini files for PHP versions 5.5 through 7.0 click the link below:

? Default php.ini Files

If you need assistance creating a php.ini file for your account, please contact us via the ticeting system.

Making Changes Global

Now that you have an accessible php.ini file you can use the code provided within this section to make the file global for your entire account. This is done by using the SuPHP handler, which designates what php.ini file to execute.
Note: If this step is not completed, the changes made within the custom php.ini file will not take effect and the file will not be referenced when your site is accessed.

The following code should be placed at the top of your .htaccess file inside the public_html folder.

Be sure to replace "username" with your actual cPanel user name.

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/username
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>

After the above steps have been completed you can review your settings and confirm your configuration path by utilizing the phpinfo function.

Moving to suPHP

Some common changes must be made when moving from non-secure php environment to suPHP. For example, if your site had these settings in the .htaccess file:

php_flag upload_max_filesize 10M
php_value post_max_size 10M
php_value max_execution_time 30

SuExec users must put them in a php.ini file instead. Here is the proper syntax:

upload_max_filesize = 10M
post_max_size = 10M
max_execution_time = 30

PHP Settings that Cannot be Changed

Shared packages (including Resellers) are hosted on carefully managed environments and have certain limits on what can be changed in order to maintain the stability of the server. Dedicated Server and VPS customers may change all the settings in the php.ini file and do not have the same limits as Shared and Reseller hosting.

Shared (Including Resellers)

PHP has been configured to use the following settings on our shared and reseller servers:

safe mode = Off (cannot adjust)
memory_limit = 256M (MAXIMUM)
max_execution_time = 30 (MAXIMUM in seconds)
max_input_time = 60 (MAXIMUM in seconds)
post_max_size = 64M (MAXIMUM)
upload_max_filesize = 64M (MAXIMUM)
enable_dl = Off (cannot adjust)

The above settings either CANNOT be changed or exceeded on Shared and Reseller accounts. These limits are set to prevent extremely high resource usage in shared environments. We have found that a majority of the PHP scripts will work within these limits, and the scripts that require more resources are best suited for a VPS or dedicated server.

Dedicated Servers and VPS

Dedicated servers and VPS can change and raise these settings to any value desired.

Dedicated Server and VPS customers with WHM access can change the limit by going to WHM > Service Configuration > PHP Configuration Editor.
Important Note: Although you have the ability to change the settings on a dedicated server or VPS to anything you want, an incorrectly configured server will perform poorly or even crash. Unless you have specific reasons to change the PHP settings, it is recommended that you leave them at the default settings or use the recommended settings for the script or application you are using.

PHP Settings You Can Change

We also set the following:

register_globals = On
magic_quotes_gpc = Off

These two settings, and any other PHP settings not aforementioned, can be changed using a custom php.ini file located in the same folder as the script that requires the settings.

Note: Todhost cannot know why you want or need to change these settings. You are changing this at the advice of your web designer or the developer of your script. Todhost can only show you where to make the change.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

I have a full backup of account through cPanel. How do I restore it?

It is recommended that you maintain healthy backup of your website and possibly download the...

How To Create, Edit, and Delete a File in cPanel Using File Manager

This tutorial will be useful for you to understand how to create a file, edit a file or delete...

How to Create and Manage a MySQL Database

Create MySQL Database and User via cPanel The MySQL Database Wizard is another useful tool...

How do I create and remove an Addon Domain?

An add-on domain is a separate domain name that you add to your web hosting subscription with...

How to Set Up and Delete a Cron Job

A cron job allows you to run a certain command at times set by the job. For example, you could...