acquia / lightning-project

A Composer-based installer for the Lightning distribution of Drupal 8. Support ended on November 2, 2021 and this project is no longer maintained.
133 stars 60 forks source link

Warning: require(/var/www/html/../vendor/autoload.php): failed to open stream: No such file or directory #26

Closed magick93 closed 4 years ago

magick93 commented 7 years ago

Hello

I have run

composer create-project acquia/lightning-project lightningdev
composer update
composer install

Running just the first command seems to be enough, in that there are no errors. The other two are just for good measure.

But when I try to run the generated drupal site I get:

Warning: require(/var/www/html/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/autoload.php on line 17

Fatal error: require(): Failed opening required '/var/www/html/../vendor/autoload.php' (include_path='.:') in /var/www/html/autoload.php on line 17

Any ideas what I am doing wrong?

balsama commented 7 years ago

It looks like your webserver is serving pages from a different directory than where you built lightning. Lightning Project will build a docroot inside of the the lightningdev directory you created with the create-project directory.

So you should point your webserver to:

/path/to/where/you/ran/create-project/lightningdev/docroot
magick93 commented 7 years ago

Yes the webserver is point at the docroot directory.

On Sun, Jan 22, 2017 at 3:42 PM, Adam Balsam notifications@github.com wrote:

It looks like your webserver is serving pages from a different directory than where you built lightning. Lightning Project will build a docroot inside of the the lightningdev directory you created with the create-project directory.

So you should point your webserver to:

/path/to/where/you/ran/create-project/lightningdev/docroot

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/acquia/lightning-project/issues/26#issuecomment-274334859, or mute the thread https://github.com/notifications/unsubscribe-auth/ACEpHXFSTHVRFPPw5hUf2Ky58kzAyqknks5rU2rcgaJpZM4LqX76 .

balsama commented 7 years ago

Yes the webserver is point at the docroot directory.

Your fatal error tells me otherwise. It shows that your webserver is pointed to the /var/www/html directory.

magick93 commented 7 years ago

To clarify, Im running Drupal using docker-compose.

In the compose file I map the docroot to /var/www/html

volumes:
  - ./lighning/docroot:/var/www/html

On Mon, Jan 23, 2017 at 8:23 PM, Adam Balsam notifications@github.com wrote:

Yes the webserver is point at the docroot directory.

Your fatal error tells me otherwise. It shows that your webserver is pointed to the /var/www/html directory.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/acquia/lightning-project/issues/26#issuecomment-274589988, or mute the thread https://github.com/notifications/unsubscribe-auth/ACEpHYomTHPQv027NMfyImHJDg2dvtQ6ks5rVP5CgaJpZM4LqX76 .

brokenmachine commented 7 years ago

It looks like some time has passed since discussion of this issue, but I am having the same problem (which I have solved, but in a non-optimal way). On my first attempt, I built Lighting via Composer in my home directory, and then copied the contents of the generated docroot directory to /var/www/html. However, when running /core/install.php, I got the error and upon looking at what Composer generated, it became apparent that autoload.php file was referencing the vendor directory above the docroot directory, so I had to copy the entire directory that Composer generated, in order for that vendor to be accessible, after which, the installer runs fine. Everything I read on Acquia says one should be able to make only the docroot accessible to the web server. Of course, this is not optimal, so perhaps the process I am following is not correct, let me know.

balsama commented 7 years ago

Hi @brokenmachine. The process you're following is correct. The vendor directory in a composer-generated codebase is one level up from the docroot. And it is needed to run the application.

It's true that only docroot needs to be served by the webserver, but the vendor and autoloader still need to be accessible to the application. It's possible that there is some outdated documentation from Acquia since this is a general shift in the Drupal community as a whole - away from packaged tarballs that contain dependencies.

brokenmachine commented 7 years ago

Thanks @balsama. I'm on Apache (on Ubuntu) and the docroot was the default /var/www/html, so I ended up just placing the entire Composer-generated project under /var/www, and then reconfiguring Apache such that the docroot was /var/www/docroot, thereby making the Composer and Drupal happy and making my Drupal site accessible at the root from the browser. I forgot that the include directive in PHP is file-system based and the web document root doesn't matter for this, so all's well that ends well. :)

nco71 commented 7 years ago

In the case of using docker , I don't think it is necessary to copy the files , the reason it cannot find the file is that those are not mounted , the best solution I found was to make my volume for the webserver and php to be organized that way :

php / nginx / apache

volumes : ./www/ : /var/html

Then I set up the variable to inform the webserver root new location ( in web directory )

NGINX_SERVER_ROOT : /var/www/html/web/

phenaproxima commented 5 years ago

@Gezgin7, this repository is for a Drupal distribution, so it has nothing do with Wordpress and I don't think we'll be able to offer any useful advice for your case. You may want to ask for support in whatever the Wordpress support channels are. Sorry!

bbbootstrap commented 4 years ago