LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-04-2008, 09:10 AM   #1
zokken
Member
 
Registered: Oct 2008
Posts: 34

Rep: Reputation: 15
PHP Problem ('undefined index', 'undefined function')


Hi,

I'm moving a website with PHP content from a Mac server to a Linux server (Redhat AS4), but at least one page is not working on the Linux host. Unfortunately, I know next to nothing about PHP. The problem page is showing up blank and Apache's error_log shows the following:

Code:
[client 1.2.3.4] PHP Notice:  Undefined index:  q in /web/html/acad/dict/includes/search-commands.php on line 12, referer: http://ourhost.com/problem/path/
[client 1.2.3.4] PHP Fatal error:  Call to undefined function:  mb_strlen() in /web/html/acad/dict/includes/search-commands.php on line 15, referer: http://ourhost.com/problem/path/
The lines in the file referenced are the following:

Line 12:
Code:
$search_str = strtr($_GET['q'], array("*" => ".*"));
Line 15:
Code:
if (mb_strlen($search_str, 'UTF-8') > 0) {
If I comment out line 15 (and the closing curly brace) it *appears* to work properly -- the page appears and I'm able to get results from the mysql database the page queries against -- but then new errors occur:

Code:
[client 1.2.3.4] PHP Notice:  Undefined variable:  prefix in /web/html/acad/dict/includes/searchbox.php on line 5, referer: http://ourhost.com/problem/path/dict...est&fields=all
[client 1.2.3.4] PHP Notice:  Undefined variable:  no_real_results in /web/html/acad/dict/includes/searchbox.php on line 80, referer: http://ourhost.com/problem/path/dict...est&fields=all
Resolving the first set of errors may resolve these errors as well, though.

This machine is running PHP 4.3.9 (also has php-mysql-4.3.9 and php-devel 4.3.9). The Mac server that it works on is running PHP 4.4.8. And another Linux machine it works on is running PHP 4.3.2 (also php-mysql and php-imap; same versions).

Anyone have any ideas? I can provide more info about the PHP implementation or the system if needed, just let me know what you need.

Thanks.
 
Old 12-04-2008, 09:29 AM   #2
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,477

Rep: Reputation: 87
Well, the first thing I'd try is to have the versions of all the involved software (Apache, MySQL, PHP) -EXACTLY- the same. I know the PHP docs say the the mb_str function should be available, but my guess is that at least some (but not neccesarily all) your problems originate from having two different versions that try to run code that appears to be version specific?

Additionally, it could also be character encodings, which almost certainly is handled differently on OSX vs. Linux...? Since the functions complaining seem to be codepage specific functions?
 
Old 12-04-2008, 10:18 AM   #3
judge312
LQ Newbie
 
Registered: Dec 2008
Distribution: fedora,rhel
Posts: 18

Rep: Reputation: 1
just replace (mb_strlen($search_str, 'UTF-8') > 0)
with (strlen($search_str) > 0)

your php doesn't support mb_strlen.
you might have problem with non-utf characters
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent PHP problem with "undefined function: domxml_open_mem()"! Recomplie php? Oskare100 Linux - Server 0 12-27-2006 12:28 PM
weird PHP problem: Call to undefined function mysql_connect() Shioni Linux - Server 4 12-22-2006 05:26 AM
undefined function scandir() in php tooparam Linux - Newbie 1 01-22-2006 01:03 AM
Need help with PHP and MySQL: Undefined function... Mega Man X Programming 12 09-15-2004 11:07 PM
PHP Undefined index Error Gerardoj Programming 1 05-30-2004 03:30 AM


All times are GMT -5. The time now is 01:23 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration