This is a script I use download the PHP source code. Since I compile my 3 PHP version from source, it’s nice to have a script to download the source files. I updated the script recently, and noticed I haven’t posted it here either. So here it is…
php-dl
When you’ve made your changes (see below), then just run it like:
$ php-dl 7.0.8
The script will download the archive: php-N.N.N.tar.xz
, and the signature: php-N.N.N.tar.xz.asc
, and then verify it in the end if you have gpg2
installed.
You’ll need wget
to download it. Otherwise - change it to curl
if you want or prefer that.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
You can also get the script on Github.
Edits
There are two edits to look after - the two first variables.
phpmirror
Go to the PHP download page and find a mirror and the link.
Example: Sweden
http://se2.php.net/get/php-7.0.8.tar.xz/from/this/mirror
Change $phpmirror
to match your mirror.
# Set your PHP mirror
phpmirror='se2';
phpfolder
Where on the computer to store… Change to match your setup.
phpfolder="$HOME/Downloads/Server/php";
Install it somewhere within PATH
. I keep mine in a custom folder I use for my own script: /usr/local/xbin
.
sudo install -v -m 0755 -o root -g wheel php-dl /usr/local/xbin
# verify
which php-dl
When downloading from time to time, you’ll eventually end up with a file/folder structure like this:
$HOME/Downloads/Server/php/
5.4/
5.4.45/
php-5.4.45_build/
php-5.4.45.tar.xz
php-5.4.45.tar.xz.asc
5.6/
5.6.22/
php-5.6.22_build/
php-5.6.22.tar.xz
php-5.6.22.tar.xz.asc
5.6.23/
php-5.6.23_build/
php-5.6.23.tar.xz
php-5.6.23.tar.xz.asc
7.0/
7.0.7/
php-7.0.7_build/
php-7.0.7.tar.xz
php-7.0.7.tar.xz.asc
7.0.8/
php-7.0.8_build/
php-7.0.8.tar.xz
php-7.0.8.tar.xz.asc
# etc...
If you don’t want the build folder, you can edit the script. That’s just how I use it, and where I compile it from later.
cd php-N.N.N_build/
../php-N.N.N/configure --with-foo …
Happy hacking…
/Eric