Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How to solve Fatal error: Call to undefined function readline()? readline library not found?

Writer Emily Wong

I have an Ubuntu 12.04 LTS. And XAMPP for linux 1.7.7.

When I code in php with and call the readline function I get this error message? "Fatal error: Call to undefined function readline()"

I recently found the below thread which pointed out the name of the package that contained the desired readline:How to solve configure: error: readline library not found?

I went ahead and installed # apt-get install libreadline6. But this didnt seem to make a difference. I still get the same error message: "Fatal error: Call to undefined function readline()". Was the thread missing further steps? Can anyone help me?

I am new to Ubuntu.

<?php
echo "Simple menu \n" ;
echo "1. Play Sports \n";
echo "2. Play Strategy games \n";
$userInput = readline('Enter something here: ');
?>
2

3 Answers

The default php builds on ubuntu use libedit and instead of readline. (Due to some licensing issue)

To get the readline support you can download the source and build it

2

This worked just fine for me on Ubuntu 12.10:

sudo apt-get install php5-readline
1

Install the libreadline6-dev package. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.

sudo apt-get install libreadline6-dev
5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy