Installing phpsh on Turnkey Linux and cannot built setup.py
[update] I know this question is old. But FWIW v14.0 TurnKey Linux has phpsh pre-installed on LAMP/LAPP based appliances.
FWIW I can reproduce this issue on TurnKey LAMP 13.0
However, Python should be there (in /usr/lib/python2.7). At least it is on my test server. FWIW have a look at the output of:
whereis python
/usr/lib/python2.7 should be one of the many results returned (again at least it was on mine).
If you reread the error message, the file that is missing (which it's complaining about it) is 'make'!
Try this:
apt-get update && apt-get install build-essential
Then you should find that
python setup.py build
now completes successfully! :)
Run phpsh with specific php script
It's not supported by default, but you can quickly add.
It by applying this patch to your phpsh.py in the src folder:
--- phpsh.py 2011-05-13 18:16:32.000000000 -0400
+++ phpsh.py 2013-12-05 14:50:11.906673382 -0500
@@ -253,6 +253,7 @@
def __init__(self):
self.config = ConfigParser.RawConfigParser({
"UndefinedFunctionCheck": "yes",
+ "PathToBinary" : None,
"Xdebug" : None,
"DebugClient" : "emacs",
"ClientTimeout" : 60,
@@ -388,6 +389,8 @@
except Exception, msg:
self.print_error("Failed to load config file, using default "\
"settings: " + str(msg))
+ if self.config.get_option("General", "PathToBinary"):
+ os.environ['PATH'] = self.config.get_option("General", "PathToBinary") + ':' + os.environ['PATH']
if self.with_xdebug:
xdebug = self.config.get_option("Debugging", "Xdebug")
if xdebug and xdebug != "yes":
If you want to modify an already installed version, find your pythons site-pages folder and apply the patch on both init.py and phpsh.py in that folder.
This will add a new configuration variable so in phpsh/config (in /etc/phpsh/config if installed as root, or ~/.phpsh/config if user). In there you can specify the path to your php binary
PathToBinary: /srv/bin
This is just the path where the binary should be found, not the path binary itself, i.e. /srv/bin/php will not work.
How to use the PHP interactive shell
Try installing phpsh. It is probably the easiest solution.
Steps (assuming dependencies are installed):
git clone https://github.com/facebook/phpsh
cd phpsh
sudo python setup.py install
phpsh
How to do multiline input in phpsh?
Let's take an example, if multiline statement:
- Type: if (condition) {
- Just hit Enter
- ... and write what you want.
- } Close the multiline statement. And hit Enter to execute it.
You can further cancel writing by hitting ctrl + c.
Related Topics
Linux: How to Send a Whole Packet to a Specific Port on Another Host
Error When Bootstrapping Cmake:Log of Errors
Why Does High-Memory Not Exist for 64-Bit Cpu
Remove Strings by a Specific Delimiter
How to Install Pysqlite for Python3.4.2
How to Send Integer with Message Queue with Posix API in Linux
Store Passwords Required by a Linux Daemon
How to Link a Linux's Thread Tid and a Pthread_T "Thread Id"
Systemtap Script to Profile Latency of Functions
Documentation About Device Driver Programming on Kernel 3.X
Assembly Divisions and Floating Points
Npm Install -G Grunt-Cli Failed in Linux
Capturing User-Space Assembly with Ftrace and Kprobes (By Using Virtual Address Translation)
Is There a Linker Flag to Force It to Load All Shared Libraries at Start Time
Postgres Copy Command, Binary File
Total Number of Bytes Read/Written by a Linux Process and Its Children