Instalar PHP5 en Debian 9 Stretch
por leninmhs · Publicada · Actualizado
En esta entrada veremos como instalar PHP5 en Debian GNU / Linux 9 Stretch. El
nuevo Debian Stretch trae por defecto solo el nuevo PHP7 pero muchas de las aplicaciones
escritas en PHP deben ser bien probadas y ajustadas para la nueva versión de PHP.
Lo que haremos para lograr instalar PHP5 en Debian Stretch es agregar el repositorio de
Debian Jessie con lo cual tendremos PHP5 y todas sus extensiones a las que seguramente
estas acostumbrado si estas leyendo esta entrada.
Instalar PHP5 en Debian Stretch
• Editar el archivo /etc/apt/sources.list y agregar el repositorio de jessie al final del
archivo como muestro a continuación:
# Repositorios de Jessie
deb http://ftp.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.debian.org/debian/ jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free
deb http://archive.debian.org/debian/ jessie contrib main
non-free
deb http://archive.debian.org/debian/ stretch contrib main
non-free
Guardamos los cambios.
• Ajustaremos las preferencias de nuestros repositorios para que nuestro sistema sepa
como comportarse teniendo dos repositorios de Debian distintos. Para ello crearemos
el archivo /etc/apt/preferences.d/jessie y en el agregaremos lo siguiente:
Package: *
Pin: release n=stretch
Pin-Priority: 900
Package: *
Pin: release n=jessie
Pin-Priority: 100
Guardamos los cambios.
• Actualizamos nuestros repositorios ejecutando como root: apt update
• Ahora podremos buscar e instalar nuestros paquetes de php5
apt install php5 php5-pgsql php5-gd php5-curl php5-cli apache2
Con esto ya tenemos PHP5 en nuestro sistema.
PHP5 Debian Stretch 9 Linux php7 PHP5 Debian 9 Stretch
En las preferences indicamos que se le diera mayor preferencia a los paquetes de Debian
Stretch, pero cuando instalemos un paquete que no existe en stretch lo buscara e instalara de
Jessie. Podremos también indicar un paquete desde donde ser instalado con el siguiente
método:
apt install-t stretch apache2
PHP5 Debian 9 Stretch
Disfruten su PHP5 pero no por mucho tiempo por que ya comienza a desaparecer, Ubuntu
lo removió hace un año, igual ya en Debian Stretch y demás distribuciones de Linux, la
recomendación comenzar a probar y adaptar sus aplicaciones para PHP7.
deb http://ftp.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.debian.org/debian/ jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free