6

Since Android is Linux at its base, I logically think it should be possible to run a script on Android, like a Python script or PHP script (with executable bit obviously).

If not conventionally, is there any way to do so?

Bill the Lizard
  • 281
  • 4
  • 14
Nirmik
  • 511
  • 4
  • 8
  • 21
  • Are you asking about a command prompt, or about developing Python code under Android? – david6 Nov 09 '12 at 08:11
  • Python and php are not the same as Linux. But regarding to your question, yes it is possible to run python and php in Android, though you do need to install them first since unlike many other Linux systems, they're not installed by default. – Lie Ryan Nov 09 '12 at 08:48
  • 4
    Did you try anything? – Matthew Read Nov 10 '12 at 07:06

3 Answers3

12

Python/PHP specific

If you are asking specifically for Python and PHP scripts, SL4A probably is your best choice (though there are other Python supporting apps in the playstore, like e.g. QPython Lite). And if you want to automate things, you might want to take a look at the SL4A Script Launcher (in connection with TaskBomb task scheduler) as well.

Shell Scripts

But talking about "Linux" and "scripts in general", the first coming to my mind are Shell Scripts. These can be run directly from the command line using any terminal emulator (e.g. Android Terminal Emulator, Terminal IDE) -- or, if you prefer some "graphical help", using specific launcher apps like SH Script Runner, ScriptMe, or Script Manager.

Izzy
  • 91,166
  • 73
  • 343
  • 943
4

You want SL4A. From the website:

Scripting Layer for Android (SL4A) brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device. These scripts have access to many of the APIs available to full-fledged Android applications, but with a greatly simplified interface that makes it easy to get things done.

Matthieu
  • 103
  • 5
Chinmay Kanchi
  • 406
  • 4
  • 13
0

To run python scripts on android download "QPython" / "Qpython3" app from google play store. To run PHP scripts don't use SL4A because you can only run php scripts but can't develop php sites,Instead download Server for PHP app from google playstore. Watch the below video to learn how to run php scripts on Server for PHP app : https://youtu.be/VG6IdIi7m8k