MC Naveen
MC Naveen

Reputation: 515

Getting Errors while creating Laravel Application in Ubuntu

I'm using Ubuntu 17.04. I Tried to Access and /etc/php/7.0/cli and Edited php.ini file. 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.


Also Getting Error while executing Serve Command

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

Upvotes: 0

Views: 390

Answers (3)

Wisnu
Wisnu

Reputation: 337

You can complete the dependencies needed by Laravel first before installing 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

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.

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. 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.

Upvotes: 0

Shawinder Jit Singh
Shawinder Jit Singh

Reputation: 143

install ext-dom for php extension first then run compser update again

Upvotes: 0

Awolad Hossain
Awolad Hossain

Reputation: 1108

Assuming you've installed php7.0-cli successfully.

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.

Let me know if you still face any problem.

Upvotes: 1

Related Questions