Most people don’t quite know what they are searching for, when they search “How do I change my php settings on my website?”.
Or if you are like me, you use Google with less words:
“change php settings cpanel godaddy”.
I will show you how to change your php settings on your server or shared hosting, in a couple EASY steps. I will also explain what they are, so you can understand them a little better.
IF you are just looking for the code to paste into your file manager, and know how to do the rest, skip down to #4.
What are Php Settings?
It is common to have to change your php settings in cpanel, when you are using Content Management Systems like WordPress, Joomla, or Magento etc.
So what exactly is PHP? The site www.php.net defines php as:
‘a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML’.
In my own words, php settings are settings on your server, like memory, execution time for a script to run, stuff like that.
Generally they are set too low by your hosting company, they cause all kinds of website errors, and you need to increase them.
For information on what causes a 404 error, and how to easily fix it, read this article.
What is PHP
To put that in context, php is a programming language that is widely recognized and is most popular for its use to build websites.
In fact, php is one of the most popular programming languages, due to the rising success of Content Management Systems (CMS) like WordPress, Drupal and Joomla.
Basically, php is the scripting language that WordPress runs off of.
Great, so my website runs off of the programing language PHP, but what are php settings?
PHP settings are a list of ‘directives‘ that are usually predefined by your hosting company. These php settings are usually assigned a value, and can be changed to alter the behavior of certain plugins or themes when your website runs.
Perhaps you are trying to import demo content, and are unable to without changing some of your php settings. Plugins like Divi, Elementor, and WP Bakery normally recommend changes to some of the php settings like memory limit.
Here is a list of most common php settings, and I recommend changing all of them, depending on the task.
How to change php settings in cpanel
First, choose how you would like to change the PHP settings in cpanel. The easiest method allows you to click a simple drop down, and select the value you would like to change that setting to. These variables are predefined, which results in less overall control. For example, this option does not include values like max input vars.
I have broken this up into two sections, the first section for pure simplicity, and the second section for more advanced controls.
Change PHP settings in cpanel with the php editor:
1. Jump inside of cpanel.
If you are using a GoDaddy, get into cpanel by visiting ‘My Products’ and navigate to the ‘Web Hosting’ section. You should see your cpanel hosting with the words ‘options’ and ‘Manage’ to the right. Click on Manage. Now click the ‘Cpanel Admin’ button on the upper right of your screen. You will land on a page similar to the one below:
2. Go to'Select PHP Version'
Believe it or not, cPanel has an entire section where you can change your php settings with a click of a button. It is well hidden, and not clearly labeled, which is why the question of ‘How to change php settings in cpanel?‘ is so popular.
Find the Software section of your cpanel. It is normally the 4th or 5th section down. There is a button called ‘Select PHP Version’. Click on that.
3. Switch to PHP Options
Once inside of ‘Select PHP Version’, you will notice all of the PHP Modules that are available in cPanel. Ignore these, and locate the blue link ‘Switch to PHP Options’ in the upper right. This may sometimes be labeled ‘Switch to PHP Settings’. This link will actually take you to the page to change php settings in cpanel.
4. Change PHP Settings in cpanel
Finally, we have found the PHP settings in cPanel! Notice all of the options you have to choose from. You can find your max execution time, upload max filesize, post max size etc. To change the values, you need to click on the actual value itself, and that will open up a dropdown box to select the custom value you would like to set it to!
Change PHP settings in cpanel with .ini file (recommended):
1. Jump inside of cpanel.
If you are using a GoDaddy, get into cpanel by visiting ‘My Products’ and navigate to the ‘Web Hosting’ section. You should see your cpanel hosting with the words ‘options’ and ‘Manage’ to the right. Click on Manage. Now click the ‘Cpanel Admin’ button on the upper right of your screen.
Your screen should look something like this:
2. Find your websites folder in 'File Manager'
Click the File Manager icon under the ‘Files’ section. Depending on where you are hosted, or when your cpanel was set up, the sections might be in a different order.
Inside of File Manager, navigate to Public_HTML. If your site is the ‘Primary Domain‘ of your cpanel account, this is the folder you want to make changes in. Otherwise, find the folder that your sites files are inside of, and jump into that one.
3. Find or Create a file called '.user.ini'
First, we need to make this file visible. Files like .htaccess, and .user.ini are going to be hidden by default.
In the upper right corner inside of File Manager, click on ‘Settings’. Make sure that ‘Show hidden files (dotfiles)’ is selected. Click ‘Save’.
Next, in the upper left corner, above where it says ‘Collapse All’, locate the button that says ‘+File’. This creates a new file. Name the new file .user.ini as shown in the picture below. Once you have it named, click the button ‘Create New File’.
4. Input new php values into .user.ini file
memory_limit = 256M
upload_max_filesize = 256M
post_max_size = 256M
max_execution_time = 180
max_input_vars = 5000
After you make all the necessary change php settings in cpanel, simply click ‘Save Changes’ on the top right of the editor. This will save the code you wrote, and the changes should take effect within 5 minutes. The reason we use .user.ini, instead of php.ini, is because the changes take place much quicker, and can be used as a local value. The same file is used in Godaddy’s Managed WordPress hosting as well.
If you want a way to check if the changes to your php settings went through, read the article ‘View your PHP Settings with a PHP Info Page‘.