Issue
I am trying to install Laravel on vps with Direct admin. Below is my Apache config file
<VirtualHost MYIP:80 >
ServerName www.domain.com
ServerAlias www.domain.com domain.com
ServerAdmin [email protected]
DocumentRoot /home/mydir/domains/domain.com/public_html
ScriptAlias /cgi-bin/ /home/mydir/domains/domain.com/public_html/cgi-bin/
UseCanonicalName OFF
<IfModule !mod_ruid2.c>
SuexecUserGroup mydir mydir
</IfModule>
CustomLog /var/log/httpd/domains/domain.com.bytes bytes
CustomLog /var/log/httpd/domains/domain.com.log combined
ErrorLog /var/log/httpd/domains/domain.com.error.log
<Directory /home/mydir/domains/domain.com/public_html>
php_admin_flag safe_mode OFF
php_admin_flag engine ON
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f chat$
php_admin_value mail.log /home/mydir/.php/php-mail.log
php_admin_value open_basedir /home/mydir/:/tmp:/var/tmp:/usr/loc$
</Directory>
</VirtualHost>
According to the Laravel manual I have to point to the public
directory. After I set doc root
to /home/mydir/domains/domain.com/public_html/public
I get this error when I try to access domain.com
500 Internal Server Error
UPDATE: /var/log/httpd/domains/domain.com.error.log
contains this Laravel error
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
Solution
Firstly if you have root access .. you can check your php version ...
php -v
upgrade it to php 5.4 .
i have installed Laravel in Directadmin successfully by using below .htaccess config file inside public folder ...
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
In direct admin you can change the apache config of Document root for specific domain inside
etc/httpd/conf.d/domians/yourdomian.conf
change it to ...
DocumentRoot "/var/www/html/domians/yourdomain/public"
Thats it ;) It should work fine ;)
Answered By - Your Friend Answer Checked By - Clifford M. (WPSolving Volunteer)