Wanna install Laravel on DirectAdmin as a PHP framework? We can install it for you.
Laravel is considered as one of the best PHP Frameworks. Because it provides incredible features such as easy database migration, simple authentication techniques, security within its framework, etc.
However, installing Laravel on DirectAdmin needs expertise as it needs Linux knowledge.
At Bobcares, we often get requests to install Laravel on DirectAdmin as part of our Server Management Services.
Today, let’s get into the details and see how our Support Engineers install Laravel on DirectAdmin and fix related errors.
How to install Laravel on DirectAdmin
Laravel is a popular, open-source PHP web application framework. Here, let’s see how our Support Engineers install Laravel on DirectAdmin.
1. Firstly, we login to the server via SSH as a root user. Then, we update the system and install the necessary packages with the following commands.
yum update
yum install -y git curl
2. Next, we install the composer by using the below commands. Because it is a dependency manager for PHP with which you can install packages.
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
3. Before installing Laravel, we delete the default files created by DirectAdmin and switch to the domain root directory by using the following commands.
rm -rf /home/USERNAME/domains/LARAVEL_DOMAIN_NAME/public_html/*
cd /home/USERNAME/domains/LARAVEL_DOMAIN_NAME/public_html/
4. Then, we install Laravel using the composer create-project command.
composer create-project --prefer-dist laravel/laravel
5. Also, we make sure that whether ownership and permissions are given correctly or not.
chown -R USERNAME:USERNAME /home/username/domains/LARAVEL_DOMAIN_NAME/public_html/
6. After that, we configure DirectAdmin. For that, we login to the DirectAdmin as an admin user and go to Extra Features section >> select Custom HTTPD Configurations.
7. We select the domain on which Laravel needs to install. Then, we edit the webserver configuration as change it from public_html to public. Because it required by Laravel.
So, we add the following lines in the “Httpd.conf Customization for” text-area
|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html/public|
8. Finally, we click on the Save button to update the changes.
That’s it
How we fixed the common errors
At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face problems while managing DirectAdmin servers.
Now, let’s see the major reasons for this Laravel related errors and how our Support Engineers fix the top errors.
PHP incompatibility
Recently, one of our customers had a problem with Laravel in the DirectAdmin server. He was getting an error after he set doc root to /home/mydir/domains/domain.com/public_html/public.
The error occurred as he attempted to access domain.com,
500 Internal Server Error
On checking, our Support Engineers found an entry while checking the error log /var/log/httpd/domains/domain.com.error.log. It showed as,
PHP Parse error: syntax error, unexpected '[' in /home/mydir/domains/domain.com/public_html/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 411
Then, we checked the version of PHP that running on the webserver and found that the problem was related to his PHP version. He was using an old PHP version, Laravel 5.6.
So, we switch the PHP version from php5.6 to php7.1.
Now, Laravel worked fine without any error in the domain.
In short, the Laravel version should compatible with the PHP version. Otherwise, it will give 500 Internal Server Error.
Problem with permissions
Sometimes, customers may face problems after installing Laravel on the DirectAdmin server. Because they may forget to change the ownership of the Laravel document root. So, our Support Engineers make sure that the given ownership and permissions are correct
If not, we change it as follows.
chown -R USERNAME:USERNAME /home/username/domains/LARAVEL_DOMAIN_NAME/public_html/
[Need assistance to install Laravel on DirectAdmin? We’ll help you.]
Conclusion
In short, Laravel is an open-source PHP web application framework. However, incorrect directory permissions and PHP compatibility block the proper working of Laravel. Today, we saw how to install Laravel on DirectAdmin and how our Support Engineers fixed related errors.
0 Comments