Created
April 28, 2021 22:43
-
-
Save matheusb-comp/045b1d4c8fdc6a161d5c7cd53d505ff3 to your computer and use it in GitHub Desktop.
PHP wrapper to load libreadline at runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# PHP installed in AWS EC2 using Amazon-Linux-Extras is compiled with: | |
# --without-readline --with-libedit | |
# | |
# However, for some reason, libedit doesn't accept UTF-8 input: | |
# https://github.com/bobthecow/psysh/issues/148 | |
# | |
# Instead of building PHP from the source code, apparently libreadline | |
# can just be preloaded when running PHP: | |
# https://stackoverflow.com/q/28003239/12869323#comment44417638_28003239 | |
# | |
# So the PHP executable can be renamed and wrapped by this script: | |
# $ sudo mv /usr/bin/php /usr/bin/php-bin | |
# $ sudo mv php-wrapper /usr/bin/php | |
# $ sudo chown root:root /usr/bin/php | |
# $ sudo chmod +x /usr/bin/php | |
export LD_PRELOAD=/usr/lib64/libreadline.so.6 | |
exec php-bin "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment