Skip to main content

PHP Settings, Memory Limits, and Optimization

A guide to PHP settings, memory limits, and site optimization at Seravo. Learn how to manage resources, avoid timeouts, and optimize database performance.

Updated today

Seravo’s environment is standardized and optimized to provide WordPress sites with the best possible performance and security. For this reason, system-level settings are fixed, but developers still have ways to manage how their site uses resources.

System Settings and Access Rights

Seravo is a fully managed service where we take care of server environment security and optimization on your behalf. Because of this:

  • No root access: Users are not granted administrative privileges (root/sudo) or edit access to system files (such as /etc/nginx or php.ini).

  • Standardized environment: All sites operate on the same optimized infrastructure, ensuring automatic security updates and stable performance.

Default System Values (php.ini)

Seravo's environment uses the following default values, which have been found optimal for the vast majority of WordPress sites:

  • PHP memory limit (memory_limit): 256M

  • PHP execution time (max_execution_time): 60s

  • File upload limit (upload_max_filesize): 128M

Temporary Adjustments

Customers cannot edit the php.ini file themselves. However, if you exceptionally need higher values — for example, during a large data import:

  1. Contact our customer service. We can temporarily increase these values for specific scenarios.

  2. Note: These changes are not permanent. Values will return to their defaults whenever the site instance is restarted in the background.

Important: The 128M upload limit is fixed and cannot be increased. If you need to transfer files larger than this, please see our guide: How to Upload Files Larger Than 128MB to the Server?

Modifying the Memory Limit Yourself

You can manage the memory used by WordPress via the wp-config.php file. If your site encounters "Memory exhausted" errors, you can increase the limits by adding the following lines:

define('WP_MEMORY_LIMIT', '256M');  
define('WP_MAX_MEMORY_LIMIT', '512M');

Troubleshooting and Monitoring Logs

If you suspect your site is hitting memory or execution time limits, you can monitor events in real-time via the command line (SSH):

  • wp-watch-php: Monitor PHP error logs in real-time.

  • wp-watch-logs: Monitor all site logs (including the server access log). Log files are located at: /data/log/php-error.log.

Performance and Database Optimization

Errors related to memory usage or execution time are often a sign that the site's code or database needs optimization. Increasing resource efficiency is a more sustainable solution than simply raising limit values. Often, "Timeout" or "Memory exhausted" errors are caused by inefficient code or heavy database queries.

Database Optimization

  • Missing Indexes: A slow database query can cause PHP execution time to exceed its limit. Check if indexes are missing from frequently used queries. You can use tools like Query Monitor or examine the slow query logs.

  • Table Optimization: You can run basic optimization for all database tables using the command: wp-db-optimize.

Heavy Integrations and Background Processes

If the site has slow functions, such as large file transfers or integrations with third-party systems, they should not be run during an HTTP request.

  • Move to Server Crons: Move heavy integrations to run in the background as the server's own cron jobs. This prevents the site from hanging and avoids browser timeouts.

  • Use the Command Line (CLI): Please note that when running via the command line (SSH), PHP processes are not subject to the same execution time or memory limits as browser requests. If you need to run a very heavy or long-lasting one-time task, it is recommended to run it using WP-CLI instead of the browser.

General Recommendations

  • Caching: Utilize WordPress Object Cache (Redis) to store heavy calculations or queries.

  • Limiting Queries: Avoid large get_posts calls without pagination. Use the fields => ids setting if you only need the IDs.

  • Images: Avoid uploading very large images (e.g., 10MB+) directly to WordPress, as processing them (creating thumbnails) consumes a vast amount of memory.

Did this answer your question?