PHP Interactive Mode, phpsh

David Allen the.real.david.allen at gmail.com
Fri Jan 6 12:47:41 UTC 2012


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