logo

Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Drush toont foutmelding: Ondersteun bash om 'source' te gebruiken met terugval op $0 als dit niet met bash wordt uitgevoerd

02/09/2025, by Ivan

Ik heb een groot aantal configuraties en voer meestal config-import uit met php -d memory_limit=-1 (om het geheugenlimiet van PHP uit te schakelen):

php -d memory_limit=-1 ./vendor/bin/drush config-import -y

Maar deze keer kreeg ik een foutmelding:

# Ondersteun bash om ‘source’ te gebruiken met terugval op $0 als dit niet met bash wordt uitgevoerd
# https://stackoverflow.com/a/35006505/6512
selfArg="$BASH_SOURCE"
if [ -z "$selfArg" ]; then
    selfArg="$0"
fi

self=$(realpath $selfArg 2> /dev/null)
if [ -z "$self" ]; then
    self="$selfArg"
fi

dir=$(cd "${self%[/\\]*}" > /dev/null; cd ../drush/drush && pwd)

if [ -d /proc/cygdrive ]; then
    case $(which php) in
        $(readlink -n /proc/cygdrive)/*)
            # We draaien in Cygwin met Windows PHP, dus pad moet worden vertaald
            dir=$(cygpath -m "$dir");
            ;;
    esac
fi

export COMPOSER_RUNTIME_BIN_DIR="$(cd "${self%[/\\]*}" > /dev/null; pwd)"

# Als bash dit bestand aan het sourcen is, moet ook het doelbestand gesourced worden
bashSource="$BASH_SOURCE"
if [ -n "$bashSource" ]; then
    if [ "$bashSource" != "$0" ]; then
        source "${dir}/drush" "$@"
        return
    fi
fi

"${dir}/drush" "$@"

Je kunt deze fout vermijden door memory_limit=-1 mee te geven via --php-options:

./vendor/bin/drush --php-options='-d memory_limit=-1' config-import -y

Waarom php -d memory_limit=-1 vendor/bin/drush … nu crasht

Door het script via php uit te voeren, vertel je de PHP-interpreter om een bash-script te verwerken:

php -d memory_limit=-1 ./vendor/bin/drush status

PHP probeert dan de eerste niet-PHP-regel (# Ondersteun bash …) uit te voeren en faalt meteen, en toont de inhoud van de wrapper op het scherm. Dat is precies de uitvoer die je hierboven ziet. Deze verandering is geïntroduceerd in Drush 13.3 en wordt besproken in het upstream issue “Running drush as php script fails after updating from 13.2.0”.