I'm trying to install phpsh on Ubuntu and I did everything on the install guide, but I am getting this error:
Starting php
Traceback (most recent call last):
File "/usr/local/bin/phpsh", line 47, in <module>
verbose=opts.verbose)
File "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py",
line 503, in __init__
self.php_open_and_check()
File "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py",
line 641, in php_open_and_check
self.php_open()
File "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py",
line 698, in php_open
preexec_fn=os.setsid)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Why am I getting these errors? How do I install phpsh on linux?
Open ~/.bashrc from the terminal using:
linux@terminal:vi ~/.bashrc
set PYTHONPATH and path in there:
export PYTHONPATH=~/lib/python2.6/site-packages
//Put the above value as your site-packages directory location,
//yours may have a different python version number.
Then add ~/bin to your PATH as well as per your directory structure.
The phpsh install guide at (http://www.phpsh.org/) site only gives you part of the details to get this up and running on linux.
The Gotchas:
Here are all the specific steps I did to install phpsh on a Fedora 17 box
cd /home/el
sudo yum install php
sudo yum install php-posix
sudo yum install python
sudo yum install python-devel
git clone git://github.com/facebook/phpsh.git
cd /home/el/phpsh
sudo easy_install readline
python setup.py build
sudo python setup.py install
Open up your /home/el/.bashrc in an editor and add this line at the bottom:
export PYTHONPATH="/home/el/lib/python2.7/site-packages"
Make sure that the directory exists before you paste it in there. You may have to change the python2.7 to a different number to reflect your actual version. Restart the terminal.
Then, FINALLY, it runs as advertised:
el@defiant ~ $ phpsh
Starting php
php> echo "sweet lady freedom lets make out! " . 1337;
sweet lady freedom lets make out! 1337
php>
Then see my post to take a test drive of this tool: How to use the PHP interactive shell
Notes if you are adapting this to other flavors of Linux
You may have to use python-dev instead of python-devel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With