Laravel is a modern PHP framework designed for building robust web applications. While Softaculous can automate installation, you may sometimes need to install Laravel manually, for example, if you want a specific version or are working on an unmanaged server.
Why Install Laravel Manually?
-
Greater control over version selection.
-
Works on unmanaged VPS or dedicated servers.
-
Useful for developers who want custom setups.
Steps to Install Laravel Manually
-
Log in to Your Account via SSH.
-
Use an SSH client to connect to your hosting account.
-
-
Install Laravel Using Composer.
-
Laravel uses Composer, a PHP dependency manager.
-
Navigate to your home directory:
Bash cd ~ -
Run the following command (replace
projectwith your desired project name):Bash composer create-project laravel/laravel project -
This installs Laravel in
/home/username/project.
-
-
Set Up Artisan Alias (Optional).
-
Artisan is Laravel’s command‑line interface.
-
To run Artisan by simply typing
artisan, add an alias:echo 'alias artisan="php /home/username/project/artisan"' >> ~/.bashrc source ~/.bashrc
-
-
Make Laravel Publicly Accessible.
-
Copy the contents of the
publicdirectory to yourpublic_htmlfolder:Bash cp -r ~/project/public/* ~/public_html -
Alternatively, copy to a subdirectory (e.g.,
public_html/laravel):Bash cp -r ~/project/public/* ~/public_html/laravel -
In this case, your site will be accessible at
http://example.com/laravel.
-
-
Update index.php Paths.
-
Open
public_html/index.phpin a text editor. -
Update the following lines to include the correct project directory:
require __DIR__.'/../project/vendor/autoload.php'; require __DIR__.'/../project/bootstrap/app.php';
-
-
Verify Installation.
-
In your browser, go to
http://example.com. -
You should see the Laravel welcome page.
-
Notes
|