简体   繁体   English

Laravel 项目不工作 Lampp & Ubuntu 16.04

[英]Laravel Project is not working Lampp & Ubuntu 16.04

I have install a laravel in a htdocs folder using following command.我使用以下命令在 htdocs 文件夹中安装了 laravel。 When I have start a project using artisan it not start.please review a things.当我使用 artisan 开始一个项目时,它不会开始。请检查一下。

​sevenbits11@SBT-PC-11:/opt/lampp/htdocs$ sudo composer create-project laravel/laravel first-project --prefer-dist
sevenbits11@SBT-PC-11:/opt/lampp/htdocs/first-project$ php artisan serve
PHP Warning:  require(/opt/lampp/htdocs/first-project/vendor/autoload.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/first-project/artisan on line 18
PHP Fatal error:  require(): Failed opening required '/opt/lampp/htdocs/first-project/vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/lampp/htdocs/first-project/artisan on line 18

Updated After Applied solution应用解决方案后更新

sudo php artisan serve
PHP Warning:  require(/opt/lampp/htdocs/first-project/vendor/autoload.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/first-project/artisan on line 18
PHP Fatal error:  require(): Failed opening required '/opt/lampp/htdocs/first-project/vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/lampp/htdocs/first-project/artisan on line 18

在此处输入图片说明

Install the following dependency:安装以下依赖项:

sudo apt-get install php7.1-xml

You can try refer the issues here: PHP7 : install ext-dom issue您可以尝试在此处参考问题: PHP7 : install ext-dom issue

Your screenshot says: "phpunit required ext-dom" ..您的屏幕截图显示:“phpunit 需要 ext-dom”..

That means, you have to install PHP-XML extension in order to get phpunit and Laravel properly installed.这意味着,您必须安装 PHP-XML 扩展才能正确安装 phpunit 和 Laravel。

You are missing the correct extension for PHP try installing您缺少正确的 PHP 扩展,请尝试安装

sudo apt-get install php7.1-dom

You may also need to install other packages to get everything to update.您可能还需要安装其他软件包才能更新所有内容。

Take a look at this link may help you https://askubuntu.com/questions/795629/install-php-extensions-in-ubuntu-16-04看看这个链接可能对你有帮助https://askubuntu.com/questions/795629/install-php-extensions-in-ubuntu-16-04

You are missing ext-dom , php7.1-xml has the packages you need, try installing it by running:你缺少ext-domphp7.1-xml有你需要的包,尝试通过运行安装它:

sudo apt-get update
sudo apt-get install php7.1-xml

Then run this command:然后运行这个命令:

composer install

If you don't have a composer you can follow this link from Digital Ocean which is very clear.如果您没有作曲家,您可以点击来自 Digital Ocean 的此链接,该链接非常清楚。

You can also refer their tutorial which is How To Deploy a Laravel Application with Nginx on Ubuntu 16.04 .您还可以参考他们的教程,即如何在 Ubuntu 16.04 上使用 Nginx 部署 Laravel 应用程序

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

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