Installing phpsh on linux, Python error - linux

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.

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.
The Gotchas:
phpsh won't run on your system if you don't have PHP configured properly.
phpsh won't run correctly if you don't have python configured properly.
If gcc is not properly setup, then phpsh will not install correctly.
You may need the python development headers for phpsh to work.
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.

I was also getting this issue last day as I am a new learner of PHP. At last I figured out problems.
You must need to install php5-cli from apt-get before installing phpsh.
Also keep in mind that required python packages should also be installed. For that go to https://github.com/facebookarchive/phpsh.
I assume you already have python and you are using Ubuntu 14.04 or above. While installing the python packages you may get some other errors, as it may require you to install easy-install etc. But don't worry, you will get very verbose errors that will tell you exactly what to do.
Hope this solves your problem.

Sooooooooooooooooo I had this problem too.
phpsh is checking for php on your system & not finding it.
$ sudo apt-get install php5
This is partially a matter of poor logging. See the lines in the Traceback:
File "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py",
line 641, in php_open_and_check
self.php_open()
The kicker was that I tried sudo apt-get install php which now obviously didn't work, but for some reason I didn't keep at it!

Related

/usr/bin/wish:don't have that file or directory

I have a browse.tcl script, when I exec it, the Ubuntu shows :
"bash: ./browse.tcl:/usr/bin/wish:don't have that file or directory"
I tried to find the "wish"
usr/bin$ find wish
find: ‘wish’: don't have that file or directory
How can I get it?
It is not part of the default distribution package. In order to install it just do:
apt-get install wish
WISH is TCL's WIndowsing Shell. On Ubuntu you can install it with apt-get install wish.

python installation fails with File "setup.py", line 1023, SyntaxError: invalid syntax

I am trying to install python3.8.1 on a RHEL 7 server. It is an offline installation.
The python folder is untared and stored in a folder in the server.
After redirecting myself into the folder where the setup.py file is located. I run
master1 Python-3.8.1]$ sudo python setup.py install-sh
File "setup.py", line 1023
libraries=[panel_library, *curses_libs]))
^
SyntaxError: invalid syntax
I cant find a solution. Appreciate help
You are trying to install python with source code zipped in tgz. So, you will need to compile it and then install it.
Once you unzip, refer readme.rst file.
Build Instructions
On Unix, Linux, BSD, macOS, and Cygwin::
./configure
make
make test
sudo make install
This will install Python as python3.
I think you are using command to install packages offline using setup.py, that won't work for python fresh installation

Installing nodeJs in ubuntu

Hi I am trying to install nodejs in ubuntu 14 but getting following error.
E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 62%E: Cannot get debconf version. Is debconf installed?
debconf: apt-extracttemplates failed: No such file or directory
Extracting templates from packages: 100%
dpkg: cannot scan updates directory `/var/lib/dpkg/updates/': No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (2)
when trying to installing with software updated I am getting following error.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/aptdaemon/worker.py", line 300, in _process_transaction
not self.is_dpkg_journal_clean()):
File "/usr/lib/python3/dist-packages/aptdaemon/worker.py", line 1111, in is_dpkg_journal_clean
for dentry in os.listdir(status_updates):
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/dpkg/updates/'
I had this problem previously, I removed any variables equivalent to zero and it solved it, perhaps try that.
Add the Node.js-maintained repositories to your Ubuntu package source list with this command:
curl -sL https://deb.nodesource.com/setup | sudo bash -
Then install Node.js with apt-get:
sudo apt-get install nodejs
Optionally we can create a symbolic link for node (for reasons mentioned earlier):
sudo ln -s /usr/bin/nodejs /usr/bin/node
Using this install option, we end up with newer versions of Node.js and npm:
$ node -v
$ npm -v
to check node version and npm version
I suggest installing nvm (node version manager)
https://github.com/creationix/nvm
it allows you to install and use ANY node version, and this may be way better, because ubuntu is bound to one specific version. In web development, every project is prepared using dofferen node, so switching it might be necessary

Can't use cyg-apt on cygwin 1.7

I've got an issue with the cyg-apt command (on cygwin 1.7 running on a Windows 7 64bits virtual machine)
I've followed these step in order to install cyg-apt correctly :
Install cygwin
Install wget and python
wget http://www.lilypond.org/~janneke/software/cyg-apt 1.1
Edit the cygapt file: Change the default server to other than the one in it. (I find ftp://ftp.cise.ufl.edu/pub/mirrors/cygwin/ to be good)
chmod a+rx cyg-apt
mv cyg-apt /bin
cyg-apt setup
cyg-apt update
And no matter what I try with cyg-apt (cyg-apt install package-name, cyg-apt man, even cyg-apt ...), this error appear everytime :
to rely on a native Windows version of Bonjour's mDNSResponder service.
Traceback (most recent call last):
File "/usr/bin/cyg-apt", line 658, in (module) get_setup_ini()
File "/usr/bin/cyg-apt", line 184, in get_setup_ini raise 'URG'
TypeError: exceptions must be old-style classes or derived form BaseException, not str
I've made some researchs and it could be link to an incompatibility with the 1.7 version of cygwin but nothing more helpfull.
You can do this using Cygwin's setup.exe from Windows command line. Example:
cd c:\cygwin
setup.exe -q -P wget,tar,qawk,bzip2,subversion,vim
For a more convenient installer, you may want to use apt-cyg as your package
manager. Its syntax similar to apt-get, which is a plus. For this, follow the
above steps and then use Cygwin Bash for the following steps:
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
Now that apt-cyg is installed. Here are few examples of installing some
packages:
apt-cyg install nano
apt-cyg install git
apt-cyg install ca-certificates
Possibly not exactly what you’re looking for, but perhaps abandon cyg-apt in
favor of apt-cyg. cyg-apt hasn’t been updated since 2009. Personally,
whenever I try cyg-apt update I get an error like this:
cyg-apt: bad URL http://www.gtlib.gatech.edu/setup-2.ini, exiting.
the apparent solution to which is to instead use apt-cyg.
apt-get for cygwin?

Installing Issue in the Debian-Linux Server

I am trying to install Kyoto Cabinet in the Debian-Linux Server by using this commands. However, when I execute
./configure
Command, it gives error
-bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
Can anybody help me why is this happening and how to solve this issue ? Or any idea why this error can happen ?
Because of the ^M character, the configure file is probably using Windows-style line endings.
Try to convert it to use UNIX-style:
dos2unix configure
or in vi type:
:set fileformat=unix
than save the script and try again.
kyotocabinet is now packaged in debian sid
apt-get install libkyotocabinet-dev --install-suggests
you may need to add this to /etc/apt/sources.list
deb http://cdn.debian.net/debian sid main
For me, an initial installation of Kyoto Cabinet (K.C.) was unsuccessful because C++ and zlib were missing from minimal Centos 6. Eventually, these omissions were discovered and K.C. installed (initial instructions from http://skipperkongen.dk/2013/02/14/giving-kyotocabinet-a-go/):
yum -y install gcc-c++
yum -y install zlib-devel
wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz
tar xzvf kyotocabinet-1.2.76.tar.gz
cd kyotocabinet-1.2.76
./configure && make && make install # takes some time!
Test Kyoto Cabinet with:
kcprototest wicked 5
To install the Kyoto Cabinet API for Python (initial instructions from others):
Test Kyoto Cabinet with:
kcprototest wicked 5
As root, of course:
cd $HOME
yum -y install python-devel
wget http://fallabs.com/kyotocabinet/pythonlegacypkg/kyotocabinet-python-legacy-1.18.tar.gz
tar xzvf kyotocabinet-python-legacy-1.18.tar.gz
cd kyotocabinet-python-legacy-1.18
python setup.py install # may take some time!
Create and run a test program, e.g., testkc.py, from the Kyoto Cabint web site.
It should run OK.
You probably want to make K.C. available outside root. Create a new file:
vi /etc/ld.so.conf.d/usrlocal.conf
and add the line:
/usr/local/lib
Then run
ldconfig -v
Move the testkc.py to a user account and run it there; it should be OK

Resources