Skip to content

Latest commit

 

History

History
77 lines (49 loc) · 2.12 KB

File metadata and controls

77 lines (49 loc) · 2.12 KB

PHP Build Script for Ubuntu

php_build_ubuntu.sh
Automates building and installing PHP 8.x from source for testing on Ubuntu flavors with optional MySQL/MariaDB support and Apache integration.


🚀 About

This script compiles PHP 8.x by version choice from source, installs common extensions (mbstring, GD, curl, LDAP, etc.), and sets up MySQL or MariaDB support. It also configures Apache integration and handles alternative PHP paths.

Author: Maulik Mistry (m1st0) (original Gist)


✅ Features

  • Compile PHP 8 from source with popular extensions
  • Auto-detect MySQL vs. MariaDB
  • Apache module configuration and update-alternatives
  • Error-handling and environment setup
  • Color-coded script output for clarity

🛠️ Usage

  1. Clone the repo:

    git clone --recurse-submodules https://github.com/yourusername/php-build-ubuntu.git php-build-ubuntu
    cd php-build-ubuntu

    If the project was already cloned without its submodules:

    git submodule update --init --recursive
    
  2. Make executable:

    chmod +x php_build_ubuntu.sh
  3. Run (may require sudo):

    sudo ./php_build_ubuntu.sh
  4. Follow the prompts to select PHP version (default is 8.4.9) and confirm compilation options.

  5. You may change the default version by obtaining tags from the php-src repository or by checking out a version tag inside the php-src folder that the script creates on first run, and updating the PHP_VERSION variable accordingly.


📄 License

This project is licensed under Apache License 2.0.
See LICENSE.txt for full details.


🙏 Support

If you find this script helpful, consider supporting me:

Lets keep each other going, safe, and well.