php cli readline_callback_handler_install error - php

When I call the function readline_callback_handler_install I get an error:
Fatal error: Call to undefined function readline_callback_handler_install() in /home/me/test.php on line 20
But I have php extension readline installed (and all other readline functions gives no error), and my version of php is greather than 5.1
me#laptop:~$ php -r 'echo extension_loaded("readline") . "\n";'
1
me#laptop:~$ php -v
PHP 5.3.3-1ubuntu9.6 with Suhosin-Patch (cli) (built: Oct 14 2011 22:31:56)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
Does someone know what is happening?

I've had this same error on the ubuntu machines I've tried to use this on.
Just as a note, I know Ubuntu build php using libedit, instead of readline. This may be one cause of the problem.

Related

After Google App Engine SDK update not able to run local server through PHPStorm 8?

After updating Google App Engine SDK to 1.9.20 I am unable to run local server through PHPStorm 8. I get the following error:
The PHP interpreter specified with the --php_executable_path flag
("/usr/local/bin/php-cgi") is not compatible with the App Engine PHP development environment.
Unable to load GAE runtime module at /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/php55/gae_runtime_module.so
I am running following versions locally
php --version
PHP 5.5.22 (cli) (built: Mar 10 2015 14:17:46)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with Xdebug v2.2.7, Copyright (c) 2002-2015, by Derick Rethans
php-cgi --version
PHP 5.5.22 (cgi-fcgi) (built: Mar 10 2015 14:17:49)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
with Xdebug v2.2.7, Copyright (c) 2002-2015, by Derick Rethans
Here is the error I am getting through PHPStorm:
ERROR 2015-05-18 11:30:04,783 php_runtime.py:353] The PHP runtime is not
available
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 349, in new_instance
self._check_binaries(php_executable_path, gae_extension_path)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 290, in _check_binaries
cls._check_gae_extension(php_executable_path, gae_extension_path, env)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 252, in _check_gae_extension
gae_extension_path)
_PHPEnvironmentError: Unable to load GAE runtime module at /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/php55/gae_runtime_module.so
To my understanding, PHP version 5.5 should be supported, where is the problem?
Assuming you're running on Mac, simply remove the "Path to php-cgi executable" setting in PHPStorm should fix the problem.

RedBeanPHP 4 __HALT_COMPILER();

Using this little script :
<?php
require 'rb.phar';
?>
I get this error :
*PHP Fatal error: Uncaught exception 'PharException' with message '__HALT_COMPILER(); must be declared in a phar' in /home/site1/rb.phar:8\nStack trace:\n#0 /home/site1/rb.phar(8): Phar::webPhar(NULL, 'index.php')\n#1 /home/site1/index.php(2): require('/home/site1/rb....')\n#2 {main}\n thrown in /home/site1/rb.phar on line 8*
php -v :
PHP 5.4.4-14+deb7u8 (cli) (built: Feb 17 2014 09:18:47)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
with XCache v2.0.0, Copyright (c) 2005-2012, by mOo
with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
uname -a :
Linux lamp 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
Can anyone help me get this working, please? I downloaded the latest RedBeanPHP 4 from the website today.
EDIT - as answered by Gabor, removing xcache did get rid of the problem. Here's what I had to do :
mv /etc/apache2/conf.d/20-xcache.ini /etc/apache2/conf.d/20-xcache.ini.disabled
service apache2 restart
If anyone has a better way to disable it (or any other suggestions) please leave a comment.
Thanks.
Might be connected to an issue in XCache:
http://xcache.lighttpd.net/ticket/273

how to update native php 5.3 mac installation with installed brew php 5.4 installation?

I am trying to work on laravel framework, i got an error for which i needed php5.4+. earlier i had installed php, apache and mysql somehow which came with mac.
when i check the versions i get as below:
$ /usr/local/Cellar/php54/5.4.19/bin/php -v
PHP 5.4.19 (cli) (built: Sep 17 2013 21:14:22) (DEBUG)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
$ php -v
PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 24 2012 17:45:44)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
right now php5.3 gets displed on phpinfo(), how to make apache use php5.4?
if which php still gives /usr/bin/php, add this line to the end of your ~/.bashrc (or ~/.zshrc if you use ZSH)
export PATH="$(brew --prefix)/bin:$PATH"
Also see https://github.com/josegonzalez/homebrew-php#installing-multiple-versions
EDIT
For Apache
LoadModule php5_module /usr/local/opt/php54/libexec/apache2/libphp5.so
php5.3, php5.4, php5.5
http://php-osx.liip.ch/
PHP 5.5
http://mac.tutsplus.com/tutorials/server/upgrading-the-native-php-installation-on-os-x-mountain-lion/

How to update PHP CLI OSX?

I just updated to php 5.4 using http://php-osx.liip.ch/ on osx lion.
when i type:
php -v
i still see:
PHP 5.3.15 with Suhosin-Patch (cli) (built: Jul 31 2012 14:49:18)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
But phpinfo() shows 5.4.
How do i update this?
Just Export installed PHP path ,type this on Terminal
export PATH=/usr/local/php5/bin:$PATH
I checked that /usr/local/php5/bin/php existed. It did, so I added /usr/local/php5/bin to my PATH.
Thank you #AD7six
The answer shared by both Chutipong Roobklom and user1168427 helped, if you want to update to the latest php cli which is 7.2.7 (most current and stable release as of 2018 when this post was created originally so check the latest php version, methods for switching versions may vary) then just use this instead of the php5 command. export PATH=/usr/local/php7/bin:$PATH then type php -v and you should have something that reads like this(on MACOSX by the way):
PHP 7.2.7 (cli) (built: Jun 22 2018 06:27:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies
so you shouldn't be getting any errors. Hope this helps and for Kamel, that is how it is installed. You're kind of 'exposing' it in a way for your machine to now recognize which php version you are using.

PHP Extension Not Loading

I am receiving the following error when trying to use the PHP shared memory function shm_attach():
PHP Fatal error: Call to undefined function shm_attach().
I have looked at my php.ini configure command via phpinfo(), and it seems to contain the necessary extensions enabled:
Configure Command => './configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu'
...
'--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared'
...
I do not see a reference in my php.ini file to any lines like these:
extension=sysvmsg.so
extension=sysvsem.so
extension=sysvshm.so,
so when I added these to my php.ini file in the hopes that it would possibly do something, it merely threw an error.
In my PHP version on my localhost (Ubuntu), I didn't need to download and install any extensions for these type of functions to work, they were installed be default and worked out of the box.
PHP 5.3.6-13ubuntu3.6 with Suhosin-Patch (cli) (built: Feb 11 2012 02:17:16)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
The server I am having the issue on is using a different configuration:
Linux version 2.6.35.6-45.fc14.x86_64 (mockbuild#x86-02.phx2.fedoraproject.org) (gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) ) #1 SMP Mon Oct 18 23:57:44 UTC 2010
and PHP:
PHP 5.3.8 (cli) (built: Sep 28 2011 17:34:42)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
Any suggestions as to what might have caused the extension to have been installed incorrectly?
Any solutions?

Categories