Opened 15 years ago

Closed 15 years ago

#20394 closed defect (fixed)

php5-readline: Unable to load dynamic library './readline.so'

Reported by: trevor@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: php readline dlopen Cc:
Port: php5-readline, php5, php5-devel

Description

When using the php5-readline port, attempting to launch PHP in interactive mode (php -a) results in the following error:

PHP Warning: PHP Startup: Unable to load dynamic library './readline.so' - dlopen(./readline.so, 9): image not found in Unknown on line 0

Steps to reproduce:

  1. Run: sudo port install php5-readline
  2. Run: php -a

Expected results:

I should get a 'php >' prompt.

Actual results:

I get the error described above, and then the PHP interpreter starts up without readline support (no 'php >' prompt).

Notes:

I can get the error to go away by using the following command:

export LD_LIBRARY_PATH=/opt/local/lib/php/extensions/no-debug-non-zts-20090626/

However, even without the error PHP still doesn't seem to be starting up with readline support.

This used to work back when readline was a variant of the php5 port.

Change History (8)

comment:1 Changed 15 years ago by trevor@…

Actually, it seems that this happens regardless of whether the '-a' flag is used when running PHP.

comment:2 Changed 15 years ago by blb@…

Owner: changed from macports-tickets@… to ryandesign@…

Sounds like the binary needs to know the proper paths for dlopen() perhaps?

comment:3 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

It sounds like you have in your php.ini the line

extension_dir = "./"

This is a problem and will cause this message. This line was present in the sample php.ini files provided with PHP 5.2.x and earlier so I'm not surprised you have this. The sample php.ini files in PHP 5.3 have this line commented out; in the absense of an extension_dir line in the php.ini, PHP automatically figures out where the extensions are. So you should remove the line from your php.ini.

When you built the php5-readline port, a message should have been printed advising you of this. If this did not happen, I may have a bug in the code. Could you please try rebuilding php5-readline to see if the message gets printed?

sudo port -nf upgrade php5-readline

comment:4 Changed 15 years ago by trevor@…

Alright, extension_dir = "./" was definitely the problem.

Looking through my logs, it looks like the warning was displayed when I first upgraded, but I missed it (I was updating everything, so there was a lot to review).

Running sudo port -nf upgrade php5-readline did not display the warning message, however.

Also, running 'php -a' still doesn't seem to be using readline.

comment:5 in reply to:  4 ; Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to trevor@…:

Alright, extension_dir = "./" was definitely the problem.

Looking through my logs, it looks like the warning was displayed when I first upgraded, but I missed it (I was updating everything, so there was a lot to review).

Running sudo port -nf upgrade php5-readline did not display the warning message, however.

Had you already removed the line from your php.ini at the time you rebuilt php5-readline? The warning is only printed if the problematic line exists in the php.ini.

Also, running 'php -a' still doesn't seem to be using readline.

I don't use readline, but before moving readline functionality from the readline variant to the php5-readline port, I tested it in the following way:

$ port deactivate php5-readline
--->  Deactivating php5-readline
$ php -r 'echo (int)function_exists("readline")."\n";'
0
$ port activate php5-readline
--->  Activating php5-readline
$ php -r 'echo (int)function_exists("readline")."\n";'
1
$ 

I did not know about "php -a". I now see from the php manpage that "php -a" makes use of readline if available. I did not realize php itself used readline; I thought it just made readline functions available to your PHP scripts.

comment:6 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

I see the Red Hat folks noticed this situation as well, and their fix was to enable readline all the time. It sounds like maybe we should do that as well.

comment:7 in reply to:  5 Changed 15 years ago by trevor@…

Replying to ryandesign@…:

Had you already removed the line from your php.ini at the time you rebuilt php5-readline? The warning is only printed if the problematic line exists in the php.ini.

Heh, I thought I did, but I just re-ran the command again and it showed up. Perhaps I forgot to save. I blame it on being tired. How embarrassing.

So, I guess the only thing remaining is to get 'php -a' working with readline.

Thanks for all of your help on this.

comment:8 in reply to:  6 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Port: php5 php5-devel added
Resolution: fixed
Status: newclosed

Replying to ryandesign@…:

I see the Red Hat folks noticed this situation as well, and their fix was to enable readline all the time. It sounds like maybe we should do that as well.

Done for php5 in r56346 and for php5-devel in r56348. readline works in "php -a" again. The php5-readline port is no longer needed and can be uninstalled.

Note: See TracTickets for help on using tickets.