Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 3d51e5a

Browse files
author
Antonios Papadakis
committed
Add multi-version PHP CLI Install Capability
macOS, REMOVED PHP latest-5.6, latest-7.0 due to incompatibility
1 parent 51999c6 commit 3d51e5a

File tree

2 files changed

+100
-13
lines changed

2 files changed

+100
-13
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
# EZCompile-PHP
2-
The EZ way to compile and install PHP on MacOS, Windows, and Linux. Status: pre-release, HEAVY DEVELOPMENT
3-
---
2+
## The EZ way to compile and install PHP on MacOS, Windows, and Linux. Status: pre-release, HEAVY DEVELOPMENT
43
Install Guide Coming Soon
4+
5+
# PLEASE NOTE:
6+
### 1. Some PHP extensions may not be installed in all versions due to incompatibility or build errors. The PHP extensions that were removed from PHP 8 downwards are the following:
7+
* latest-7.4: ***enchant***
8+
* latest-7.3: ***enchant, iconv, TIDY***
9+
* latest-7.2: ***enchant, iconv, TIDY, GD, webp support, jpeg support, freetype, zip read/write support***
10+
* latest-7.1: ***enchant, iconv, TIDY, Argon2 Password Hashing, GD, webp support, jpeg support, freetype, sodium, zip read/write support***
11+
* latest-7.0: ***enchant, iconv, TIDY, Argon2 Password Hashing, GD, webp support, jpeg support, freetype, sodium, zip read/write support***
12+
* latest-5.6: ***enchant, iconv, TIDY, Argon2 Password Hashing, GD, webp support, jpeg support, freetype, sodium, zip read/write support***
13+
---
14+
#### Psst...Disclaimer:
15+
16+
This product includes PHP software, freely available from <http://www.php.net/software/>

macos/install.sh

Lines changed: 86 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,87 @@
11
#!/bin/bash
2-
git checkout php-src
32

43
function compilePHP {
54
# Install All Dependencies
5+
read -p 'Which PHP version would you like to install?[latest-7.1/latest-7.2/latest-7.3/latest-7.4/latest-8.0/latest-master] ' PHPINSTALLVERSION
6+
7+
if [ "$PHPINSTALLVERSION" = latest-7.1 ]; then
8+
cd ../releases/ || exit
9+
unzip php-src-php-7.1.32.zip -d latest-7.1
10+
cd latest-7.1 || exit
11+
elif [ "$PHPINSTALLVERSION" = latest-7.2 ]; then
12+
cd ../releases/ || exit
13+
unzip php-src-php-7.2.33.zip -d latest-7.2
14+
cd latest-7.2 || exit
15+
elif [ "$PHPINSTALLVERSION" = latest-7.3 ]; then
16+
cd ../releases/ || exit
17+
unzip php-src-php-7.3.22RC1.zip -d latest-7.3
18+
cd latest-7.3 || exit
19+
elif [ "$PHPINSTALLVERSION" = latest-7.4 ]; then
20+
cd ../releases/ || exit
21+
unzip php-src-php-7.4.10RC1.zip -d latest-7.4
22+
cd latest-7.4 || exit
23+
elif [ "$PHPINSTALLVERSION" = latest-8.0 ]; then
24+
read -p 'This a BETA PHP version. This software has been tested, but bugs and errors are bound to appear in this early stage. This should not be used in a production environment. Are you sure you want to install?[y/Y/n/N] ' INSTALLCHOICE
25+
if [ "$INSTALLCHOICE" = y ] || [ "$INSTALLCHOICE" = Y ]; then
26+
cd ../releases/ || exit
27+
unzip php-src-php-8.0.0beta2.zip -d latest-8.0
28+
cd latest-8.0 || exit
29+
elif [ "$INSTALLCHOICE" = n ] || [ "$INSTALLCHOICE" = N ]; then
30+
echo cancelling installation
31+
exit 130
32+
else
33+
echo invalid argument, exiting...
34+
exit 1
35+
fi
36+
elif [ "$PHPINSTALLVERSION" = latest-master ]; then
37+
read -p 'CAREFUL: This is a pre-release version and is in heavy development. Install this only if you want the latest bleeding-edge features. These may not have been tested thoroughly and should not be used in a production environment. Are you sure you want to install?[y/Y/n/N] ' INSTALLCHOICE
38+
if [ "$INSTALLCHOICE" = y ] || [ "$INSTALLCHOICE" = Y ]; then
39+
git checkout php-src
40+
elif [ "$INSTALLCHOICE" = n ] || [ "$INSTALLCHOICE" = N ]; then
41+
echo cancelling installation
42+
exit 130
43+
else
44+
echo invalid argument, exiting...
45+
exit 1
46+
fi
47+
fi
48+
649
echo Installing Dependencies
750
brew install flex autoconf automake libtool re2c bison openssl curl enchant gd freetype mhash libiconv libsodium libjpeg pcre libxml2 argon2 tidy-html5 libzip
851
# Export Packages to the $PATH so They can be Found by the System
9-
sudo echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> /Users/antonios/.bash_profile
10-
sudo source /Users/antonios/.bash_profile
52+
sudo echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
53+
source ~/.bash_profile
1154
echo Installed all Dependencies
1255
# Build the Configure Script
1356
echo Building configuration script
14-
cd ..
15-
sudo ./buildconf
57+
58+
if [ "$PHPINSTALLVERSION" = latest-7.1 ]; then
59+
cd php-src-php-7.1.32/ || exit
60+
elif [ "$PHPINSTALLVERSION" = latest-7.2 ]; then
61+
cd php-src-php-7.2.33/ || exit
62+
elif [ "$PHPINSTALLVERSION" = latest-7.3 ]; then
63+
cd php-src-php-7.3.22RC1/ || exit
64+
elif [ "$PHPINSTALLVERSION" = latest-7.4 ]; then
65+
cd php-src-php-7.4.10RC1/ || exit
66+
elif [ "$PHPINSTALLVERSION" = latest-8.0 ]; then
67+
cd php-src-php-8.0.0beta2/ || exit
68+
fi
69+
70+
sudo ./buildconf --force || exit
1671
echo Built Configuration Script
1772
# Configure PHP Installation
1873
echo Configuring PHP
19-
sudo ./configure --with-openssl --enable-bcmath --enable-calendar --with-curl --with-enchant --enable-ftp --enable-gd --with-webp --with-jpeg --with-freetype --with-mhash --with-iconv=/usr/local/Cellar/libiconv/1.16 --with-imap-ssl --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --enable-shmop --enable-soap --enable-sockets --with-sodium --with-password-argon2 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-zip
74+
if [ "$PHPINSTALLVERSION" = latest-8.0 ] || [ "$PHPINSTALLVERSION" = latest-master ]; then
75+
sudo ./configure --with-openssl --enable-bcmath --enable-calendar --with-curl --with-enchant --enable-ftp --enable-gd --with-webp --with-jpeg --with-freetype --with-mhash --with-iconv=/usr/local/Cellar/libiconv/1.16 --with-imap-ssl --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --enable-shmop --enable-soap --enable-sockets --with-sodium --with-password-argon2 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-zip || exit
76+
elif [ "$PHPINSTALLVERSION" = latest-7.4 ]; then
77+
sudo ./configure --with-openssl --enable-bcmath --enable-calendar --with-curl --enable-ftp --enable-gd --with-webp --with-jpeg --with-freetype --with-mhash --with-iconv=/usr/local/Cellar/libiconv/1.16 --with-imap-ssl --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --enable-shmop --enable-soap --enable-sockets --with-sodium --with-password-argon2 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-zip || exit
78+
elif [ "$PHPINSTALLVERSION" = latest-7.3 ]; then
79+
sudo ./configure --with-openssl --enable-bcmath --enable-calendar --with-curl --enable-ftp --enable-gd --with-webp --with-jpeg --with-freetype --with-mhash --without-iconv --with-imap-ssl --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --enable-shmop --enable-soap --enable-sockets --with-sodium --with-password-argon2 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-zip || exit
80+
elif [ "$PHPINSTALLVERSION" = latest-7.2 ]; then
81+
sudo ./configure --with-openssl --enable-bcmath --enable-calendar --with-curl --enable-ftp --with-mhash --without-iconv --with-imap-ssl --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --enable-shmop --enable-soap --enable-sockets --with-sodium --with-password-argon2 --enable-sysvmsg --enable-sysvsem --enable-sysvshm || exit
82+
elif [ "$PHPINSTALLVERSION" = latest-7.1 ]; then
83+
sudo ./configure --with-openssl --enable-bcmath --enable-calendar --with-curl --enable-ftp --with-mhash --without-iconv --with-imap-ssl --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm || exit
84+
fi
2085
echo Configured PHP
2186
# Set the Job Count for make
2287
echo Setting job count for make
@@ -25,16 +90,26 @@ function compilePHP {
2590
echo Set job count for make
2691
# Build PHP
2792
echo Building PHP
28-
sudo make -j"$JOBCOUNT"
93+
sudo make -j"$JOBCOUNT" || exit
2994
echo Built PHP
95+
3096
# Test PHP Commands and Test for Bugs
3197
echo Testing PHP
32-
sudo make TEST_PHP_ARGS=-j"$JOBCOUNT" test
98+
if [ "$PHPINSTALLVERSION" = latest-8.0 ] || [ "$PHPINSTALLVERSION" = latest-master ] || [ "$PHPINSTALLVERSION" = latest-7.4 ]; then
99+
sudo make TEST_PHP_ARGS=-j"$JOBCOUNT" test
100+
elif [ "$PHPINSTALLVERSION" = latest-7.3 ]; then
101+
sudo make test -j"$JOBCOUNT"
102+
elif [ "$PHPINSTALLVERSION" = latest-7.2 ]; then
103+
sudo make test -j"$JOBCOUNT"
104+
elif [ "$PHPINSTALLVERSION" = latest-7.1 ]; then
105+
sudo make test -j"$JOBCOUNT"
106+
fi
107+
33108
echo Tested PHP
34109
read -p 'The tests have been completed and you may or may not have had failures on some of them. This can sometimes be ignored with the latest builds, or may need extra attention. Would you like to continue with installation?[y/Y/n/N] ' ERRORRESPONSE
35110
if [ "$ERRORRESPONSE" = y ] || [ "$ERRORRESPONSE" = Y ]; then
36111
echo Installing PHP-CLI
37-
sudo make install
112+
sudo make install || exit
38113
echo Installed PHP-CLI
39114
git checkout master
40115
exit 0
@@ -45,8 +120,8 @@ function compilePHP {
45120
fi
46121
}
47122

48-
brew help
49-
BREWCHECK=$(echo $?)
123+
brew help
124+
BREWCHECK=$(echo $?)
50125

51126
if [ "$BREWCHECK" = 0 ]; then
52127
compilePHP

0 commit comments

Comments
 (0)