简体   繁体   English

在LAMP上发布Laravel项目和项目部署

[英]Publish Laravel Project and Project Deployment on LAMP

I am now developing a PHP website using Laravel 5 framework. 我现在正在使用Laravel 5框架开发一个PHP网站。 I published the website through Git clone to the server. 我通过Git克隆将网站发布到服务器。 However, after visiting the URL, the website only shows its structures, which is shown as: http://mikemikezhu.me/laravel/laravel_trial/ 但是,在访问该URL之后,该网站仅显示其结构,该结构显示为: http : //mikemikezhu.me/laravel/laravel_trial/

The index.php in the public folder cannot be parsed, and only the folder structure is displayed. 公用文件夹中的index.php无法解析,仅显示文件夹结构。 My server is running Centos 7 system. 我的服务器正在运行Centos 7系统。 The web server is Apache and the PHP version is 5.4.16. Web服务器是Apache,PHP版本是5.4.16。 I am wondering whether it is because the PHP version is too old to run the Laravel. 我想知道是否是因为PHP版本太旧而无法运行Laravel。 Or is there any other ways to publish the website correctly? 还是有其他方法可以正确发布网站? I am not going to use Forge and Envoyer bacause they are not free of charge. 我不会使用Forge和Envoyer,因为它们不是免费的。

Check if you have the correct PHP version for your application with the command: 使用以下命令检查您的应用程序是否具有正确的PHP版本:

php -v

If you are deploying the app with Git, check if the folder permissions are correct and compatible with the Apache user. 如果要使用Git部署应用程序,请检查文件夹权限是否正确并且与Apache用户兼容。

  1. Firstly make sure the whole directory structure including files is owned by the apache user - using the chown command. 首先,使用chown命令确保apache用户拥有包括文件在内的整个目录结构。

  2. you'll want to point your vhost to the public folder, not the project route 您需要将虚拟主机指向公用文件夹,而不是项目路径

  3. https://laravel.com/docs/5.0/errors shows you how to enable debug and logging - great for seeing why it might not be working https://laravel.com/docs/5.0/errors向您展示如何启用调试和日志记录-非常适合查看为什么它可能无法正常工作

  4. I'd update to at least PHP 5.6 as @amieiro mentions 我会至少更新到PHP 5.6,就像@amieiro提到的那样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM