Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: require(): Failed opening required 'preflight.inc' #165

Closed
projekt8 opened this issue Jun 17, 2016 · 11 comments
Closed

Fatal error: require(): Failed opening required 'preflight.inc' #165

projekt8 opened this issue Jun 17, 2016 · 11 comments

Comments

@projekt8
Copy link

I've encountered a problem when using drush. It seems that the DIR variable doesn't point to the right directory.
It should point to '/vendor/drush/drush/includes/' (that's where the preflight.inc is) instead of '/vendor/bin/includes/'.

Here is the error I get:
Warning: require(/Users/xxx/xxx/drupal/vendor/bin/includes/preflight.inc): failed to open stream: No such file or directory in /Users/xxx/xxx/drupal/vendor/bin/drush.php on line 11

Fatal error: require(): Failed opening required '/Users/xxx/xxx/drupal/vendor/bin/includes/preflight.inc' (include_path='.:') in /Users/xxx/xxx/drupal/vendor/bin/drush.php on line 11

I hope someone can help me (I'm more a frontend- than a backend-dev).

Thanks in advance!

@webflo
Copy link
Member

webflo commented Jun 17, 2016

Can you share some information about your environment? What is your drush and php version? Thanks!

@projekt8
Copy link
Author

I'm running drupal on MAMP with PHP 7.0 and drush version 8.1.2 and everything works fine except for drush (have not tried drupal console yet). Thanks for the help!

@projekt8
Copy link
Author

I found out another thing that could help solve my issue. I hardcoded the right path to preflight.inc into drush.php and which drush tells me it is using a global drush (/usr/local/lib/drush/drush) instead of the local dependency drush.
But still don't know how I can fix that, unfortunately.

@webflo
Copy link
Member

webflo commented Jun 22, 2016

@projekt8 The global drush dispatches the command to the local drush automatically, just make sure that your global drush is up to date. The feature has been added a few months ago.

@projekt8
Copy link
Author

@webflo local and global drush have the same version (8.1.2) but auto dispatching doesnt seem to work

@kiss-mark
Copy link

kiss-mark commented Aug 1, 2016

Same happening for me. But the funny thing is, that I have a working copy with almost same file structure, and same files indeed, and one is working, another is not.

UPDATE:

My problem was, that I used a not-symlink friend copy mechanism, and the symlinks were replaced with the actual files. That's why the include command tried to load from the wrong directory.

@clwdesign
Copy link

Just in case anyone else lands here like I did, my error was a mistyped PATH (using XAMPP and Windows)

@orekerete
Copy link

orekerete commented Jan 10, 2017

Found this after searching for the same error message. The problem, and solution, lay in my environment setup as I am running a multi-site instance on a 1&1 shared Linux hosting package.

  1. Setup Drush using composer http://www.daveboulden.co.uk/index.php/2015/03/03/installing-drush-7-on-11-unlimited-shared-hosting/

  2. My .profile contains the following:
    export PATH="~/.composer/vendor/bin:$PATH"
    alias composer='/usr/bin/php5.5-cli ~/composer/composer.phar'
    alias drush='/usr/bin/php5.5 ~/.composer/vendor/drush/drush/drush.php --php=/usr/bin/php5.5'
    export DRUSH_PHP='/usr/bin/php5.5-cli'
    export COLUMNS

  3. Due to my multi-site setup I need to execute Drush inside my Drupal root folder using the --uri argument for each site.

Hope this helps others

@arh1
Copy link

arh1 commented Mar 15, 2017

If you come across this problem (or a similar message about startup.inc, or drupal.php when attempting to run Drupal Console), be sure the contents of vendor/bin are actually symlinks.

Moving a project to a new laptop, the actual PHP scripts were copied to vendor/bin rather than the symlinks, which caused this error for me (the include paths in the scripts are no longer valid in that case). The following steps resolved the issue for me:

$ rm vendor/bin/*
$ composer install

@webflo webflo closed this as completed Jun 25, 2017
@f1rf1n
Copy link

f1rf1n commented Nov 26, 2017

My problem also was that the files instead of the symlinks were in the /vendor/bin directory. Running the script from the erronous /vendor/bin dir leads to mismatched directory structure.
Deleting the scripts and replacing the sylinks did the trick for me.

@cqbent
Copy link

cqbent commented Sep 12, 2018

Just to add my 2 cents: I had this very same issue because I ran "composer update" on my initial project instead of running "composer install". The update pulled in all the files into the bin directory but they were not symlinks. I followed Andy's steps and that fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants