Last active
May 18, 2023 16:13
-
-
Save jaywilliams/979039 to your computer and use it in GitHub Desktop.
Installing PHP 7.4.33 as CGI on *new* Pair Networks architecture
This file contains hidden or 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
# Installing PHP 7.4.33 as CGI/FastCGI on a Pair Networks VPS | |
# By Jay Williams <http://myd3.com/> | |
# Based off of the Pair Users wiki page "Installing PHP5 as cgi" <http://www.pairusers.com/?How%20to%20install%20PHP5> | |
# Note: Replace "USERNAME" with your actual server username | |
# Make src directory in home | |
mkdir ~/src | |
# Download, configure, and compile OpenSSL | |
cd ~/src | |
wget https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1t/openssl-1.1.1t.tar.gz | |
tar zxf openssl-1.1.1t.tar.gz | |
cd openssl-1.1.1t | |
./Configure --prefix=$HOME/bin -fPIC -shared linux-x86_64 | |
make -j 8 | |
make install | |
export PKG_CONFIG_PATH=/usr/home/USERNAME/bin/lib/pkgconfig | |
# Download, configure, and compile PHP | |
cd ~/src | |
wget https://www.php.net/distributions/php-7.4.33.tar.gz | |
tar zxf php-7.4.33.tar.gz | |
cd php-7.4.33 | |
# Make a directory to store our php ini file | |
mkdir -p ~/phpini/php74 | |
'./configure' '--with-config-file-path=/usr/home/USERNAME/phpini/php74' '--enable-debug=no' '--enable-fpm' '--with-openssl' '--with-openssl-dir=/usr/home/USERNAME/bin/include/openssl' '--with-zlib' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl' '--enable-dba' '--with-gdbm' '--with-db4' '--enable-exif' '--enable-gd' '--with-jpeg' '--with-freetype' '--with-gettext' '--with-gmp' '--enable-mbstring' '--with-mhash' '--with-mysqli=mysqlnd' '--with-iodbc' '--with-pdo-mysql=mysqlnd' '--with-pdo-sqlite=/usr' '--with-pdo-pgsql' '--with-pspell' '--with-xsl' '--with-zip' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--with-ldap' '--enable-ftp' '--enable-soap' '--with-pgsql' '--enable-sockets' '--with-tidy' '--with-xmlrpc' '--with-sodium' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-pcntl' '--with-webp' '--with-pear' '--enable-opcache' | |
# Build PHP | |
make | |
# Use the latest Pair Networks PHP 7.4 php.ini | |
cp /usr/local/etc/php74/php.ini ~/phpini/php74/php.ini | |
# Note: To enabled opcache you need to add the line: | |
# zend_extension=opcache.so | |
# Alternatively, you can use the php.ini that you downloaded | |
# cp php.ini-production ~/phpini/php74/php.ini | |
# Remove debug symbols from the binary | |
strip sapi/cgi/php-cgi | |
# Copy PHP to the domain specific mapped cgi-bin directory | |
cp sapi/cgi/php-cgi ~/public_html/cgi-bin/php74.cgi | |
strip sapi/cli/php | |
cp sapi/cli/php ~/bin/ | |
# Copy PHP to the domain specific mapped cgi-bin directory | |
cat << EOF > ~/public_html/cgi-bin/php74_wrapper.sh | |
#!/bin/sh | |
exec /usr/home/USERNAME/public_html/cgi-bin/php74.cgi | |
EOF | |
chmod 705 ~/public_html/cgi-bin/php74_wrapper.sh | |
# Remove built files | |
make clean | |
# Add this to your .htaccess file: | |
# Action application/x-httpd-php /cgi-bin/php74_wrapper.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script has been updated for PHP 7.4.30, on Pair's VPS service. If you want to see the old PHP 5.3 version, view the previous commit:
https://gist.github.com/jaywilliams/979039/d764b58fc842e1b0593749b1005fcef5c8ed2c1d