[英]Getting Errors while creating Laravel Application in Ubuntu
I'm using Ubuntu 17.04. 我正在使用Ubuntu 17.04。 I Tried to Access and /etc/php/7.0/cli and Edited php.ini file.
我试图访问和/etc/php/7.0/cli和编辑的php.ini文件。 But didn't helped in anyway.
但是无论如何都没有帮助。 How to Enable these following extensions.
如何启用以下扩展。
ninja@ninja:~/Documents/lartest$ laravel new demo
Crafting application...
Cannot create cache directory /home/ninja/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/ninja/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/ninja/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for phpunit/php-code-coverage 4.0.8 -> satisfiable by phpunit/php-code-coverage[4.0.8].
- phpunit/php-code-coverage 4.0.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 2
- Installation request for phpunit/phpunit 5.7.21 -> satisfiable by phpunit/phpunit[5.7.21].
- phpunit/phpunit 5.7.21 requires ext-dom * -> the requested PHP extension dom is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-curl.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mbstring.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
- /etc/php/7.0/cli/conf.d/20-zip.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Application ready! Build something amazing.
ninja@ninja:~/Documents/lartest/demo$ php artisan serve PHP Warning: require(/home/ninja/Documents/lartest/demo/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/ninja/Documents/lartest/demo/bootstrap/autoload.php on line 17 PHP Fatal error: require(): Failed opening required '/home/ninja/Documents/lartest/demo/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php') in /home/ninja/Documents/lartest/demo/bootstrap/autoload.php on line 17
Assuming you've installed php7.0-cli successfully. 假设您已经成功安装了php7.0-cli。
Now run following command in your terminal: 现在在终端中运行以下命令:
sudo apt-get install php7.0-mbstring
sudo apt-get install php7.0-xml
Then try to install Laravel again. 然后尝试再次安装Laravel。
Let me know if you still face any problem. 让我知道您是否仍然遇到任何问题。
首先为php扩展安装ext-dom,然后再次运行compser update
You can complete the dependencies needed by Laravel first before installing laravel. 您可以先完成Laravel所需的依赖关系,然后再安装laravel。 For dependencies information please see here
有关依赖项的信息,请参见此处
I can do it this way: 我可以这样:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Here I use PHP 7.1 在这里我使用PHP 7.1
sudo apt-get install php7.1
If you want to use another version just change it yourself. 如果要使用其他版本,请自行更改。
After PHP is complete installed can continue to install the required extension. PHP完成安装后,可以继续安装所需的扩展名。
sudo apt-get install php7.1 php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-xml php7.1-gd
The extension above should laravel can be installed smoothly. 上面的扩展应该laravel可以顺利安装。 You can also just take one or more of the extensions above, for example:
您也可以仅采用上述扩展中的一个或多个,例如:
sudo apt-get install php7.1-mbstring php7.1-xml
And then restart your server. 然后重新启动服务器。
Hopefully useful. 希望有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.