README.md 6.02 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
**"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 Repositores
Diego Hernandes's avatar
Diego Hernandes committed
24

Diego Hernandes's avatar
Diego Hernandes committed
25
26
| Alpine Version  | PHP Version           | Status                              | Repository URL 
| -               | -                     | -                                   | -
Diego Hernandes's avatar
Diego Hernandes committed
27
28
29
30
| **`3.7`**       | **`7.2`** _(7.2.0)_   | supported until Alpine 3.9 release  | https://php.codecasts.rocks/v3.7/php-7.2
| **`3.7`**       | **`7.1`** _(7.1.12)_  | supported until Alpine 3.9 release  | https://php.codecasts.rocks/v3.7/php-7.1 
| **`3.6`**       | **`7.2`** _(7.2.0)_   | supported until Alpine 3.8 release  | https://php.codecasts.rocks/v3.6/php-7.2
| **`3.6`**       | **`7.1`** _(7.1.12)_  | supported until Alpine 3.8 release  | https://php.codecasts.rocks/v3.6/php-7.1
Diego Hernandes's avatar
Diego Hernandes committed
31

Diego Hernandes's avatar
Diego Hernandes committed
32
> 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
33

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

Fabio Vedovelli's avatar
Fabio Vedovelli committed
36
> 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
37

Diego Hernandes's avatar
Diego Hernandes committed
38
39
40
41
## Snippets

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

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

Diego Hernandes's avatar
Diego Hernandes committed
44
45
### Dockerfile

Diego Hernandes's avatar
Diego Hernandes committed
46
You may skil 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

```dockerfile
# change to Alpine 3.6 you like.
FROM alpine:3.7

# trust this project public key to trust the packages.
ADD https://php.codecasts.rocks/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub

## 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.
RUN echo "@php https://php.codecasts.rocks/v3.7/php-7.2" >> /etc/apk/repositories

# 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
65
66
67
RUN apk add --update php7@php
RUN apk add --update php7-mbstring@php
RUN apk add --update php7-you-extension-name-here@php
Diego Hernandes's avatar
Diego Hernandes committed
68
```
Diego Hernandes's avatar
Diego Hernandes committed
69

Diego Hernandes's avatar
Diego Hernandes committed
70
### Bash / Shell scripting
Diego Hernandes's avatar
Diego Hernandes committed
71

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

Diego Hernandes's avatar
Diego Hernandes committed
74

Diego Hernandes's avatar
Diego Hernandes committed
75
```bash
Diego Hernandes's avatar
Diego Hernandes committed
76
#!/usr/bin/env sh
77

Diego Hernandes's avatar
Diego Hernandes committed
78
79
# install curl and certificates to download the key
apk add --update curl ca-certificates
Diego Hernandes's avatar
Diego Hernandes committed
80

Diego Hernandes's avatar
Diego Hernandes committed
81
82
# download the repository public key
curl https://php.codecasts.rocks/php-alpine.rsa.pub -o /etc/apk/keys/php-alpine.rsa.pub
Diego Hernandes's avatar
Diego Hernandes committed
83

Diego Hernandes's avatar
Diego Hernandes committed
84
85
# add the repository for the php / alpine version corresponding
echo "@php https://php.codecasts.rocks/v3.7/php-7.2" >> /etc/apk/repositories
Diego Hernandes's avatar
Diego Hernandes committed
86

Diego Hernandes's avatar
Diego Hernandes committed
87
88
89
# install packages
# notice that @php is required so you don't end up with default outdated php packages from community repository.
apk add --update php7@php
Diego Hernandes's avatar
Diego Hernandes committed
90
apk add --update php7-redis@php
Diego Hernandes's avatar
Diego Hernandes committed
91
92
apk add --update php7-any-other-extension@php

Diego Hernandes's avatar
Diego Hernandes committed
93
94
```

95
96
97

## Available Packages

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

Diego Hernandes's avatar
Diego Hernandes committed
100
- **Core Packages (Provide Binaries or Modules)**
Diego Hernandes's avatar
Diego Hernandes committed
101
102

`php7` `php7-common` `php7-fpm` `php7-cgi` `php7-apache2`
103

Diego Hernandes's avatar
Diego Hernandes committed
104
- **Special Packages (Not needed at runtime)**
Diego Hernandes's avatar
Diego Hernandes committed
105
106

`php7-doc` `php7-dev`
107

Diego Hernandes's avatar
Diego Hernandes committed
108
109
110
111
112
113
114
- **PHP 7.2 only extensions**

`php7-sodium`

> `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
115
- **Core Extensions**
Diego Hernandes's avatar
Diego Hernandes committed
116

Diego Hernandes's avatar
Diego Hernandes committed
117

Diego Hernandes's avatar
Diego Hernandes committed
118
`php7-bcmath` `php7-bz2` `php7-calendar` `php7-ctype` `php7-curl` `php7-dba` 
Diego Hernandes's avatar
Diego Hernandes committed
119

Diego Hernandes's avatar
Diego Hernandes committed
120
`php7-dom` `php7-embed` `php7-enchant` `php7-exif` `php7-ftp` `php7-gd` 
Diego Hernandes's avatar
Diego Hernandes committed
121

Diego Hernandes's avatar
Diego Hernandes committed
122
`php7-gettext` `php7-gmp` `php7-iconv` `php7-imap` `php7-intl` `php7-json`
Diego Hernandes's avatar
Diego Hernandes committed
123

Diego Hernandes's avatar
Diego Hernandes committed
124
`php7-ldap` `php7-litespeed` `php7-mbstring` `php7-mcrypt` `php7-mysqli`
Diego Hernandes's avatar
Diego Hernandes committed
125

Diego Hernandes's avatar
Diego Hernandes committed
126
`php7-mysqlnd` `php7-odbc` `php7-opcache` `php7-openssl` `php7-pcntl`
Diego Hernandes's avatar
Diego Hernandes committed
127

Diego Hernandes's avatar
Diego Hernandes committed
128
`php7-pdo` `php7-pdo_dblib` `php7-pdo_mysql` `php7-pdo_pgsql` `php7-pdo_sqlite`
Diego Hernandes's avatar
Diego Hernandes committed
129

Diego Hernandes's avatar
Diego Hernandes committed
130
`php7-pear` `php7-pgsql` `php7-phar` `php7-phpdbg` `php7-posix` `php7-pspell`
Diego Hernandes's avatar
Diego Hernandes committed
131

Diego Hernandes's avatar
Diego Hernandes committed
132
`php7-session` `php7-shmop` `php7-snmp` `php7-soap` `php7-sockets` `php7-sqlite3`
Diego Hernandes's avatar
Diego Hernandes committed
133

Diego Hernandes's avatar
Diego Hernandes committed
134
`php7-sysvmsg` `php7-sysvsem` `php7-sysvshm` `php7-tidy` `php7-wddx` `php7-xml` 
Diego Hernandes's avatar
Diego Hernandes committed
135

Diego Hernandes's avatar
Diego Hernandes committed
136
`php7-xmlreader` `php7-xmlrpc` `php7-xsl` `php7-zip` `php7-zlib`
137
  
Diego Hernandes's avatar
Diego Hernandes committed
138
139
- **Additional Extensions**

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

Diego Hernandes's avatar
Diego Hernandes committed
142
| Extension | Package Name   | Current Version | Available on 7.2 | Available on 7.1 |
Diego Hernandes's avatar
Diego Hernandes committed
143
144
145
|-----------|----------------|-----------------|------------------|------------------|
| APCu      | php7-apcu      | 5.1.8           | Yes              | Yes              |
| Imagick   | php7-imagick   | 3.4.3           | Yes              | Yes              |
Diego Hernandes's avatar
Diego Hernandes committed
146
147
148
149
| libsodium | php7-libsodium | 1.0.7           | Yes              | Yes              |
| memcached | php7-memcached | 3.0.4           | Yes              | Yes              |
| MongoDB   | php7-mongodb   | 1.3.4           | Yes              | Yes              |
| Redis     | php7-redis     | 3.1.4           | Yes              | Yes              |
150
| SSH2      | php7-ssh2      | 1.1.2           | Yes              | Yes              |
Diego Hernandes's avatar
Diego Hernandes committed
151
152
153
| xDebug    | php7-xdebug    | 2.5.5           | `No`             | Yes              |

> **Notifice that xDebug is not yet compatible with PHP 7.2, so the exteion is not yet avaiable but the extension maintainers may release it on the next days**
154

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