Fatal error: Call to undefined function expect_popen() - php

Since my upgrade from PHP 5.5.9 to 5.6 on my Ubuntu 14.04 LTS server I have been getting problems with the expect library for PHP. It keeps displaying the Fatal error in the description. I believe the package that I need for this is libexpect-php5. Some installation checks confirm that it is installed:
root#k1:/etc/php5/conf.d$ dpkg --get-selections | grep -v deinstall | grep expect
empty-expect install
expect install
expect-dev install
expect-lite install
libexpect-ocaml install
libexpect-ocaml-dev install
libexpect-perl install
**libexpect-php5** install // installed right?
libexpect-simple-perl install
libghc-hspec-expectations-dev install
libghc-hspec-expectations-doc install
libghc-hspec-expectations-prof install
libnet-scp-expect-perl install
libtest-expect-perl install
netexpect install
python-pexpect install
python-pexpect-doc install
python3-pexpect install
and
root#k1:/etc/php5/conf.d$ expect -v
expect version 5.45
and the expect.so files:
root#k1:/usr/lib$ ls | grep expect
libexpect.so
libexpect.so.5
libexpect.so.5.45
and finally my /etc/php5/apache2/php.ini file:
extension=expect.so
I had to install libexpect-ph5 by downloading and installing the .deb file manually, because it was erring about an uninstallable dependency api... Now when I do and apt-get update && apt-get upgrade it keeps telling me this:
The following packages have been kept back:
libexpect-php5
Just installing that package does something, but the system will still keep the package back. This leaves me with a PHP version that doesn't know about the expect_popen() function.
How do I solve this?

I found out that Apache2 was loading the wrong php.ini file. Since the upgrade to PHP 5.6 the path has changed as well (of course).
Old location:
/etc/php/apache2/php.ini
New location:
/etc/php/5.6/apache2/php.ini
Along with that I had to specify the exact path to my expect.so extension in php.ini.

Related

Facing issues with installation of memcache php, centos 6

I am following below link to install memcache
https://www.liquidweb.com/kb/how-to-install-the-memcached-php-extension-on-centos-7/
When I run
yum -y install php-pecl-memcache
got error
Transaction Check Error: file /usr/bin/php from install of
php-cli-5.3.3-49.el6.x86_64 conflicts with file from package
ea-php-cli-1.0.0-7.7.1.cpanel.x86_64
Thanks in advance

Can not install php-mbstring on centOS

I had php 5.4 on centOs and I have removed that and installed php 7.
Now One of my codes on server return the following error:
PHP Fatal error: Call to undefined function mb_internal_encoding()
And when I run yum install php-mbstring I got the following error:
Error: php70u-common conflicts with php-common-5.4.16-43.el7_4.x86_64
Error: php70u-json conflicts with php-common-5.4.16-43.el7_4.x86_64
I have removed and installed php7 several times but I didn't work.
It seems that centOs want to install an older version of the package but I don't know how to tell it to download the latest version of mbstring
To search the right MB-String for your PHP version try this command:
sudo yum list | egrep 'php' | grep 70
Change (70) by the specific version of PHP you do have installed in your server,this command will show you all the packages related to you PHP version.
This command will show :
ea-php70-php-mbstring.i686
ea-php70-php-mbstring.x86_64
Now you can install the version compatible with your system.I hope it will works for you.
yum install php72w-mbstring
will install the mbstring for 7.2
cannot-initialize-mbstring-with-php-7
If that does not work, you might only have package for 7.1 available
If that still does not work, you could remove the old 5.4 php common package and try again :
First search which old php packages are still installed on your machine :
yum list installed | grep php | grep 5.4
Then remove the old packages (for instance php-commom-5.4 . You can do the same with other ones if not used)
yum remove php-common-5.4
Then install php-mbstring again
yum install php-mbstring

Pecl install sqlsrv returns No releases available for package

While installing sqlsrv module for PHP7 i'm getting following error -
No releases available for package "pecl.php.net/sqlsrv
Command used
sudo pecl install sqlsrv
Any idea how to resolve this issue?
Same problem here... Solved installing modules as root this way (Ubuntu 16.04):
wget http://pecl.php.net/get/sqlsrv-4.3.0.tgz
pear install sqlsrv-4.3.0.tgz
wget http://pecl.php.net/get/pdo_sqlsrv-4.3.0.tgz
pear install pdo_sqlsrv-4.3.0.tgz
You can check latests available versions here: http://pecl.php.net/package-search.php?pkg_name=sqlsrv&bool=AND&submit=Search
And check if php modules are enabled after installation:
php -m | grep sqlsrv
Try to install a certain version that you know exists:
$ pecl install sqlsrv-4.3.0
Also try to clear the cache:
$ pear clear-cache
For corporate proxy users, you might just need to tell pear to use your proxy.
pear config-set http_proxy http://proxy.example.com:8080
Sometimes pecl.php.net is not available or down. In this case pecl install may show "no releases available".
Just for information.

Unable to install php solr extension

Using pecl install -n solr gives
No releases available for package "pecl.php.net/solr"
install failed
Also tried pear install pecl/solr which gives the same output :
No releases available for package "pecl.php.net/solr"
install failed
I'm using a Mac and php56.
Output of pecl -V
PEAR Version: 1.9.4
PHP Version: 5.6.25
Zend Engine Version: 2.6.0
Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016;
root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
Another important piece of information is that, pear and pecl were not available in my system, so I installed them using
sudo php /usr/lib/php/install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin
Update
Tried sudo pecl install -n solr and now it seems to go one step further
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: phpize failed
Luckily stumbled upon
PEAR package install fails
which led to execute
pear list-upgrades which showed some kind of permission issue with cache directory, manually created the directory using sudo at the specified location (/private/tmp/pear/cache)
And then used sudo to install the solr extension as sudo pecl install -n solr which threw the following error :
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
brew install autoconf followed by sudo pecl install solr worked.

How to install V8js on PHP5.5?

I want to install the v8js extension for PHP5.5 on Ubuntu 12.04 but can't make it working.
When I try to install the v8js extension version 0.2.0 (latest) with PECL, I have this message:
configure: error: libv8 must be version 3.24.6 or greater
ERROR: `/tmp/pear/temp/v8js/configure --with-v8js' failed
If I try to install an old version, I have a compilation error. This message is very similar to my issue: Install v8js for php on ubuntu
How can I fix this issue?
EDIT: I couldn't install it on Ubuntu 14.04 with PHP5.5, even with a PHP downgrade with PHPbrew to PHP 5.4. However, using Ubuntu 12.04 with PHP 5.4 works great. I didn't try the downgrade from PHP 5.5 to 5.4 on Ubuntu 12.04.
in case you can't find libv8-dev or libv8-dbg, you can find the correct version by run command
~$ apt-cache search libv8
libv8-3.14-dbg - V8 JavaScript engine - debugging symbols
libv8-3.14-dev - V8 JavaScript engine - development files for 3.14 branch
libv8-3.14.5 - V8 JavaScript engine - runtime library
libv8-dev - V8 JavaScript engine - development files for latest branch
then you can run
~$ sudo apt-get install libv8-3.14-dev libv8-3.14-dbg g++ cpp
then you can try to install v8js via pecl by running
~$ sudo pecl install v8js-0.2.0
if that command return error like this
configure: error: libv8 must be version 3.24.6 or greater
ERROR: `/tmp/pear/temp/v8js/configure --with-v8js' failed
you can try to install v8js-0.1.3 instead by running
~$ sudo pecl install v8js-0.1.3
then edit your php.ini to add v8js extension
~$ echo "extension=v8js.so" >> /etc/php5/cli/php.ini
Open your terminal/console
sudo apt-get install libv8-dev libv8-dbg g++ cpp
Make an update sudo apt-get update
Try sudo pecl install v8js-0.2.0 (or other version i.e.: sudo pecl install v8js-0.1.3)
Edit your php.ini (Check: Where is my php.ini file?) file by adding: extension=v8js.so.
Restart server
If it the extension still doesn't work, try to edit /etc/php5/conf.d/v8js.ini and add extension=v8js.so and restart server again.
Hope this helps.
These other answers work well and I used v8js-0.1.3 for the past 1.5 years but after needing to upgrade to PHP 7 I needed a better solution as v0.1.3 doesn't compile with PHP 7 (something to do with php_smart_str being renamed to php_smart_string).
After a couple hours of frustrating research and compiling libv8 myself, I didn't want to have to go through this whole process on every server I provisioned.
Anyway, I found this site which points you to a launchpad PPA site that provides a couple different ubuntu packages with the 5.1 and 5.2 libv8 libraries.
I ran these commands (please don't add repositories of 3rd party devs without understanding the risks).
sudo apt-add-repository ppa:pinepain/libv8-5.2
sudo apt-get update
sudo apt-get install libv8-5.2-dev
sudo pecl install v8js-1.1.0
(Thanks #JeyKeu for suggesting to add "apt-get update" to these commands)
I couldn't get v8js-1.3.0 or 1.2.0 to build, but 1.1.0 worked well. I checked the changelog and found that the latest updates are not necessary in my circumstance anyway.

Categories