SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2013-06-29 17:05:08

donpi
Member
From: In the middle of nowhere in EU
Registered: 2012-02-04
Posts: 26

[solved] PHP-cli interactive mode

Hello there,

I need to use php in some interactive way by terminal. So, I installed php5-cli (but not php and Apache).
Now, according the manual page, I should run the following command in the terminal to use php in interactive mode.

~php -a

And it's what I did. The output is

~$ php -a
Interactive mode enabled

It doesn't work, in fact nothing happen if I write

echo 8+4;

Also, when I try to use the arrows (left and right) to move backward and forward, some strange characters appears..

^[[C^[[D

I reinstalled the new !#

~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 7.1 (wheezy)
Release:	7.1
Codename:	wheezy

~$ uname -a
Linux tronix 3.2.0-4-686-pae #1 SMP Debian 3.2.46-1 i686 GNU/Linux

but with the previous version everything work.. (Don't know if it's important, but I had php and Apache installed in the previous !#).

Last edited by donpi (2013-12-17 01:11:54)

Offline

Help fund CrunchBang, donate to the project!

#2 2013-06-30 15:14:35

hi./hack
New Member
Registered: 2013-06-24
Posts: 5

Re: [solved] PHP-cli interactive mode

it seems you have "interactive mode", but not "interactive shell".
in your case you should type something like this:

~$ php -a
Interactive mode enabled

<?php
echo "hello world\n";
?>

then press Ctrl-D
to get your output

take a look here for more info:
http://php.net/manual/en/features.comma … php#108006

about "arrows": some prompts don't recognize 'em as a "move to" key. that's probably be the case of php-cli.


hijhack

Offline

#3 2013-07-05 10:08:37

donpi
Member
From: In the middle of nowhere in EU
Registered: 2012-02-04
Posts: 26

Re: [solved] PHP-cli interactive mode

Thx for your answer hijhack,

but unfortunately still not working..   cry

Offline

#4 2013-12-17 00:58:13

donpi
Member
From: In the middle of nowhere in EU
Registered: 2012-02-04
Posts: 26

Re: [solved] PHP-cli interactive mode

I fixed the problem installing a different repository version.

In my apt/source.list file

## DotDeb.org
deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all

deb http://packages.dotdeb.org wheezy-php55 all
deb-src http://packages.dotdeb.org wheezy-php55 all

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo