+ 2
How to configure apache to use php on Android using termux?
I can't install libapache2-mod-php on termux , i am not sure what it is but i believe it is the php module use to configure apache . I have installed apache and php successfully but no idea how to configure apache to use php so it actually process the php file instead of showing the php code.
2 ответов
+ 4
For what its worth, I cannot install that package either, says its not found, I ran "pkg install php" then checked the version, "php -v"... it appears to have installed correctly, these are the steps I took:
1. apt-get install apache2
2. systemctl start apache2
(try "apachectl" if above fails)
3. go to 127.0.0.1:8080 in browser or curl
("It works!")
4. go to /data/data/com.termux/files/usr/share/apache2/default-site/htdocs
(index.html is here)
5. create php file, mine is called "test.php"
test.php
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
6. go to 127.0.0.1:8080/test.php
("Hello World")
7. profit
Screenshot:
https://ibb.co/KctHYL5
+ 1
Steven M thank you , but as i said it still outputs php code only instead of the actual output .
Using html template i see those php code encoded into different characters ,
"      Hello World
';Â ?>Â Â "
But i just want the "Hello World" . I have gone through various articles and they say to configure the apache with module phpmodule.so( so it can process php code) but i can't get it to install on termux( in the usr/libexec/apache2/ folder) with the help of command i talked above .
Only if i could install the lampp on termux , i wudn't have to worry about doing these things manually !