drupal-composer / preserve-paths

A composer plugin for keeping specified files and directories when installing/updating new composer packages. Can be used to supported nested packages.
28 stars 28 forks source link

Drush 8 and multiple versions of PHP, can't update Drupal 7 websites #31

Closed mataski closed 4 years ago

mataski commented 4 years ago

I ran into a problem on shared hosting server (which means limited privileges like e.g. can't restart MySQL as suggested on some previous issues).

The hosting is forcing php 7.4 by default, while 7.2 is still available.

Can't upgrade Drupal 7 websites with Drush 8 and PHP 7.4 or even run simple drush status it gives:

"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? userprotect.module:627                                                                           [warning]
"continue 2" targeting switch is equivalent to "break 2". Did you mean to use "continue 3"? userprotect.module:647                                                                       [warning]
Deprecated function: Array and string offset access syntax with curly braces is deprecated in include_once() (line 20 of /users/webesite.com/htdocs/includes/file.phar.inc).          [error]

But if you do whereis php you get:

php: /usr/bin/php7.0 /usr/bin/php7.3 /usr/bin/php /usr/bin/php7.2 /usr/bin/php5.6 /usr/bin/php7.4 /usr/lib/php /etc/php /usr/include/php /usr/share/php7.3-json /usr/share/php5.6-sybase /usr/share/php7.4-pspell /usr/share/php7.0-mbstring /usr/share/php7.2-gd /usr/share/php7.3-soap /usr/share/php7.4-sqlite3 /usr/share/php7.4-soap /usr/share/php7.3-mysql /usr/share/php7.0-sqlite3 /usr/share/php7.0-soap /usr/share/php5.6-bcmath /usr/share/php7.1-xml /usr/share/php7.2-sybase /usr/share/php7.0-imap /usr/share/php7.4-gd /usr/share/php5.6-xmlrpc /usr/share/php7.2-soap /usr/share/php7.4-mbstring /usr/share/php7.0-readline /usr/share/php5.6-zip /usr/share/php5.6-intl /usr/share/php7.1-common /usr/share/php7.3-gd /usr/share/php7.4-bcmath /usr/share/php5.6-soap /usr/share/php7.3-common /usr/share/php5.6-mcrypt /usr/share/php7.0-sybase /usr/share/php7.2-xmlrpc /usr/share/php7.4-xml /usr/share/php7.2-json /usr/share/php7.0-mysql /usr/share/php5.6-gd /usr/share/php7.2-imap /usr/share/php7.4-common /usr/share/php7.2-mbstring /usr/share/php7.2-common /usr/share/php /usr/share/php7.3-xmlrpc /usr/share/php7.2-pspell /usr/share/php7.3-zip /usr/share/php7.0-intl /usr/share/php7.3-mbstring /usr/share/php7.3-readline /usr/share/php7.2-opcache /usr/share/php5.6-opcache /usr/share/php7.3-opcache /usr/share/php7.0-common /usr/share/php5.6-common /usr/share/php7.4-imap /usr/share/php7.0-gd /usr/share/php7.2-mysql /usr/share/php7.4-mysql /usr/share/php5.6-sqlite3 /usr/share/php7.0-mcrypt /usr/share/php7.2-intl /usr/share/php7.3-xml /usr/share/php7.4-curl /usr/share/php7.0-zip /usr/share/php5.6-mysql /usr/share/php7.4-opcache /usr/share/php5.6-mbstring /usr/share/php7.3-bcmath /usr/share/php7.4-json /usr/share/php7.4-xmlrpc /usr/share/php7.2-bcmath /usr/share/php7.4-intl /usr/share/php7.2-xml /usr/share/php7.0-pspell /usr/share/php7.0-opcache /usr/share/php7.4-sybase /usr/share/php7.2-sqlite3 /usr/share/php5.6-curl /usr/share/php7.0-json /usr/share/php5.6-pspell /usr/share/php7.2-zip /usr/share/php7.3-pspell /usr/share/php7.0-xmlrpc /usr/share/php7.2-curl /usr/share/php7.3-sybase /usr/share/php5.6-imap /usr/share/php7.3-intl /usr/share/php5.6-json /usr/share/php7.4-zip /usr/share/php7.0-xml /usr/share/php7.0-bcmath /usr/share/php7.3-imap /usr/share/php7.3-sqlite3 /usr/share/php7.2-readline /usr/share/php7.0-curl /usr/share/php7.3-curl /usr/share/php5.6-xml /usr/share/php5.6-readline /usr/share/php7.4-readline /usr/share/man/man1/php.1.gz

And as you can see we still have /usr/bin/php7.2, so if we make an alias or run something like this:

/usr/bin/php7.2 ~/composer/vendor/drush/drush/drush.php status we get working Drush

Drupal version                  :  7.67
 Site URI                        :  http://default
 Database driver                 :  mysql
 Database hostname               :  localhost
 Database port                   :
 Database username               :  asd
 Database name                   :  asd
 Database                        :  Connected
 Drupal bootstrap                :  Successful
 Drupal user                     :
 Default theme                   :  asd
 Administration theme            :  adminimal
 PHP configuration               :  /etc/php/7.2/cli/php.ini
 PHP OS                          :  Linux
 Drush script                    :  /users/asd.com/composer/vendor/drush/drush/drush.php
 Drush version                   :  8.1.12
 Drush temp directory            :  /tmp
 Drush configuration             :
 Drush alias files               :
 Install profile                 :  standard
 Drupal root                     :  /users/asd.com/htdocs
 Drupal Settings File            :  sites/default/settings.php
 Site path                       :  sites/default
 File directory path             :  sites/default/files
 Private file directory path     :  sites/default/files/prv
 Temporary file directory path   :  ../tmp

But if we run same command to update the website /usr/bin/php7.2 ~/composer/vendor/drush/drush/drush.php pm-update we get error pm-updatestatus failed.

mataski commented 4 years ago

wrong repo