On Sat, 2004-03-20 at 20:03, Chris Hewitt wrote: > 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.
Thank you, Chris, I appreciate that. When I posted my issue, I immediately received nearly a dozen mails from automated systems saying pretty much "I don't read this list, don't send me mail", but no other response ever came. I figured that this was a dead list and forgot about hoping to find any help in it. The next day I twigged to what my problem probably was and was able to fix it. What IS the status of this list, please? > 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. That is exactly what it had turned out to be in fact. The script that was giving me the problem I ended up posting about, wouldn't even run at first because, for whatever reason, I had no command line executable. That really baffled me at first, but after a bit of googling I discovered that even with --enable-cli the executable had to be installed by hand. I found the binary in my build tree and put it in my path and thought that that was that. Later the application (from the browswer) choked on a missing mb_ereg_replace and after a bit I clicked to the fact that although I'd passed --enable-mbstring to configure, I'd missed --enable-mbregex. Well, *I* hadn't missed it, it just wasn't listed in the config inventory I was given to build the app. At any rate, I recompiled with --enable-mbregex and the application stopped choking. But I'd completely forgotten about the CLI. (Homer Simpson sound) Once I put the right CLI in place, the command line problems were solved as well. > 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? This is new to me and I'm not really sure I understand what you're talking about. Could you go into more detail or point me to some docu, please? And thanks again, Chris. Andy