Instalar y gestionar PHP 7.4-8.4 en Ubuntu con Apache

Guía para instalar y gestionar múltiples versiones de PHP (7.4–8.4) en Ubuntu con Apache y PHP-FPM y cómo Q2BSTUDIO integra estas plataformas en apps a medida, inteligencia artificial, ciberseguridad y despliegues en AWS/Azure.

18 sept 2025 • 3 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Este artículo explica cómo instalar y gestionar múltiples versiones de PHP 7.4 a 8.4 en Ubuntu con Apache y PHP-FPM, y cómo Q2BSTUDIO puede ayudarte a integrar estas plataformas en proyectos de aplicaciones a medida y software a medida. Q2BSTUDIO es una empresa de desarrollo de software especializada en aplicaciones a medida, inteligencia artificial, ciberseguridad y servicios cloud. Si te interesa desarrollar una solución personalizada podemos ayudarte con desarrollo de aplicaciones multiplataforma y arquitecturas seguras. También ofrecemos despliegues y migraciones en la nube con servicios cloud AWS y Azure a través de nuestros servicios cloud.

1) Añadir el PPA de PHP. Ejecuta: sudo apt update; sudo apt install -y software-properties-common ca-certificates lsb-release apt-transport-https; sudo add-apt-repository -y ppa:ondrej/php; sudo apt update

2) Instalar versiones de PHP. PHP 7.4: sudo apt install -y php7.4 php7.4-cli php7.4-fpm. PHP 8.0: sudo apt install -y php8.0 php8.0-cli php8.0-fpm. PHP 8.1: sudo apt install -y php8.1 php8.1-cli php8.1-fpm. PHP 8.2: sudo apt install -y php8.2 php8.2-cli php8.2-fpm. PHP 8.3: sudo apt install -y php8.3 php8.3-cli php8.3-fpm. PHP 8.4: sudo apt install -y php8.4 php8.4-cli php8.4-fpm

3) Extensiones recomendadas. Sustituye X.X por la versión deseada 7.4, 8.0, 8.1, 8.2, 8.3 o 8.4: sudo apt install -y phpX.X-cli phpX.X-fpm phpX.X-mysql phpX.X-xml phpX.X-curl phpX.X-mbstring phpX.X-zip phpX.X-bcmath phpX.X-gd phpX.X-intl phpX.X-readline phpX.X-soap phpX.X-opcache phpX.X-dev phpX.X-imagick phpX.X-pgsql phpX.X-sqlite3. Estas cubren frameworks como Laravel o Symfony, CMS como WordPress o Drupal, y requisitos de APIs, procesado de imágenes y drivers de base de datos.

4) Comprobar instalaciones y servicios. php -v para la versión CLI actual. update-alternatives --list php para ver las alternativas. systemctl list-units | grep php para servicios PHP-FPM activos. php -m para módulos cargados.

5) Cambiar versión PHP para CLI. Interactivo: sudo update-alternatives --config php. Directo: sudo update-alternatives --set php /usr/bin/php8.3. Verificar con php -v.

6) Cambiar PHP para Apache usando PHP-FPM. Parar y activar servicios: sudo systemctl stop php7.4-fpm; sudo systemctl enable --now php8.3-fpm. Habilitar módulos y conf de Apache: sudo a2enmod proxy_fcgi setenvif; sudo a2enconf php8.3-fpm; sudo a2disconf php7.4-fpm; sudo systemctl reload apache2. Handler en VirtualHost o en configuración de sitio: FilesMatch \.php$ SetHandler proxy:unix:/run/php/php8.3-fpm.sock|fcgi://localhost/ . Reiniciar Apache: sudo systemctl restart apache2.

7) Probar PHP. Crear archivo /var/www/html/info.php con el contenido

Referencia rápida. Cambiar PHP CLI: sudo update-alternatives --config php. Cambiar PHP Apache-FPM: sudo systemctl stop php8.0-fpm; sudo systemctl start php8.2-fpm; sudo a2enconf php8.2-fpm; sudo a2disconf php8.0-fpm; sudo systemctl reload apache2.

Consejos operativos y seguridad. Mantén actualizadas las versiones que usas en producción y solo habilita las extensiones necesarias para reducir la superficie de ataque. Para proyectos corporativos considera políticas de despliegue automatizado, monitorización y copias de seguridad en la nube con nuestras soluciones de servicios cloud AWS y Azure, y añade controles de seguridad proporcionados por los especialistas de Q2BSTUDIO en ciberseguridad para auditorías y pentesting. Además incorporamos capacidades de inteligencia de negocio y visualización con Power BI y soluciones de IA para empresas que optimizan rendimiento y detección de anomalías.

Por qué trabajar con Q2BSTUDIO. Ofrecemos integración completa desde la arquitectura backend con múltiples versiones de PHP y gestión de servidores hasta desarrollo frontend, automatización de procesos, agentes IA y consultoría en inteligencia artificial y business intelligence para transformar datos en valor. Si necesitas migrar aplicaciones legacy, desplegar microservicios o construir APIs escalables, nuestros equipos pueden diseñar la solución de software a medida que tu negocio requiere.

Palabras clave relevantes: aplicaciones a medida, software a medida, inteligencia artificial, ciberseguridad, servicios cloud aws y azure, servicios inteligencia de negocio, ia para empresas, agentes IA, power bi.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.

Live Chat