How do i run a php file in termux?

Termux said:
'CANNOT LINK EXECUTABLE "php": library "libgnutls.so" not found'
Somebody please help

My system:
Packages CPU architecture:
aarch64
Subscribed repositories:

sources.list

deb https://termux.org/packages/ stable main

science-repo (sources.list.d/science.list)

deb https://dl.bintray.com/grimler/science-packages-24 science stable

game-repo (sources.list.d/game.list)

deb https://dl.bintray.com/grimler/game-packages-24 games stable
Updatable packages:
apt/stable 1.4.9-27 aarch64 [upgradable from: 1.4.9-25]
bash/stable 5.0.17 aarch64 [upgradable from: 5.0.11]
busybox/stable 1.31.1-10 aarch64 [upgradable from: 1.31.1-6]
command-not-found/stable 1.52 aarch64 [upgradable from: 1.47]
coreutils/stable 8.32-1 aarch64 [upgradable from: 8.31-8]
curl/stable 7.70.0-1 aarch64 [upgradable from: 7.68.0]
dash/stable 0.5.11 aarch64 [upgradable from: 0.5.10.2-2]
dpkg/stable 1.20.0-3 aarch64 [upgradable from: 1.19.7-9]
ed/stable 1.16 aarch64 [upgradable from: 1.15]
game-repo/stable 1.2 all [upgradable from: 1.1]
gawk/stable 5.1.0 aarch64 [upgradable from: 5.0.1-4]
gpgv/stable 2.2.20-3 aarch64 [upgradable from: 2.2.19]
gzip/stable 1.10-3 aarch64 [upgradable from: 1.10-2]
inetutils/stable 1.9.4-9 aarch64 [upgradable from: 1.9.4-8]
libandroid-support/stable 26 aarch64 [upgradable from: 25-2]
libcurl/stable 7.70.0-1 aarch64 [upgradable from: 7.68.0]
libgpg-error/stable 1.38 aarch64 [upgradable from: 1.36-1]
liblzma/stable 5.2.5-1 aarch64 [upgradable from: 5.2.4-7]
libnghttp2/stable 1.41.0 aarch64 [upgradable from: 1.40.0]
ncurses/stable 6.2.20200222 aarch64 [upgradable from: 6.1.20190928]
openssl/stable 1.1.1g-2 aarch64 [upgradable from: 1.1.1d-1]
pcre/stable 8.44 aarch64 [upgradable from: 8.43-5]
procps/stable 3.3.16-2 aarch64 [upgradable from: 3.3.16]
readline/stable 8.0.4 aarch64 [upgradable from: 8.0.1]
science-repo/stable 1.1 all [upgradable from: 1.0]
termux-exec/stable 0.5 aarch64 [upgradable from: 0.4-1]
termux-keyring/stable 1.4 all [upgradable from: 1.2]
termux-tools/stable 0.81-3 all [upgradable from: 0.74]
util-linux/stable 2.35.2 aarch64 [upgradable from: 2.35.1]
xz-utils/stable 5.2.5-1 aarch64 [upgradable from: 5.2.4-7]
Android version:
9
Kernel build information:
Linux localhost 4.14.98-perf+ #2 SMP PREEMPT Sun Apr 12 20:01:34 CST 2020 aarch64 Android
Device manufacturer:
OPPO
Device model:
CPH1931

PHP is a server scripting language and a powerful tool for making dynamic and interactive Web pages.

With PHP, you can connect and manipulate databases.

MySQL is the most popular database system used with PHP.

How do i run a php file in termux?

If you're interested to learn PHP and SQL, but don't have a computer. Don't worry!

In this article, we are going to talk about how to learn PHP and SQL using Termux on your Android.

So, let's begin!

First of, we need to install the latest version of Termux and the latest version is 0.118.0

The latest version is not available in the Google Play Store. So, we will install it from F-Droid.

Because, Termux's official website recommends installing the latest version of Termux from F-Droid. As you can see in the picture below.

How do i run a php file in termux?

So, just go to F-Droid. You will see the F-Droid website as below. ‌Now scroll down and click on the 'Download F-DROID' button to install F-Droid. Then we will be able to install the latest version of Termux.

How do i run a php file in termux?

You need to install F-Droid after downloading. Then, we will open it. After that, we will search Termux on Fdroid as below.

How do i run a php file in termux?

Then, click on Termux. As you can see in the picture above. Now install the latest version of Termux.

After installing Termux type the following commands one by one and press enter after typing each command...

  1. apt update command lets your system know which packages are available for upgrade, and where the software needs to be restored.
  2. apt upgrade -y can then act on this information and upgrade all installed packages to their latest versions.
  3. termux-setup-storage to allow Termux to access photos, media and files on your device.
  4. pkg install php to install the latest version of PHP.
  5. pkg install nano It's a editor. You can edit PHP file by this nano editor.
  6. nano filename.php to open a PHP file. Then, you can write PHP code to this file.
  7. php filename.php to run this PHP file.

So, we've installed PHP.  Similarly, we can install SQL on our Android to retrieve data from database.

Data retrieval is the use of SQL as a data query language to display data from a database table. The data query language is used to query the required data from the database.

Now, let me show you how to install SQL on our Android.

Open the Termux again. If you've already installed PHP type the following commands one by one and press enter after typing each command...

  1. pkg install mariadb To install mysql. Mysql and Mariadb are the same thing.
  2. mysqld_safe -u root & 
  3. mysql To run the mysql.
  4. CREATE DATABASE database_name; To create database.
  5. SHOW DATABASES; To show a list of databases.
  6. USE database_name; To run the database.
  7. CREATE TABLE table_name (id int(5), Name varchar(20), Email varchar(50)); Data is defined using SQL through CREATE statement.
  8. SHOW TABLES; To show a list of tables in the database.
  9. INSERT INTO table_name (id, Name, Email) VALUES(1, "Your name", "email address"); The INSERT command is used to enter one or more records.
  10. SELECT id, Name, Email FROM table_name; The SELECT statement is used to search the required information from the database. Data manipulation can be done using many more clauses with SELECT statement.
  11. UPDATE table_name SET Name = "Another name" WHERE Name = "Previous name"; The UPDATE command is used to update one or more records from the database.
  12. DELETE table_name WHERE Name="previous name"; The DELETE command is used to delete one or more records from database.

Let's Conclude

This is an article about learning PHP and SQL on your smartphone using Temux.  Now you can learn PHP and SQL using just a smartphone.  There are also many PHP and SQL tutorials available on the Internet.

How do i run a php file in termux?

Mohammad Rahi

Junior frontend developer. YouTube: https://www.youtube.com/channel/UCl8lvktLJpmGPsCIAAeePYQ

How do I run a PHP script in Termux?

In this article, we'll show you how to employ Termux to install, configure, and use PHP for Android..
System Requirements:.
Step 1: Install the Termux app on your device..
Step 2: After installation of the app, you will see a “$” sign. ... .
Step 3: After that, you will see the $ sign again. ... .
Step 4: Next, type the clear command..

How can I execute a PHP file?

You just follow the steps to run PHP program using command line..
Open terminal or command line window..
Goto the specified folder or directory where php files are present..
Then we can run php code using the following command: php file_name.php..

How do I open a php file in Mobile?

By default, the app uses /sdcard/pws/www/ , so if you put your files there, it should pick them up. Then, launch the app, click "Start server", and go to http://127.0.0.1:8080 with your web browser on your android device, and it should work.

Can we run PHP in Mobile?

You can even write Android applications in PHP now. The folks at Irontech have created a PHP port to run on Android, and with the Scripting Layer for Android (SL4A), you can build PHP Android applications.