有没有办法在Android上运行PHP

时间:2021-01-20 20:22:15

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 ?

我试图在内置的Android浏览器中打开我的PHP脚本,但我只看到我的代码,作为文本,PHP没有运行。这是为什么 ?

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 ?

如何在我的Android设备上运行PHP?有没有办法在Android设备上设置PHP和Web服务器?

1 个解决方案

#1


5  

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.

好的,这是一个个人推荐,但我已经成功使用免费的Palapa Web Server,它本质上是一个在Android上运行的web / mysql服务器,它将运行你的PHP脚本,它也可以脱机工作。

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.

要使用它,请安装应用程序,然后将PHP / HTML文件复制到手机上。默认情况下,该应用程序使用/ sdcard / pws / www /,因此如果您将文件放在那里,它应该选择它们。然后,启动应用程序,单击“启动服务器”,然后使用Android设备上的Web浏览器转到http://127.0.0.1:8080,它应该可以正常工作。

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.

请注意,设置PHPMyAdmin(如果您需要管理数据库)可能有点棘手,因为您需要为其下载额外的软件包。

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

请让我知道这对你有没有用。 (注意:我不隶属于这个应用程序,我只是一个满意的用户。)

#1


5  

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.

好的,这是一个个人推荐,但我已经成功使用免费的Palapa Web Server,它本质上是一个在Android上运行的web / mysql服务器,它将运行你的PHP脚本,它也可以脱机工作。

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.

要使用它,请安装应用程序,然后将PHP / HTML文件复制到手机上。默认情况下,该应用程序使用/ sdcard / pws / www /,因此如果您将文件放在那里,它应该选择它们。然后,启动应用程序,单击“启动服务器”,然后使用Android设备上的Web浏览器转到http://127.0.0.1:8080,它应该可以正常工作。

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.

请注意,设置PHPMyAdmin(如果您需要管理数据库)可能有点棘手,因为您需要为其下载额外的软件包。

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

请让我知道这对你有没有用。 (注意:我不隶属于这个应用程序,我只是一个满意的用户。)