-
-
Save krakjoe/5044339 to your computer and use it in GitHub Desktop.
| #!/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 |
dadmin-admin
commented
Apr 15, 2017
Due the changes of PHP downloads page it makes a sense to replace this:
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
by this:
wget -q http://$PHP_MIRROR/get/php-$PHP_VERSION.tar.bz2/from/this/mirror -O $PHP_CONF_ROOT/php-$PHP_VERSION.tar.bz2
I get this warning message:
/root/pthreads/pthreads/php-7.0.0/ext/curl/interface.c:74:5: warning: #warning "libcurl was compiled with SSL support, but configure could not determine which" "library was used; thus no SSL crypto locking callbacks will be set, which may " "cause random crashes on SSL requests" [-Wcpp]
# warning
^
I get this warning message:
/root/pthreads/pthreads/php-7.0.0/ext/curl/interface.c:74:5: warning: #warning "libcurl was compiled with SSL support, but configure could not determine which" "library was used; thus no SSL crypto locking callbacks will be set, which may " "cause random crashes on SSL requests" [-Wcpp]
# warning
^
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:
# curl -V
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.36 zlib/1.2.7 libidn/1.28 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets
So I was try install it from source:
yum install -y openssl-devel
wget https://curl.haxx.se/download/curl-7.65.3.tar.gz
tar xvfz curl-7.65.3.tar.gz
cd curl-7.65.3
./configure --with-ssl
make
make install
Now you can see, curl installed with openssl: (maybe needed restart your console)
# curl -V
curl 7.65.3 (x86_64-pc-linux-gnu) libcurl/7.65.3 OpenSSL/1.0.2k-fips zlib/1.2.7
Release-Date: 2019-07-19
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets
So current pthreads-helper script works well without any warning 😄