Before you start

A blank page on a Laravel site usually means an error is happening but is not shown on screen. The steps below check the most common causes, starting with the simplest fixes.

Some steps need SSH or Terminal access. Check your plan details in the client area at my.hostking.host before you start.

Check the document root

Laravel's entry point is the public folder. The domain must point to this folder, not to the main project folder.

Check the document root in your control panel. If you cannot change it for your primary domain, contact support for help.

cPanel

  1. Log in to cPanel.
  2. Open Domains.
  3. Find the domain and check that its document root ends in /public.

DirectAdmin

  1. Log in to DirectAdmin.
  2. Check the document root for your domain in the domain settings.
  3. Make sure it points to the public folder of your Laravel project.

Set file permissions

Laravel must be able to write to the storage and bootstrap/cache folders. If it cannot write its log file, the page can stay blank.

  1. Set the permissions of storage and bootstrap/cache to 775, including their subfolders and files.
  2. Check that index.php has permissions of 755.

Do not set these folders to 777. It makes them writable by any user on the server.

Show the error message

Laravel hides error details when debug mode is off. Turning debug mode on shows the error message on screen.

  1. Open the .env file in the root of your Laravel project.
  2. Find APP_DEBUG and set it to true.
  3. Reload the page and read the error message.
  4. Fix the problem, then set APP_DEBUG back to false.

Warning: Debug output can show file paths, environment values and database details. Always set APP_DEBUG back to false when you finish.

Check the PHP version

Your Laravel version needs a supported PHP version. Check the PHP requirement for your version of Laravel first.

cPanel

  1. Log in to cPanel.
  2. In the Software section, open MultiPHP Manager.
  3. Tick the domain you want to change.
  4. Choose a version from the PHP Version dropdown.
  5. Click Apply.

If your .htaccess file contains old PHP handler lines, remove them before you change the version. Old lines can cause a 500 error.

DirectAdmin

  1. Log in to DirectAdmin.
  2. Find the PHP version setting for your domain.
  3. Choose a version that your Laravel version supports.

Clear the cache

These commands need SSH or Terminal access. Run them from the root of your Laravel project.

  1. Run php artisan optimize:clear.
  2. Run composer dump-autoload.

If a command returns an error, the error message usually shows where the problem is.

Check the log files

Log files show what went wrong. Check these files after each step:

  • storage/logs/laravel.log in your Laravel project.
  • The PHP error log, found in cPanel under Metrics and then Errors.

If the page is blank and there is no log entry, the log folder may not be writable. Go back to the file permissions step.

Troubleshooting

  • Still blank with debug mode on: Read the message on screen and fix the problem it describes.
  • Database errors: Check the database name, user and host in the .env file. In cPanel, check them in MySQL Databases.
  • Missing .env file: Create it from your project's example file and set the correct values.

Get help

If the page is still blank, contact our support team. You can use live chat on the Hostking website or open a support ticket from the client area.

Was this answer helpful? 0 Users Found This Useful (0 Votes)