1

I have an internal Drupal 7 app. The app uses php exec() to execute Drush 8.x commands after certain files are uploaded to the server via a custom form. In order for it to work we downloaded drush.phar, moved it to /usr/local/bin/drush, chmod +x and gave ownership to www-data:www-data.

All of this was working fine. In order to accommodate some compatibility changes after we updated to php 7.4, I had to delete that version and download 8.3.3 where this compatibility issue is addressed.

Then, I started getting the errors:

Fatal error: Uncaught TYPO3\PharStreamWrapper\Exception: Unexpected file extension in "phar:///usr/local/bin/drush/commands/core/drupal" in /var/www/html/misc/typo3/drupal-security/PharExtensionInterceptor.php:38

This seems to be a well-known issue for which there is no well-known solution. Now, it does not matter if I download 8, 8.1.18, 8.4.8 - I get this error no matter what. I can't even rollback to a previous version.

But, if I download Drush via Composer and make it globally available, I do not get the errors.

The problem is, that script is run by the apache process www-data. www-data cannot access the composer-managed drush version. I tried to provide a symbolic link to the composer file like this:

ln -s /root/.composer/vendor/bin/drush /usr/local/bin/drush

But that doesn't work - command not found.

How can I setup composer-installed Drush so that it's available to the web server process, www-data?

1
  • note: if anyone has any insight as to the TYPO3 error, let me know. I'll open another question or please provide feedback on D.O via that link.
    – blue928
    Jun 3 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.