Is there any way to run PHP on Android [closed]

2019-01-28 12:51发布

问题:

I've tried to open my PHP script in the built in Android browser, but I only see my code, as text, and the PHP doesn't run. Why is that ?

How can I run PHP on my Android device ? Is there a way to set up PHP and a web server on an Android device ?

回答1:

Okay, this is a bit of a personal recommendation, but I've had success with the free Palapa Web Server, which is essentially a web / mysql server which runs on Android, which will run your PHP scripts, and it will also work offline.

To use it, install the app, and copy your PHP / HTML files onto your phone. 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.

Note that setting up PHPMyAdmin (if you need that for managing databases) can be a bit tricky, as you will need to download the extra packages for it.

Let me know if it works for you. (Note: I'm not affiliated with this app, I'm just a mostly satisfied user.)