Andrew Kelly wrote:

Hi all,

I just scanned the list archives and couldn't find my problem listed,
forgive me if I just did a poor search.

I've just been forced to take the 'emergency migration' of an active
website that uses php to communicate with a postgresql backend.
(php 4.2.3, apache 1.3.29, postgresql 7.2.4)

There was minimal communication with the previous "owner" and all I've
had to work from is a pretty weak Configuration Inventory document. I'm
sure I'll find scads more problems in the days to come, but at the
moment the critical one is this:

There is a script which calls php from the command line to import a
series of records generated on a remote site. The 'local' php was
compliled with (among others) --enable-mbstring --enable-mbregex, and
this functionality is available when the app is accessed through a
browser. However, when the script is run from the command line, it fails
claiming that it cannot find the function mb_ereg_replace(). The command
line script is being run as the same user that runs the online app, from
within the same tree.
php -i shows indicates that the same php.ini file is being used as I can
see in a phpinfo() call through the browser.

This is all very new to me and I have a ton of pressure from above
because this app is well used.


Why is more or less core functionality not available from the command
line? Where should I start digging? I'd really, REALLY appreciate any
pointers you can give me.

With great thanks in advance,

Andrew,

I've no direct answer unfortunately, but as I've seen no answers, I offer some thoughts that may be helpful.

I think I'd start by doing a "php phpinfo.php" from the command line with phpinfor.php containing "<?php phpinfo() ?>" and see if the --with-mbstring and --with-mbregex are present. Its possible that the command line php you are using is not the one you compiled. Check "which php" also. With the multiplicity of configure options affecting the command line php (whether it is CLI or CGI, or even whether they were compiled but not installed), its possible the "right" one is not being used.

Is the mb_ereg_replace() function that fails the first mbstring function that the code calls? If it is then I'd suspect the wrong php executable, if it is not then perhaps its the function overloading setting in php.ini. mbstring.func_overload needs to be set between 4 and 7 for the overloaded regex funtions to be available, by calling the base one (in this case ereg_replace()). Is the mbstring function being called directly or the base function and relying on the overload setting?

Somewhere in there should be the answer, let us know how you get on.
HTH
Chris

Reply via email to