Some people see an error page on their website with the following contents:
This site / page has used all avaialble php / apache processes allowed on free hosting.
Refreshing the page once the amount of apache / php processes are reduced will cause the site to work
We would recommend upgrading your hosting account at IFastNet Premium hosting accounts, premium hosting accounts have MUCH higher resources dedicated to them.
This article explains why you may see this page, and what you can do to avoid seeing it in the future.
What are PHP / Apache processes?
Every time a request to a URL on your website is made, a new program is started to fetch the file and execute any PHP code. This process then executes your code if required, sends the response to the visitor, and then quits.
There are two things to note with this:
- One entry process is created for every request, not every PHP file. So if your code includes multiple PHP files, these still count as one entry process.
- All requests generate an entry process. Not just the requests to PHP, but also those to static HTML, CSS, JS, images and any other files.
Why do I see this error on my website?
The short answer is simple: there are too many requests being executed on your account at the same time.
There are various reasons why this can happen. Here are some common causes:
- Too many URLs on the page. This usually happens with image galleries. Some image galleries will cause the browser to download a large number of images the moment the page is opened. Reducing the number of images per page, implementing lazy loading, or perhaps moving the images to an external image hosting service, can help with this.
- Too many simultaneous visitors. If many people are trying to open a page on your website at the same time, this typically launches a lot of PHP code as well.
- Website pages take too long to load. A PHP/Apache process is freed whenever a script finishes executing. If your code completes in 1 second, it won’t use up any processes after that 1 second. If your code takes 10 seconds to complete, it uses up processes for much longer.
How can I reduce my process usage?
Here are some recommendations which may help to reduce your process usage.
- Ensure static files (like HTML or CSS files) don’t have the
.phpfile extension. All requests to files with the
.phpextension generate entry processes, even if there is no actual PHP code in the file.
- Reduce usage of AJAX and other background requests. If your website has code that constantly refreshes the page in the background (to check for changes or new messages), this can easily cause high entry process usage with few visitors.
- Reduce the amount of time it takes for a script or program to run. Remove any unnecessary tasks from the program.
- Reduce the amount of files called on the initial load of the web page. You can do this by combining images, or splitting one page into multiple pages.
If the suggestions above are not an option, please consider to upgrade your account to premium hosting, where you get much higher process limits.
How can I increase my process allocation?
The process allocation on free hosting cannot be increased upon request. We treat all accounts equally, and will not give people unfair benefits just because they ask for it.
If your process usage is still too high after following the recommendations here (or you are having trouble applying the tips to your website), please consider upgrading your account to premium hosting. On premium hosting the entry process allocation is much higher than on free hosting.