Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Nababur's avatar
Level 43

How can deploy laravel project in cpanel server ?

I am getting errors after uploading the Laravel project on the server.

This page isn’t working is currently unable to handle this request. HTTP ERROR 500

0 likes
9 replies
LaryAI's avatar
Level 58

To deploy a Laravel project on a cPanel server, you can follow these steps:

  1. Make sure your cPanel server meets the Laravel system requirements, such as PHP version, extensions, and database support.

  2. Create a new subdomain or add-on domain in cPanel to point to the public directory of your Laravel project. This can usually be done through the "Domains" or "Subdomains" section in cPanel.

  3. Upload your Laravel project files to the appropriate directory on the server. Typically, this would be the public_html directory for the main domain or the subdomain/add-on domain directory you created in the previous step.

  4. Set the correct file permissions for your Laravel project. The storage and bootstrap/cache directories should be writable by the web server. You can do this using the following commands via SSH or cPanel's file manager:

cd /path/to/your/laravel/project
chmod -R 755 storage bootstrap/cache
  1. Create a new MySQL database and user in cPanel. Make sure to grant the user all necessary privileges for the database.

  2. Update the .env file in your Laravel project with the database connection details. You can find the .env file in the root directory of your Laravel project. Update the following lines with your database credentials:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_database_username
DB_PASSWORD=your_database_password
  1. Run the necessary Laravel migration and seed commands to set up your database tables and initial data. You can do this via SSH or by using Laravel's Artisan command line tool. For example:
php artisan migrate --seed
  1. Finally, make sure your cPanel server has the necessary PHP extensions enabled for Laravel to work properly. Common extensions include OpenSSL, PDO, Mbstring, Tokenizer, and XML. You can usually enable these extensions through the "Select PHP Version" or "PHP Extensions" section in cPanel.

If you're still encountering errors after following these steps, it would be helpful to provide more specific details about the errors you're seeing.

Nababur's avatar
Level 43

@tisuchi Thanks bro, for your comment, I have already deployed the file in the server, but getting another small error, After running the npm build my vite vue js does not work.

build folder in public but the link does not generate with the public folder.

Not work original https://nababur.info/jobfinder/build/assets/app-5520e0f1.css

After i add "public" before build the directory then works. How can i solve it dynamically?

https://nababur.info/jobfinder/public/build/assets/app-ac8924d1.js

Here is the vite config file url:

@vite(['resources/sass/app.scss', 'resources/js/app.js'])

jlrdw's avatar

@Nababur

After i add "public" before build the directory then works

If having to add public, something is not set up correctly, make sure you are pointing to public as the document root.

Also correctly setting all of this up has been discussed in many past post by me and others.

jlrdw's avatar

@Nababur see https://laravel.com/docs/10.x/deployment#nginx

Note this line:

root /srv/example.com/public;

If using Apache do the equivalent. If you search for a post from @tray2 he has an .htaccess to handle this, sorry I did not save the link.

But that is just a first step to make sure you are correctly pointing to public correctly. I don't know all problems you may have with the hosting company.

Also see @sinnbeck answer here: https://laracasts.com/discuss/channels/vite/laravel-in-shared-hosting-vite-manifestjson-not-found

Edit:

And you did the symbolic link? If not working try using the ln from linux command.

Nababur's avatar
Level 43

@jlrdw I think WordPress is the best way to install or deploy any site on a server. I am facing a lot of issues deploying the server in the Laravel project.

Please or to participate in this conversation.