Development and databases

Restart your hosting's PHP from cPanel

Reviewed on 4 min read PHP cPanel cache errors

Your websites do not start PHP from scratch on every visit. The server keeps your account's PHP processes running and holds your websites' already compiled code in memory (the PHP cache, OPcache), so they respond faster. Restarting PHP closes those processes and empties that memory: the next visit loads the files again exactly as they are on disk.

You do not need it day to day. It is a resource for specific cases, which you will find below.

When to use it

Only as an exception:

  • The website or its admin area shows a blank page, or errors that make no sense, right after you clear the application's cache, update it or change PHP files, and it does not recover on its own within a few minutes.
  • You have changed a PHP setting (a limit, an extension) and the website still behaves as before.

It does not help with:

  • A slow website. The restart empties the PHP cache, so the first visits afterwards are slower, not faster.
  • An error that keeps coming back. If it happens again after the restart, the cause is somewhere else. Write to us and we will look into it.

What the restart does

  • It covers the whole account. It affects the PHP of all the websites on your hosting, not just one folder or one website. That is why the file that triggers it is in the home folder and not in each website's folder.
  • It takes effect with the next visit. Each website restarts its PHP when it receives the first visit after the change.
  • It does not delete anything or change the configuration. Nor does it empty your application's cache or the LiteSpeed Cache one: those are separate.
  • It empties the PHP cache. The first visits take a little longer while it fills up again.

If a long process is running at that moment (an import, a payment, a backup), wait for it to finish: whatever is running right then may be cut off.

How to restart PHP

  1. Log in to cPanel and open File Manager.
  2. Stay in the account's home folder, the one that contains public_html. Do not go into public_html.
  3. Click Settings, at the top right, turn on Show Hidden Files (dotfiles) and save.
  4. Select the .lsphp_restart.txt file and click Edit. If it asks about the encoding, keep the one it suggests.
  5. Without changing anything, click Save Changes.
  6. Open the website or its admin area: that visit applies the restart.

If the .lsphp_restart.txt file is not there, create it in that same home folder with + File, with that exact name (with the dot at the start). Creating it already triggers the restart, so go straight to step 6.

The file stays in the account after you use it. To restart again, repeat steps 4 to 6.

You will find the details of File Manager in cPanel File Manager.

How it works

Our servers serve websites with LiteSpeed. LiteSpeed watches the modification date of .lsphp_restart.txt in each account's home folder: when it changes, it restarts that account's PHP with the next visit. What you write inside does not matter; saving it, even without changes, updates its date.

If the problem comes back

If you have to restart often, or the website still shows a blank page after restarting and visiting it, write to us from the client area. There is usually a cause that can be fixed, such as a PHP cache that is too small for your application. To see which error the website gives, see Enable PHP error logging and display.

You may also find useful

Something wrong or out of date? Tell us and we will review it.