Last active
August 20, 2019 21:05
-
-
Save krakjoe/5044339 to your computer and use it in GitHub Desktop.
pthreads-helper to download/install php+pthreads isolated
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/bash | |
# This should be a path that the user executing the script can read and write | |
PHP_PATH=/opt/php-ts | |
# This should be a sensible version of PHP | |
PHP_VERSION=7.0.0 | |
# This should be a sensible mirror for your location | |
PHP_MIRROR=uk1.php.net | |
# This should be a released version of pthreads | |
PHP_PTHREADS=3.1.5 | |
# This should be set to 0 if you do not want to remove build directories | |
PHP_CLEAN=1 | |
# This should be adjusted when you have worked out how to replicate your setup | |
PHP_EXTRACONF=--disable-all | |
# This should be adjusted for the number of cores on your system | |
PHP_CORES=16 | |
# This should be set to 0 should you need to see build output | |
PHP_SILENT=1 | |
######################################################### | |
# STOP EDITING UNLESS YOU KNOW WHAT YOU ARE DOING | |
######################################################### | |
# Set root location | |
PHP_CONF_ROOT=$(realpath .) | |
# Clean previous build directory, if required | |
if [ $PHP_CLEAN -eq 1 ]; | |
then | |
rm -rf $PHP_CONF_ROOT/php-$PHP_VERSION | |
rm -rf $PHP_CONF_ROOT/php-$PHP_VERSION.tar.bz2 | |
rm -rf $PHP_CONF_ROOT/pthreads-$PHP_PTHREADS.tgz | |
fi | |
# Download PHP sources | |
echo "Downloading PHP $PHP_VERSION from $PHP_MIRROR ..." | |
[ -f $PHP_CONF_ROOT/php-$PHP_VERSION.tar.bz2 ] || | |
wget -q http://www.php.net/get/php-$PHP_VERSION.tar.bz2/from/$PHP_MIRROR/mirror -O $PHP_CONF_ROOT/php-$PHP_VERSION.tar.bz2 | |
if [ -f $PHP_CONF_ROOT/php-$PHP_VERSION.tar.bz2 ]; | |
then | |
# Unpack PHP | |
echo "Unpacking PHP $PHP_VERSION ..." | |
tar -xf $PHP_CONF_ROOT/php-$PHP_VERSION.tar.bz2 | |
if [ -d $PHP_CONF_ROOT/php-$PHP_VERSION ]; | |
then | |
# Download pthreads | |
echo "Downloading pthreads $PHP_PTHREADS ..." | |
wget -q http://pecl.php.net/get/pthreads-$PHP_PTHREADS.tgz -O $PHP_CONF_ROOT/pthreads-$PHP_PTHREADS.tgz | |
if [ -f $PHP_CONF_ROOT/pthreads-$PHP_PTHREADS.tgz ]; | |
then | |
# Unpack pthreads | |
echo "Unpacking pthreads $PHP_PTHREADS ..." | |
cd $PHP_CONF_ROOT/php-$PHP_VERSION/ext/ | |
tar -xf $PHP_CONF_ROOT/pthreads-$PHP_PTHREADS.tgz | |
mv $PHP_CONF_ROOT/php-$PHP_VERSION/ext/pthreads-$PHP_PTHREADS $PHP_CONF_ROOT/php-$PHP_VERSION/ext/pthreads | |
# Reconfigure sources | |
cd $PHP_CONF_ROOT/php-$PHP_VERSION | |
./buildconf --force && \ | |
./configure --prefix=$PHP_PATH \ | |
--enable-maintainer-zts \ | |
--with-config-file-path=$PHP_PATH \ | |
--with-config-file-scan-dir=$PHP_PATH/modules.d \ | |
--enable-pthreads $PHP_EXTRACONF | |
if [ $? -eq 0 ]; | |
then | |
if [ $PHP_SILENT -eq 1 ]; | |
then | |
echo "Building PHP $PHP_VERSION @ $PHP_PATH ..." | |
make -j$PHP_CORES -C $PHP_CONF_ROOT/php-$PHP_VERSION 2>&1 >/dev/null | |
else | |
make -j$PHP_CORES -C $PHP_CONF_ROOT/php-$PHP_VERSION | |
fi | |
if [ $? -eq 0 ]; | |
then | |
echo "Installing PHP $PHP_VERSION ..." | |
make -C $PHP_CONF_ROOT/php-$PHP_VERSION install | |
if [ $? -eq 0 ]; | |
then | |
echo "Success: PHP $PHP_VERSION installed with pthreads support @ $PHP_PATH/bin/php" | |
$PHP_PATH/bin/php -m | |
exit 0 | |
fi | |
else | |
echo "Error: failed to build PHP" | |
exit 4 | |
fi | |
else | |
echo "Error: failed to configure PHP" | |
exit 3 | |
fi | |
else | |
echo "Error: failed to download pthreads sources" | |
exit 2 | |
fi | |
else | |
echo "Error: failed to unpack PHP sources" | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For resolve this warning, I was found a solution.
Generally, when I install curl with
yum install -y curl-devel
, See the curl installed without openssl:So I was try install it from source:
Now you can see, curl installed with openssl: (maybe needed restart your console)
So current
pthreads-helper
script works well without any warning 😄