Hosting

How to Change PHP Settings?

blogpost-hero-hosting

The scripting language PHP is frequently utilised online. Several settings in PHP can be changed by the user themself, and it is very customizable. Your php.ini file’s PHP settings can be modified using the instructions in this article.

Why?

You may need to change your PHP settings, as you maybe encountering one of many error codes, and you possibly can’t access your website, until you resolved the error. You may want to backup your website before continuing.

You may check your current PHP settings by making a file called phpinfo (phpinfo.php) and pasting the code below into it.

Then visit your website; for example: https://your-domain.com/phpinfo.php

Method 1 – modify PHP.ini

If you can’t find the PHP.ini file, you can create the file yourself. Some hosts do not allow users to access the PHP.ini file. In this case, you can try the .htaccess method.

You can create a new file named PHP.ini in the directory where your WordPress website is installed, normally (public_html). Once you have the file, please follow the instructions:

Step 1 – Open the file using the code editor;

Step 2 – Add the following values:

Step 3 – Save the file.

Warning
Some servers will require a restart (Apache or Nginx) for php.ini changes to take effect. Also, depending on your server configuration, you’ll need to restart the PHP-FPM server process too. If you’re not sure how to do this, please get in touch with your hosting provider.

If that doesn’t work, try method 2.

Method 2 – modify .htaccess file

You can modify your PHP configuration also by using the .htacces file. Keep in mind that the .htaccess file may be hidden, so once you access your root directory using the FTP client, make sure you check the folder for the hidden files. 

To modify the file, follow these steps:

Step 1 – Open the file using the code editor;

Step 2 – Add the following values:

Step 3 – Save the file.

If both of those methods failed, contact your web hosting provider for assistance.