我在Laravel 4中有一个项目。它在比特桶上。我已经从本地机器上的回购中下载了它,装入了本地虚拟主机,运行良好。但是,当我在服务器上克隆了同一个项目并创建了一个虚拟主机时,会显示500内部服务器错误。在同一个域上,laravel 5中同一项目的另一个虚拟主机运行良好。
这是我为laravel 4项目编写的虚拟主机文件代码:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName l4.mydomain
ServerAlias l4.mydomain
DocumentRoot /var/www/L4/public
<Directory /var/www/L4/public/>
AllowOverride All
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
这是laravel 4项目的.htaccess代码:
IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我还将"index.php"更改为644权限,但没有使用
这是在日志文件中发现的警告和错误:
PHP Warning: require(/var/www/myproject/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/L4/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/var/www/myproject/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/L4/bootstrap/autoload.php on line 17
如果您正在获得
"PHP Fatal error: require(): Failed opening required '/var/www/L4/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/L4/bootstrap/autoload.php on line 17"
在您的错误日志中,我想说您似乎从未在服务器上运行composer安装。