The CyberSEO Pro, RSS Retriever and AI Autoblogger plugins are designed to generate complex content using advanced AI models for text and image generation. These models take a significant amount of time to produce the final output. When used in a shared hosting environment, these plugins often run into a problem where the maximum PHP execution time is too short to complete the generation process.
On most shared hosting platforms, the default PHP maximum execution time is set to 30 seconds, although some allow up to 90 seconds. While this may be sufficient for simple tasks, it is insufficient for the more resource-intensive operations required by AI models. As a result, the plugin process may be abruptly terminated by the server before it has a chance to finish, resulting in incomplete content generation.
It’s important to understand that this problem is not caused by the plugins themselves. The plugins do exactly what they are supposed to do – call external AI services and process the data returned. However, they are limited by the execution time constraints of the server. Tweaking the plugin code won’t solve this problem, as it’s fundamentally a matter of server settings that govern how long a PHP script is allowed to run.
Common symptoms
When the PHP process for a plugin is terminated prematurely due to insufficient maximum execution time, users typically observe certain symptoms. These symptoms might not immediately indicate an issue with execution time, but they are telltale signs that the script has been interrupted:
- The logs that track its actions during the post-generation process. When the server cuts off the PHP process, these logs do not record any error message. Instead, they simply stop logging at the point where the script was terminated. For example, a log might show, “Generate Midjourney image with GoAPI for…” and then nothing further, indicating that the process was stopped before it could finish.
- Depending on the hosting environment, users might encounter timeout errors.
These symptoms can be frustrating because they give the impression that the plugin is malfunctioning, when in fact the server settings are the cause.
The importance of PHP maximum execution time
The PHP maximum execution time is a critical setting that dictates how long a PHP script is allowed to run before the server forcibly terminates it. For AI-powered plugins that need to make numerous external API calls, process complex data, or generate media content, a short execution time can be very restrictive.
In shared hosting environments, hosting providers often enforce strict limits on PHP execution times to prevent a single user from consuming too many resources that could impact the performance of other websites on the same server. While this is understandable from a hosting management perspective, it poses significant challenges for users running resource-intensive plugins.
If the maximum execution time is insufficient, the script will not be able to complete its tasks, resulting in the problems described above. Increasing the maximum PHP execution time is essential to ensure that a plugin has enough time to complete its processes and deliver the desired content.
How to check your current PHP settings
Before you can address the issue of insufficient execution time, you need to know what your current PHP settings are. Here’s how you can check your PHP maximum execution time using common hosting management panels:
cPanel
- Log in to your cPanel account.
- Navigate to the Software section and click on Select PHP Version or PHP Selector.
- On the PHP settings page, click on the Options tab.
- Look for the setting labeled
max_execution_time
. This value indicates the maximum time a PHP script is allowed to run.
Plesk
- Log in to your Plesk account.
- Go to Websites & Domains and click on the domain name where your plugin is installed.
- Click on PHP Settings.
- Scroll down to the Common settings section and locate
max_execution_time
.
These steps will help you identify the current execution time limit on your server, which will guide you in determining how much it needs to be increased.
Methods to increase PHP maximum execution time
Once you’ve identified that the PHP maximum execution time is insufficient, the next step is to increase it. Depending on your hosting environment, you can use one of several methods to achieve this:
Modifying .htaccess
File
If your hosting provider allows it, you can increase the PHP execution time by adding a directive to your .htaccess
file, which is located in the root directory of your website. Add the following line to your .htaccess
file:
php_value max_execution_time 600
This sets the maximum execution time to 600 seconds (10 minutes). Adjust the value as necessary based on your needs and what your hosting provider allows.
Editing php.ini
Another method is to modify the php.ini
file, which is the main configuration file for PHP. This file controls many of PHP’s settings, including execution time:
- Locate your
php.ini
file on the server. The exact location may vary depending on your hosting environment. - Open the file in a text editor.
- Find the line that contains
max_execution_time
and change the value to your desired limit. For example:
max_execution_time = 600
- Save the file and restart your web server to apply the changes.
Adjusting settings via hosting control panels
Some hosting control panels, like cPanel or Plesk, allow you to adjust the PHP maximum execution time directly through their interface without editing configuration files.
- In cPanel, you can do this by navigating to Select PHP Version > Options and setting the
max_execution_time
value. - In Plesk, go to PHP Settings under Websites & Domains and find the
max_execution_time
setting.
Contacting hosting support
If the above methods are not available or do not work due to restrictions imposed by your hosting provider, you may need to contact your hosting support team. Explain that you need a higher PHP maximum execution time for specific plugins that require more processing time. Many hosting providers are willing to accommodate such requests if they are reasonable and won’t negatively impact server performance.
Troubleshooting
While attempting to increase PHP maximum execution time, you might encounter some common issues.
Changes not taking effect
If modifications to .htaccess
or php.ini
do not seem to work, it could be due to server-level restrictions. In such cases, verify that your hosting provider allows these settings to be overridden or contact their support for assistance.
Error messages
After adjusting the settings, you may encounter error messages like “500 Internal Server Error.” This usually happens if there is a syntax error in your .htaccess
or php.ini
file. Double-check the syntax to ensure there are no mistakes.
Limited by hosting plan
If your hosting plan imposes strict execution time limits that cannot be adjusted, you may need to consider upgrading to a more flexible plan or switching to a different hosting provider that better suits your needs.
Source: https://www.cyberseo.net/blog/increase-php-maximum-execution-time/