1

I have install a laravel in a htdocs folder using following command. When I have start a project using artisan it not start.please review a things.

​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

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
Vasim Shaikh
  • 4,485
  • 2
  • 23
  • 52

4 Answers4

2

Install the following dependency:

sudo apt-get install php7.1-xml

You can try refer the issues here: PHP7 : install ext-dom issue

Adlan Arif Zakaria
  • 1,706
  • 1
  • 8
  • 13
  • 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 – Vasim Shaikh Feb 26 '18 at 15:01
  • 1
    Can you try running `composer update --no-scripts` and see the result if it is fixed? – Adlan Arif Zakaria Feb 26 '18 at 15:25
  • should I install composer and both in same directory. do you have any referance? – Vasim Shaikh Feb 26 '18 at 15:53
  • 1
    If you are using Ubuntu 16.04, you can try check out this [link](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-16-04) – Adlan Arif Zakaria Feb 26 '18 at 15:57
1

Your screenshot says: "phpunit required ext-dom" ..

That means, you have to install PHP-XML extension in order to get phpunit and Laravel properly installed.

lucasvscn
  • 1,210
  • 1
  • 11
  • 16
  • 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 – Vasim Shaikh Feb 26 '18 at 15:02
  • @VasimVanzara you need to read the error messages. "NO SUCH FILE OR DIRECTORY" means that there's no file called "`artisan`" inside your `/opt/lampp/htdocs/first-project/` directory. You need to install the PHP extension `php-xml` in order to properly install Laravel. – lucasvscn Feb 27 '18 at 12:00
1

You are missing the correct extension for PHP try installing

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

Hayden Sweet
  • 170
  • 1
  • 16
  • 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 – Vasim Shaikh Feb 26 '18 at 15:02
0

You are missing ext-dom, php7.1-xml has the packages you need, try installing it by running:

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.

You can also refer their tutorial which is How To Deploy a Laravel Application with Nginx on Ubuntu 16.04.

the_lorem_ipsum_guy
  • 452
  • 1
  • 12
  • 27