All     Ethical Hacking     Networking     Programming     OSINT

PHP in Termux – Installation & Usage Commands

PHP is a popular scripting language used for web development, automation, and backend tasks. With Termux, you can install PHP directly on your Android phone and run scripts easily without any server setup. Below are the simple installation steps and basic usage commands.

Installation

pkg update && pkg upgrade -y
pkg install php -y

Check PHP version:

php --version

Create a PHP file:

nano test.php

Add this code:

<?php
echo "Hello Termux!";
?>

Run the file:

php test.php

Usage Commands

Run any PHP script:

php filename.php

Start a local PHP server (port 8080):

php -S localhost:8080

Show PHP help:

php --help

List PHP modules:

php -m

Uninstall PHP:

pkg uninstall php