PHP Interactive Mode, phpsh

Aimelyne Mochiron aimelynem at gmail.com
Sun Jan 8 08:54:08 UTC 2012


Hi David,

To enable PHP interactive mode, either readline or libedit must be compiled into the PHP binary. To do that, edit lang/php5's Makefile to add to CONFIGURE_ARGS either '--with-readline' or '--with-libedit' (the library you pick must be installed on your system).

Note that php -nm will list readline irrespective of whether you compiled it or libedit in; phpinfo() will report the correct configure command, however.

I'm afraid I can't help IRT phpsh, as I'm not familiar with it.

HTH,

AM

> Message: 2
> Date: Fri, 6 Jan 2012 04:25:00 -0800
> From: David Allen <the.real.david.allen at gmail.com>
> Subject: PHP Interactive Mode, phpsh
> To: freebsd-ports at freebsd.org
> Message-ID:
> 	<CAFsxFVmmfGLGz3j3WdRsk21WoQVvkmLwd=yUqHp4EpLGt4srng at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> The Gods seem to be conspiring against me.  I'm flummoxed as to why I
> can't get php running in interactive mode (php -a).  Some relevant info:
> 
>    php5-5.3.8          PHP Scripting Language
>    php5-extensions-1.5 A "meta-port" to install PHP extensions
>    php5-readline-5.3.8 The readline shared extension for php
>    python27-2.7.2_2    An interpreted object-oriented programming language
> 
> I tried doing an endrun around the problem by installing python in
> conjunction with the /devel/phpsh port.  That hasn't quite worked out
> either.
> 
> Testing the installation of phpsh on a local build server:
> 
>    $ phpsh
>    Starting php
>    Install pcntl to enable forking on every command.
>    type 'h' or 'help' to see instructions & features
>    php> echo "Hello world\n";
>    Hello world
> 
>    php> d array_merge
> 
>    Traceback (most recent call last):
>    File "/usr/local/bin/phpsh", line 127, in <module>
>        t_c_ret = s.try_command(line)
>    File "/usr/local/lib/python2.7/site-packages/phpsh/__init__.py", line
> 909, in try_command
>        import manual
>    File "/usr/local/lib/python2.7/site-packages/phpsh/manual.py", line 4,
> in <module>
>        from sqlite3 import dbapi2 as sqlite
>    File "/usr/local/lib/python2.7/sqlite3/__init__.py", line 24, in
> <module>
>        from dbapi2 import *
>    File "/usr/local/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
>        from _sqlite3 import *
>    ImportError: No module named _sqlite3
> 
>    [ At this point phpsh exits ]
> 
> Building a phpsh package fails:
> 
>    ===>  Building package for phpsh-20110513
>    tar: etc/phpsh/config.sample: Cannot stat: No such file or directory
>    tar: etc/phpsh/php_manual.db: Cannot stat: No such file or directory
>    tar: etc/phpsh/rc.php: Cannot stat: No such file or directory
>    tar: Error exit delayed from previous errors.
>    pkg_create: make_dist: tar command failed with code 256
>    *** Error code 1
> 
>    Stop in /usr/ports/devel/phpsh.
>    *** Error code 1
> 
>    Stop in /usr/ports/devel/phpsh.
> 
> Running 'pkg_info -L' reveals the missing files being installed into
> /usr/local/etc/phpsh, but no such directory (or files) exists.
> 
> And just for fun, the results after installing phpsh on Mac OS X (where
> php interactive mode doesn't work either):
> 
>    Warning: require_once(/opt/local/etc/phpsh/rc.php): failed to open
>    stream: No such file or directory in
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/phpsh/phpsh.php
> 
>    on line 49
> 
>    Fatal error: require_once(): Failed opening required
>    '/opt/local/etc/phpsh/rc.php' (include_path='.:') in
> 
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/phpsh/phpsh.php
> 
>    on line 49
> 
> Could someone shed some light as to why php interactive mode doesn't work
> with FreeBSD?  Or alternatively, how to fix my phpsh installation and get
> a package made?
> 
> Thanks!
> 


More information about the freebsd-ports mailing list