README.md 8.52 KB
Newer Older
Diego Hernandes's avatar
Diego Hernandes committed
1
# PHP Repositories for Alpine - by CODECASTS
Diego Hernandes's avatar
Diego Hernandes committed
2

Diego Hernandes's avatar
Diego Hernandes committed
3
**"Maybe Up-to-date, PHP packages for Alpine Linux."**
Diego Hernandes's avatar
Diego Hernandes committed
4

Diego Hernandes's avatar
Diego Hernandes committed
5
---
Diego Hernandes's avatar
Diego Hernandes committed
6

Diego Hernandes's avatar
Diego Hernandes committed
7
Maintained by **[@hernandev](https://github.com/hernandev)**. Based on **[Valery Kartel](https://github.com/vakartel)** scripts.
Diego Hernandes's avatar
Diego Hernandes committed
8
9

---
Diego Hernandes's avatar
Diego Hernandes committed
10

Diego Hernandes's avatar
Diego Hernandes committed
11
This project provides a simple alternative for running updated PHP on Alpine Linux.
Diego Hernandes's avatar
Diego Hernandes committed
12

Diego Hernandes's avatar
Diego Hernandes committed
13
We pack and release PHP versions as soon they are available on http://php.net. (At least, we try to.)
Diego Hernandes's avatar
Diego Hernandes committed
14

Diego Hernandes's avatar
Diego Hernandes committed
15
Additionally, many PECL extensions are also available as packages as well.
Diego Hernandes's avatar
Diego Hernandes committed
16

Diego Hernandes's avatar
Diego Hernandes committed
17
---
Diego Hernandes's avatar
Diego Hernandes committed
18

Diego Hernandes's avatar
Diego Hernandes committed
19
## Release Cycle
Diego Hernandes's avatar
Diego Hernandes committed
20

Diego Hernandes's avatar
Diego Hernandes committed
21
For short, this project will support **2 minor version of both PHP and Alpine**  at time.
Diego Hernandes's avatar
Diego Hernandes committed
22

Diego Hernandes's avatar
Diego Hernandes committed
23
## Available Repositories
Diego Hernandes's avatar
Diego Hernandes committed
24

25
26
| Alpine Version  | PHP Version               | Status                                | Repository URL
| -               | -                         | -                                     | -
Diego Hernandes's avatar
Diego Hernandes committed
27
28
29
| **`3.9`**       | **`7.3`** / `7.3.2`       | supported until Alpine v3.11 release  | [https://dl.bintray.com/php-alpine/v3.9/php-7.3](https://dl.bintray.com/php-alpine/v3.9/php-7.3)
| **`3.8`**       | **`7.3`** / `7.3.2`       | supported until Alpine v3.10 release  | [https://dl.bintray.com/php-alpine/v3.8/php-7.3](https://dl.bintray.com/php-alpine/v3.8/php-7.3)
| **`3.8`**       | **`7.2`** / `7.2.15`      | supported until Alpine v3.10 release  | [https://dl.bintray.com/php-alpine/v3.8/php-7.2](https://dl.bintray.com/php-alpine/v3.8/php-7.2)
Diego Hernandes's avatar
Diego Hernandes committed
30

Diego Hernandes's avatar
readme    
Diego Hernandes committed
31
32
> Alpine v3.7 is now deprecated and removed from this documentation. Your scripts will not stop working since the files are still available but they will not be receiving new builds from now on.
> PHP 7.1.x is now deprecated and removed from this documentation. Your scripts will not stop working since the files are still available but they will not be receiving new builds from now on.
Diego Hernandes's avatar
Diego Hernandes committed
33
> PHP 7.0.x is now deprecated and removed from this documentation. Your scripts will not stop working since the files are still available but they will not be receiving new builds from now on.
Diego Hernandes's avatar
Diego Hernandes committed
34

Diego Hernandes's avatar
Diego Hernandes committed
35
---
Diego Hernandes's avatar
Diego Hernandes committed
36

Fabio Vedovelli's avatar
Fabio Vedovelli committed
37
> Each version is available on a separate repository, choose the one you want and follow the instructions below:
Diego Hernandes's avatar
Diego Hernandes committed
38

Diego Hernandes's avatar
Diego Hernandes committed
39
40
41
42
43
44
45
46
47
48
49
50
## Repository Conflicts

In some cases, the packages on the repositories may present conflicts with official packages.

To solve that, each page was aliases as `php-name`, without the `7` indicator.

Considering this, all installs are now encouraged to reference the virtual names when installing.

The examples on this documentation are now updated to reflect this decision.

The original names are kept, and it should not break working scripts.

Diego Hernandes's avatar
Diego Hernandes committed
51
52
53
54
55
56
57
58
59

## Base Images

If you want, you can use the base images as your starting point on this repository:

The available images are:

| Image Name           | Tag     | FROM Example                       | Description
| -                    | -       | -                                   | -
Diego Hernandes's avatar
Diego Hernandes committed
60
| codecasts/alpine-3.9 | php-7.3 | `FROM codecasts/alpine-3.9:php-7.3` | PHP 7.3 on Alpine v3.9
61
62
| codecasts/alpine-3.8 | php-7.3 | `FROM codecasts/alpine-3.8:php-7.3` | PHP 7.3 on Alpine v3.8
| codecasts/alpine-3.8 | php-7.2 | `FROM codecasts/alpine-3.8:php-7.2` | PHP 7.2 on Alpine v3.8
Diego Hernandes's avatar
Diego Hernandes committed
63

Diego Hernandes's avatar
Diego Hernandes committed
64
65
66
67
## Snippets

The following code snippets are intended for quick usage on either shell scripts or Dockerfile

Diego Hernandes's avatar
Diego Hernandes committed
68
69
> Notice that `main` and `community` official repositories must be enabled.

Diego Hernandes's avatar
Diego Hernandes committed
70
71
### Dockerfile

Diego Hernandes's avatar
Diego Hernandes committed
72
You may skip the ca-certificates part if you replace HTTPS by HTTP but you should not. PHP packages will eventually install ca-certificates anyway.
Diego Hernandes's avatar
Diego Hernandes committed
73
74

```dockerfile
75
# Versions 3.8 and 3.7 are current stable supported versions.
Diego Hernandes's avatar
Diego Hernandes committed
76
FROM alpine:3.9
Diego Hernandes's avatar
Diego Hernandes committed
77
78

# trust this project public key to trust the packages.
Diego Hernandes's avatar
Diego Hernandes committed
79
ADD https://dl.bintray.com/php-alpine/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub
Diego Hernandes's avatar
Diego Hernandes committed
80
81
82
83
84
85
86

## you may join the multiple run lines here to make it a single layer

# make sure you can use HTTPS
RUN apk --update add ca-certificates

# add the repository, make sure you replace the correct versions if you want.
Diego Hernandes's avatar
Diego Hernandes committed
87
RUN echo "@php https://dl.bintray.com/php-alpine/v3.9/php-7.3" >> /etc/apk/repositories
Diego Hernandes's avatar
Diego Hernandes committed
88
89
90

# install php and some extensions
# notice the @php is required to avoid getting default php packages from alpine instead.
Diego Hernandes's avatar
Diego Hernandes committed
91
92
93
RUN apk add --update php@php
RUN apk add --update php-mbstring@php
RUN apk add --update php-you-extension-name-here@php
Diego Hernandes's avatar
Diego Hernandes committed
94
```
Diego Hernandes's avatar
Diego Hernandes committed
95

Diego Hernandes's avatar
Diego Hernandes committed
96
### Bash / Shell scripting
Diego Hernandes's avatar
Diego Hernandes committed
97

Diego Hernandes's avatar
Diego Hernandes committed
98
> You may skip the ca-certificates part if you replace HTTPS by HTTP but you should not. PHP packages will eventually install ca-certificates anyway.
99

Diego Hernandes's avatar
Diego Hernandes committed
100

Diego Hernandes's avatar
Diego Hernandes committed
101
```bash
Diego Hernandes's avatar
Diego Hernandes committed
102
#!/usr/bin/env sh
103

Diego Hernandes's avatar
Diego Hernandes committed
104
105
# install curl and certificates to download the key
apk add --update curl ca-certificates
Diego Hernandes's avatar
Diego Hernandes committed
106

Diego Hernandes's avatar
Diego Hernandes committed
107
# download the repository public key
Diego Hernandes's avatar
Diego Hernandes committed
108
curl https://dl.bintray.com/php-alpine/key/php-alpine.rsa.pub -o /etc/apk/keys/php-alpine.rsa.pub
Diego Hernandes's avatar
Diego Hernandes committed
109

Diego Hernandes's avatar
Diego Hernandes committed
110
# add the repository for the php / alpine version corresponding
Diego Hernandes's avatar
Diego Hernandes committed
111
echo "@php https://dl.bintray.com/php-alpine/v3.9/php-7.3" >> /etc/apk/repositories
Diego Hernandes's avatar
Diego Hernandes committed
112

Diego Hernandes's avatar
Diego Hernandes committed
113
114
# install packages
# notice that @php is required so you don't end up with default outdated php packages from community repository.
Diego Hernandes's avatar
Diego Hernandes committed
115
116
117
apk add --update php@php
apk add --update php-redis@php
apk add --update php-any-other-extension@php
Diego Hernandes's avatar
Diego Hernandes committed
118

Diego Hernandes's avatar
Diego Hernandes committed
119
120
```

121
122
123

## Available Packages

Diego Hernandes's avatar
Diego Hernandes committed
124
The following packages are available for installation on both 7.2 and 7.1 repositories:
125

Diego Hernandes's avatar
Diego Hernandes committed
126
127
128
129
130
131
- **[NEW]** **Backported Packages**

`argon2` `argon2-dev` `libargon2`

Argon2 was backported from EDGE branch of `ports` to allow PHP to be compiled with Argon2 password hashing support.

Diego Hernandes's avatar
Diego Hernandes committed
132
- **Core Packages (Provide Binaries or Modules)**
Diego Hernandes's avatar
Diego Hernandes committed
133

Diego Hernandes's avatar
Diego Hernandes committed
134
`php` `php-common` `php-fpm` `php-cgi` `php-apache2`
135

Diego Hernandes's avatar
Diego Hernandes committed
136
- **Special Packages (Not needed at runtime)**
Diego Hernandes's avatar
Diego Hernandes committed
137

Diego Hernandes's avatar
Diego Hernandes committed
138
`php-doc` `php-dev`
139

Diego Hernandes's avatar
Diego Hernandes committed
140
141
- **PHP 7.2 only extensions**

Diego Hernandes's avatar
Diego Hernandes committed
142
`php-sodium`
Diego Hernandes's avatar
Diego Hernandes committed
143
144
145
146

> `libsodium` extension is now part of PHP 7.2, it got renamed to `sodium` only and it reflects the version 2 of the extension.
> The original extension, at version 1 was kept built for PHP 7.2 for legacy purposes, be sure to not install the two extensions together and hope it will work (it actually may but I don't adivise you to try). 

Diego Hernandes's avatar
Diego Hernandes committed
147
- **Core Extensions**
Diego Hernandes's avatar
Diego Hernandes committed
148

Diego Hernandes's avatar
Diego Hernandes committed
149

Diego Hernandes's avatar
Diego Hernandes committed
150
`php-bcmath` `php-bz2` `php-calendar` `php-ctype` `php-curl` `php-dba` 
Diego Hernandes's avatar
Diego Hernandes committed
151

Diego Hernandes's avatar
Diego Hernandes committed
152
`php-dom` `php-embed` `php-enchant` `php-exif` `php-ftp` `php-gd` 
Diego Hernandes's avatar
Diego Hernandes committed
153

Diego Hernandes's avatar
Diego Hernandes committed
154
`php-gettext` `php-gmp` `php-iconv` `php-imap` `php-intl` `php-json`
Diego Hernandes's avatar
Diego Hernandes committed
155

Diego Hernandes's avatar
Diego Hernandes committed
156
`php-ldap` `php-litespeed` `php-mbstring` `php-mcrypt` `php-mysqli`
Diego Hernandes's avatar
Diego Hernandes committed
157

Diego Hernandes's avatar
Diego Hernandes committed
158
`php-mysqlnd` `php-odbc` `php-opcache` `php-openssl` `php-pcntl`
Diego Hernandes's avatar
Diego Hernandes committed
159

Diego Hernandes's avatar
Diego Hernandes committed
160
`php-pdo` `php-pdo_dblib` `php-pdo_mysql` `php-pdo_pgsql` `php-pdo_sqlite`
Diego Hernandes's avatar
Diego Hernandes committed
161

Diego Hernandes's avatar
Diego Hernandes committed
162
`php-pear` `php-pgsql` `php-phar` `php-phpdbg` `php-posix` `php-pspell`
Diego Hernandes's avatar
Diego Hernandes committed
163

Diego Hernandes's avatar
Diego Hernandes committed
164
`php-session` `php-shmop` `php-snmp` `php-soap` `php-sockets` `php-sqlite3`
Diego Hernandes's avatar
Diego Hernandes committed
165

Diego Hernandes's avatar
Diego Hernandes committed
166
`php-sysvmsg` `php-sysvsem` `php-sysvshm` `php-tidy` `php-wddx` `php-xml` 
Diego Hernandes's avatar
Diego Hernandes committed
167

Diego Hernandes's avatar
Diego Hernandes committed
168
`php-xmlreader` `php-xmlrpc` `php-xsl` `php-zip` `php-zlib`
169
  
Diego Hernandes's avatar
Diego Hernandes committed
170

Diego Hernandes's avatar
Diego Hernandes committed
171
172
- **Additional Extensions**

Diego Hernandes's avatar
Diego Hernandes committed
173
Some additional PECL extensions are provided so you don't need to build them.
174

Diego Hernandes's avatar
Diego Hernandes committed
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
| Extension                | Package Name          | Available on 7.3 | Available on 7.2 |
|--------------------------|-----------------------|------------------|------------------|
| AMQP                     | php-amqp              | Yes              | Yes              |
| APCu                     | php-apcu              | Yes              | Yes              |
| Imagick                  | php-imagick           | Yes              | Yes              |
| libsodium _(legacy v1)_  | php-libsodium         | Yes              | Yes              |
| mailparse                | php-mailparse         | Yes              | Yes              |
| memcached                | php-memcached         | Yes              | Yes              |
| MongoDB                  | php-mongodb           | Yes              | Yes              |
| Redis                    | php-redis             | Yes              | Yes              |
| SSH2                     | php-ssh2              | Yes              | Yes              |
| xDebug                   | php-xdebug            | Yes              | Yes              |
| secp256k1                | php-secp256k1         | Yes              | Yes              |
| ast                      | php-ast               | Yes              | Yes              |
| ds                       | php-ds                | Yes              | Yes              |
| MsgPack                  | php-msgpack           | Yes              | Yes              |
| Phalcon                  | php-phalcon           | Yes              | Yes              |
| PSR                      | php-psr               | Yes              | Yes              |
| scalar_objects           | php-scalar_objects    | Yes              | Yes              |
| swoole                   | php-swoole            | Yes              | Yes              |
| timecop                  | php-timecop           | Yes              | Yes              |

197

Diego Hernandes's avatar
Diego Hernandes committed
198
## Enjoy Life