Configuring Server Settings

Updated on July 24, 2019

How to configure server settings with php.ini, .user.ini and .htaccess files.

Configuring the Settings in php.ini and .user.ini files


The PHP configuration file (php.ini) is a special file that holds the settings when PHP runs. On some of the servers, it is not possible to change the settings in the main php.ini file, so you’ll need to override it.

To override php.ini file:

1. Create an empty file called php.ini in the root directory of your website where WordPress is installed.


Note: You can access the WordPress installation location via your host control panel or using FTP softwares. On most of the servers, it’s in the public_html folder.

2. Add following codes to the file.

allow_url_fopen = On
upload_max_filesize = 8M
post_max_size = 8M
memory_limit = 256M
max_execution_time = 60


3. Check your server settings as explained in the previous section to make sure the changes are applied. If you see no change, rename php.ini file to .user.ini (be sure the dot is added at the beginning of the file name). It’s possible that your server does not allow overriding of server settings.


Note:
 To increase the memory limit, you can also add define(‘WP_MEMORY_LIMIT’, ‘256M’); to your WordPress wp-config.php file, just before the “That’s all, stop editing! Happy blogging.” line.

Configuring the Setting in .htaccess File


.htaccess is a configuration file for the web servers running Apache Web Server software. You can also use this file to configure some of the server settings.


To add the settings in the file:

1. Open the .htaccess file in an editor. You can find the file in the root directory of the WordPress installation. 

Note: You can access the WordPress installation location via your host control panel or using FTP softwares. On most of the servers, it is in the public_html folder.


2. Add following codes at the end of the file.

php_value allow_url_fopen On
php_value upload_max_filesize 16M
php_value post_max_size 16M
php_value memory_limit 256M
php_value max_execution_time 60
<IfModule mod_substitute.c>
SubstituteMaxLineLength 20M
</IfModule>


3. Check your server settings as explained in the previous section to make sure the changes are applied.

Did this answer your question?