-
-
Save adamz01h/e4d89b8ebe46e0d308ba4cc7218e7f2d to your computer and use it in GitHub Desktop.
Install Lampp on termux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Update packages | |
| apt update | |
| apt upgrade -y | |
| # Install Apache and PHP | |
| apt install php-apache -y | |
| # Install MySQL | |
| apt install mariadb -y | |
| # Install nano text editor | |
| apt install nano -y | |
| # Load PHP module in Apache configuration file | |
| sed -i 's/#LoadModule mpm_prefork_module libexec\/apache2\/mod_mpm_prefork.so/LoadModule mpm_prefork_module libexec\/apache2\/mod_mpm_prefork.so\nLoadModule php7_module libexec\/apache2\/libphp7.so/' /data/data/com.termux/files/usr/etc/apache2/httpd.conf | |
| # Set handler for PHP files in Apache configuration file | |
| sed -i 's/#LoadModule mpm_prefork_module libexec\/apache2\/mod_mpm_prefork.so/LoadModule mpm_prefork_module libexec\/apache2\/mod_mpm_prefork.so\nLoadModule php7_module libexec\/apache2\/libphp7.so\nAddHandler php7-script .php/' /data/data/com.termux/files/usr/etc/apache2/httpd.conf | |
| # Restart Apache | |
| apachectl restart | |
| # CLI menu for configuring the server | |
| while true; do | |
| echo "Server Configuration Menu:" | |
| echo "1. Set PHP project path" | |
| echo "2. Edit Apache configuration file" | |
| echo "3. Edit PHP configuration file" | |
| echo "4. Restart Apache" | |
| echo "5. Exit" | |
| read -p "Enter your choice: " choice | |
| case $choice in | |
| 1) | |
| read -p "Enter the absolute path to your PHP project: " project_path | |
| sed -i "s|DocumentRoot \"/data/data/com.termux/files/usr/share/apache2/default-site/htdocs\"|DocumentRoot \"$project_path\"|" /data/data/com.termux/files/usr/etc/apache2/httpd.conf | |
| apachectl restart | |
| ;; | |
| 2) | |
| nano /data/data/com.termux/files/usr/etc/apache2/httpd.conf | |
| apachectl restart | |
| ;; | |
| 3) | |
| nano /data/data/com.termux/files/usr/etc/php.ini | |
| apachectl restart | |
| ;; | |
| 4) | |
| apachectl restart | |
| ;; | |
| 5) | |
| break | |
| ;; | |
| *) | |
| echo "Invalid choice" | |
| ;; | |
| esac | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment