I am trying to install Laravel on vps with Direct admin. Below is my Apache config file
我正在尝试使用Direct admin在vps上安装Laravel。下面是我的Apache配置文件
<VirtualHost MYIP:80 >
ServerName www.domain.com
ServerAlias www.domain.com domain.com
ServerAdmin webmaster@chat.am
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
根据Laravel手册,我必须指向公共目录。在我将doc root设置为/home/mydir/domains/domain.com/public_html/public后,当我尝试访问domain.com时出现此错误
500 Internal Server Error
500内部服务器错误
UPDATE: /var/log/httpd/domains/domain.com.error.log
contains this Laravel error
更新:/var/log/httpd/domains/domain.com.error.log包含此Laravel错误
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
PHP解析错误:语法错误,意外'['在第411行/home/mydir/domains/domain.com/public_html/vendor/laravel/framework/src/Illuminate/Support/helpers.php
2 个解决方案
#1
1
Firstly if you have root access .. you can check your php version ...
首先,如果你有root访问权限..你可以检查你的PHP版本...
php -v
upgrade it to php 5.4 .
将其升级到php 5.4。
i have installed Laravel in Directadmin successfully by using below .htaccess config file inside public folder ...
我使用公共文件夹中的.htaccess配置文件成功在Directadmin中安装了Laravel ...
<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
在直接管理中,您可以更改内部特定域的文档根目录的apache配置
etc/httpd/conf.d/domians/yourdomian.conf
change it to ...
把它改成......
DocumentRoot "/var/www/html/domians/yourdomain/public"
Thats it ;) It should work fine ;)
多数民众赞成;)它应该工作正常;)
#2
4
The problem here seems to be your PHP version. Line 411 in helpers.php
is this:
这里的问题似乎是你的PHP版本。 helpers.php中的第411行是这样的:
$results = [];
It is the short syntax for creating a new array as of PHP 5.4. see php.net
它是从PHP 5.4开始创建新数组的简短语法。看到php.net
As the documentation states, Laravel 4.2 requires PHP >= 5.4
正如文档所述,Laravel 4.2要求PHP> = 5.4
But the version on your server is probably lower, causing this error.
但是服务器上的版本可能更低,导致此错误。
Obviously the best solution to this is upgrading to at least PHP 5.4.
If you can't upgrade, use Laravel 4.1 (requires PHP >= 5.3.7)
显然,最好的解决方案是升级到至少PHP 5.4。如果无法升级,请使用Laravel 4.1(要求PHP> = 5.3.7)
#1
1
Firstly if you have root access .. you can check your php version ...
首先,如果你有root访问权限..你可以检查你的PHP版本...
php -v
upgrade it to php 5.4 .
将其升级到php 5.4。
i have installed Laravel in Directadmin successfully by using below .htaccess config file inside public folder ...
我使用公共文件夹中的.htaccess配置文件成功在Directadmin中安装了Laravel ...
<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
在直接管理中,您可以更改内部特定域的文档根目录的apache配置
etc/httpd/conf.d/domians/yourdomian.conf
change it to ...
把它改成......
DocumentRoot "/var/www/html/domians/yourdomain/public"
Thats it ;) It should work fine ;)
多数民众赞成;)它应该工作正常;)
#2
4
The problem here seems to be your PHP version. Line 411 in helpers.php
is this:
这里的问题似乎是你的PHP版本。 helpers.php中的第411行是这样的:
$results = [];
It is the short syntax for creating a new array as of PHP 5.4. see php.net
它是从PHP 5.4开始创建新数组的简短语法。看到php.net
As the documentation states, Laravel 4.2 requires PHP >= 5.4
正如文档所述,Laravel 4.2要求PHP> = 5.4
But the version on your server is probably lower, causing this error.
但是服务器上的版本可能更低,导致此错误。
Obviously the best solution to this is upgrading to at least PHP 5.4.
If you can't upgrade, use Laravel 4.1 (requires PHP >= 5.3.7)
显然,最好的解决方案是升级到至少PHP 5.4。如果无法升级,请使用Laravel 4.1(要求PHP> = 5.3.7)