PHP Configurations Settings for WordPress

Public Original Author Jessica December 28, 2023

In a Bitnami WordPress instance on AWS Lightsail, you typically configure PHP settings in the php.ini file rather than wp-config.php. The wp-config.php file is primarily used for WordPress-specific configurations, not server-level PHP settings.

I provided suggested values that are generally suitable for a well-resourced server, but they may not necessarily be the “highest” possible values. The highest possible values depend on the specifics of your server’s resources and the workload of your website. Setting these values too high can lead to inefficient resource use or even server instability, especially on servers with limited resources.

Here’s a bit more detail on each and how you can modify these settings:

1. HP Memory Limit: This setting (‘memory_limit’) defines the maximum amount of memory a PHP script is allowed to consume. Setting it too high might cause your server to run out of memory, especially if multiple scripts are running simultaneously. For a well-resourced server, ‘1024M’ (1GB) is usually sufficient, but you can set it higher if needed and your server has enough RAM.

2. PHP Post Max Size (‘post_max_size’): This value limits the size of POST data that PHP will accept. Its maximum value depends on your server’s capacity to handle large data sizes and the requirements of your application.

3. PHP Execution Time (‘max_execution_time’): This sets how long a PHP script is allowed to run. While I suggested ‘3600’ seconds (1 hour), which is already very high, setting it too high can allow stuck or inefficient scripts to run for too long, potentially causing issues.

4. PHP Max Input Vars (‘max_input_vars’): This setting affects how many input variables may be accepted. Increasing this limit can be necessary for complex WordPress themes or plugins.

5. PHP Upload Max Filesize (‘upload_max_filesize’): This setting determines the maximum size of an uploaded file. It should be set based on the largest file size you expect users to upload and your server’s ability to process such files.

In ‘wp-config.php’, you can primarily adjust the WordPress memory limit using 'define('WP_MEMORY_LIMIT', '1024M');. This setting influences how much memory WordPress can use but doesn’t directly change server-level PHP settings. It’s generally used to increase the memory available to WordPress within the limits set by the server’s PHP configuration.

Note: Remember, these are general guidelines. The optimal settings for your server might be different. Always monitor server performance and behavior after making such changes, and adjust as necessary. It’s also a good practice to keep regular backups of your website and server configuration.