This TEMP Server only for Android users or Termux users.
If you didn't know what is termux than you read here .
T for Termux App.
E for Nginx Web Server.
M for MariaDB Database Server.
P for PHP Language.
If you install Termux app from Google Play Store maybe faced many problem in installation time.
So you go to download termux App from F-Droid or Github .
After install termux app than you follow this commands.
TEMP Server Installation Commands:-
Update your Termux Repositorie.
Update your Termux Packages.
pkg upgrade -y
or
apt upgrade -y
Install PHP Language and PHP-FPM (FastCGI Process Manager) for PHP.
pkg install php php-fpm -y
or
apt install php php-fpm -y
Install MariaDB Database Server.
pkg install mariadb -y
or
apt install mariadb -y
Install Nginx Web Server.
pkg install nginx -y
or
apt install nginx -y
Install PhpMyAdmin for Mariadb/MySQL Client.
pkg install phpmyadmin -y
or
apt install phpmyadmin -y
Composer is a Dependency Manager for PHP programming language so if you need composer than go to this command.
pkg install composer -y
or
apt install composer -y # (Optional)
Install msmtp a lightweight SMTP (Simple Mail Transfer Protocol) client.
pkg install msmtp -y
or
apt install msmtp -y
PHP and Nginx Configuration
Set your project path
cd $PREFIX/etc/nginx
edit nginx.conf file nano nginx.conf
.
root /data/data/com.termux/files/usr/share/nginx/html; # Default Set
# root /sdcard/your_project_path
index index.php index.html index.htm; # Set index
Configuration PHP Script and PHP-FPM.
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/data/data/com.termux/files/usr/var/run/php-fpm.sock; # Set PHP-FPM for php script
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
Open php-fpm.d folder and edit www.conf file.
cd $PREFIX/etc/php-fpm.d
and open www.conf file on nano text editor nano www.conf
.
Set your user name if you didn't know than run this command whoami
and copy your termux user name.
28 user = www-data # Set your termux user name
29 group = www-data # Set your termux user name
41 listen = /data/data/com.termux/files/usr/var/run/php-fpm.sock
53 listen.owner = www-data # Set your termux user name
54 listen.owner = www-data # Set your termux user name
116 pm = dynamic
Go to etc directory cd $PREFIX/etc/php
.
Create a php.ini file run this command touch php.ini
.
Open php.ini file on your vim Editor or Nano Editor.
nano php.ini
.
sendmail_path = " /data/data/com.termux/files/usr/bin/msmtp -t"
Go to etc directory cd $PREFIX/etc/php
.
Create conf.d
directory inside of php directory.
Run this command mkdir conf.d
Go to conf.d directory cd conf.d
Create my.ini file for MySQL or Mariadb configuration.
Run this command touch my.ini && vi my.ini
error_reporting = E_ALL
display_errors = on
date.timezone = " Asia/Kolkata" # Replace with your timezone
memory_limit = 128M
upload_max_filesize = 10M
post_max_size = 20M
# my.cnf
[mysqld]
port =3306
socket =/data/data/com.termux/files/usr/tmp/mysql.sock
datadir =/data/data/com.termux/files/usr/var/lib/mysql
log-error =/data/data/com.termux/files/usr/var/log/mysql.err
pid-file =/data/data/com.termux/files/usr/var/run/mysqld/mysqld.pid
skip-external-locking
[client]
port =3306
socket =/data/data/com.termux/files/usr/tmp/mysql.sock
[mysqldump]
quick
quote-names
max_allowed_packet =16M
innodb_buffer_pool_size =256M
key_buffer_size =64M
max_connections =200
First Create a .msmtprc file.
touch .msmtprc
Open .msmtprc file on your Nano Editor.
nano .msmtprc
account default
host smtp.mail.com
port 587
from # Your Email id
auth on
user # Your Email id
password # Your Email Password
tls on
tls_starttls on
tls_trust_file /data/data/com.termux/files/usr/etc/tls/cert.pem
Check Configuration Status
Create a index.php file.
nano index.php
Run this command nginx
and php-fpm
.