在Linux上安装phpsh,Python错误 [英] Installing phpsh on linux, Python error
问题描述
我正在尝试在Ubuntu上安装phpsh,并且在安装指南中做了所有操作,但出现此错误:
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
为什么会出现这些错误?如何在Linux上安装phpsh?
Why am I getting these errors? How do I install phpsh on linux?
推荐答案
在Linux上安装phpsh的演练
( http://www.phpsh.org/)站点上的phpsh安装指南仅提供您将获得一部分细节,以便在Linux上启动并运行它.
Walkthrough on installing phpsh on linux
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.
陷阱:
- 如果没有正确配置PHP,phpsh将无法在您的系统上运行.
- 如果您没有正确配置python,phpsh将无法正常运行.
- 如果gcc设置不正确,则phpsh将无法正确安装.
- 您可能需要phpsh的python开发标头才能工作.
以下是我在Fedora 17机器上安装phpsh的所有具体步骤
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
在编辑器中打开/home/el/.bashrc并将此行添加到底部:
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"
在将目录粘贴到其中之前,请确保该目录存在.您可能必须将python2.7
更改为其他数字以反映您的实际版本.重新启动终端.
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.
然后,最终,它按照广告中的说明运行:
el@defiant ~ $ phpsh
Starting php
php> echo "sweet lady freedom lets make out! " . 1337;
sweet lady freedom lets make out! 1337
php>
然后查看我的文章以试用该工具:如何使用PHP交互式外壳程序
Then see my post to take a test drive of this tool: How to use the PHP interactive shell
请注意,是否要使其适应其他Linux版本
您可能必须使用python-dev而不是python-devel.
You may have to use python-dev instead of python-devel.
这篇关于在Linux上安装phpsh,Python错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!