php_build_ubuntu.sh
Automates building and installing PHP 8.x from source for independent developer testing on Ubuntu flavors, with optional MySQL/MariaDB support and Apache integration.
Development history and compatibility
The Git commit history documents the project's development and version-specific changes per Ubuntu release, Apache version, PHP version, and selected build options.
Important considerations
This script compiles PHP 8.x from source, builds common extensions such as
mbstring, GD, cURL, and LDAP, and configures MySQL or MariaDB support. It also
configures Apache integration and handles Ubuntu's update-alternatives paths.
Run it in a virtual machine or another non-production environment first,
particularly when testing PHP versions or configuration changes. Review the
script before running it and back up any existing configuration you need to
preserve.
Scope
This project is intended for local development and testing by independent developers. It is not a substitute for official security updates or a guarantee of production readiness. We can discuss CI/CD and automated testing separately, of course.
Author: Maulik Mistry
Please share support:
- Compile PHP 8.x from source with popular extensions
- Auto-detect MySQL vs. MariaDB
- Apache module configuration and
update-alternatives - Some error-handling and environment setup
-
Clone the repo:
git clone --recurse-submodules https://github.com/m1st0/php_ubuntu_build_script php_ubuntu_build_script cd php_ubuntu_build_scriptIf the project was already cloned without its submodules:
git submodule update --init --recursive
-
Make executable:
chmod +x php_build_ubuntu.sh
-
Run (may require sudo):
./php_build_ubuntu.sh
-
You may change the default version by obtaining tags from the php-src repository and updating the
PHP_VERSIONvariable accordingly.
This project is licensed under Apache License 2.0. See LICENSE.txt for full
details.