Author Topic: Php/apache Zaurus (pdaxrom) Weird Issue  (Read 3633 times)

Hames007

  • Newbie
  • *
  • Posts: 7
    • View Profile
Php/apache Zaurus (pdaxrom) Weird Issue
« on: April 20, 2006, 08:01:45 pm »
G'day,

Got a bizzare issue with the PHP 5.0.2/Apache2 build for PDAXROM on a Zaurus SL-C3000 - its constantly generating variations of the following error:

"Fatal error: Possible integer overflow in memory allocation"

At first I traced it through to any line using the $_SERVER[] command and so replaced it with $HTTP_SERVER_VARS[].

This worked fine, however now I seem to get the issue whenever I use a "preg_match" command.

Ive tried increasing the memory allocated to each script in php.ini from 8MB to 16 and 32MB with no luck.

Is there some greater global variable/configuration item that I need to sort out to stop this from happening or is it something else?

For example, trying to implement a VERY basic PHP image gallery script, the following function errors on the "if (preg_match" line - as have several other scripts.

Code: [Select]
function GetFileList($dirname="."){
global $config;
$list = array();

if ($handle = opendir($dirname)) {
 while (false !== ($file = readdir($handle))) {
  if (preg_match("/\.(jpeg|gif|png)$/i",$file)) {  
   $list[] = $file;
  }
 }
 closedir($handle);
}
sort($list);

return $list;
}#-#GetFileList()

Any help would be GREATLY appreciated!

Thanks in advance

maxg

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Php/apache Zaurus (pdaxrom) Weird Issue
« Reply #1 on: April 21, 2006, 02:55:44 pm »
Maybe you have a problem with pcre ? Do you have package pcre installed (it's in the pdaX feed) ?
You might try to replace the faulty with eregi('\.(jpeg|jpg|gif|png)$', $file) which should work perfectly.
All my reports and testing were made (if no other mention given) on SL-C1000

desertrat

  • Hero Member
  • *****
  • Posts: 743
    • View Profile
    • http://
Php/apache Zaurus (pdaxrom) Weird Issue
« Reply #2 on: April 21, 2006, 04:24:08 pm »
Quote
Any help would be GREATLY appreciated!
Your code works nicely on my build of php.

With regards to maxq's suggestion, if the pcre in official feed does not work for you, you could try the one in my feed (which is what I'm using because the official one does not support UTF which I need for Bluefish):

http://mail.pdaxrom.org/contrib/desertrat

-- cheers
SL-C3100 / Ambicon WL1100C-CF / pdaXrom 1.1.0beta3 / IceWM

Hames007

  • Newbie
  • *
  • Posts: 7
    • View Profile
Php/apache Zaurus (pdaxrom) Weird Issue
« Reply #3 on: April 26, 2006, 08:57:01 pm »
Deserat,

Thanks for your help, I rebuilt my Z with your Apache/PHP packages and all seems to be working fine now, must have been a dodgey package/library.

The only issue Im having now is that I need the GD Library for PHP - any ideas on where I might find a zaurus edition???

Cheers

Hames

Quote
Quote
Any help would be GREATLY appreciated!
Your code works nicely on my build of php.

With regards to maxq's suggestion, if the pcre in official feed does not work for you, you could try the one in my feed (which is what I'm using because the official one does not support UTF which I need for Bluefish):

http://mail.pdaxrom.org/contrib/desertrat

-- cheers
[div align=\"right\"][a href=\"index.php?act=findpost&pid=124109\"][{POST_SNAPBACK}][/a][/div]

Hames007

  • Newbie
  • *
  • Posts: 7
    • View Profile
Php/apache Zaurus (pdaxrom) Weird Issue
« Reply #4 on: April 26, 2006, 10:07:44 pm »
Hi Deserat,

I just noticed on your original post in the other forums re LAMP that GD was included in the package, however I ran the following code to detect the GD Version and it returned

Detected GD Version: 0

GD was not detected on your server.


Code: [Select]
require('lang/index.php');

$gd_version = gd_version();
echo '

'.$GLOBALS['lang_GD_detect'] . $gd_version . "\n\n

";
if($gd_version != 0)
    echo '

'.$GLOBALS['lang_GD_copy'].'

$gd_version = "' . $gd_version . '";

';
else
    echo "

".$GLOBALS['lang_GD_none']."

";
function gd_version() {
   static $gd_version_number = null;
   if ($gd_version_number === null) {
       ob_start();
       phpinfo(8);
       $module_info = ob_get_contents();
       ob_end_clean();
       if (preg_match("/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i",
               $module_info,$matches)) {
           $gd_version_number = $matches[1];
       } else {
           $gd_version_number = 0;
       }
   }
   return $gd_version_number;
}
?>

appreciate your feedback!

desertrat

  • Hero Member
  • *****
  • Posts: 743
    • View Profile
    • http://
Php/apache Zaurus (pdaxrom) Weird Issue
« Reply #5 on: April 26, 2006, 10:48:53 pm »
Quote
I just noticed on your original post in the other forums re LAMP that GD was included in the package, however I ran the following code to detect the GD Version and it returned

Detected GD Version: 0

GD was not detected on your server.

[...]

appreciate your feedback!
gd and various other extensions have been compiled as dynamically loadable modules. This is to reduce the number of "hard-coded" dependencies. Eg if mysql had been compiled statically into php as opposed to a separate dynamically loadable module then you would be forced to install MySQL whether you need it or not.

Now to answer your question, you can do one of the following:

- add dl('gd.so'); to your code
- edit /usr/local/apache/conf/php.ini and uncomment the line ;extension=gd.so, restart apache


-- cheers
SL-C3100 / Ambicon WL1100C-CF / pdaXrom 1.1.0beta3 / IceWM

Hames007

  • Newbie
  • *
  • Posts: 7
    • View Profile
Php/apache Zaurus (pdaxrom) Weird Issue
« Reply #6 on: April 30, 2006, 03:17:59 pm »
Hi Deserat,

Thanks for all your help so far, am starting to make some progress!

However  Have come across another brick wall I was hoping you could help me out on. PHPInfo shows that GD is installed with support for GIF and PNG, but no JPEG support.

I have revision 6b of libjpeg installed, but how to I enable GD to see/use it?

thanks

hames

Quote
Quote
I just noticed on your original post in the other forums re LAMP that GD was included in the package, however I ran the following code to detect the GD Version and it returned

Detected GD Version: 0

GD was not detected on your server.

[...]

appreciate your feedback!
gd and various other extensions have been compiled as dynamically loadable modules. This is to reduce the number of "hard-coded" dependencies. Eg if mysql had been compiled statically into php as opposed to a separate dynamically loadable module then you would be forced to install MySQL whether you need it or not.

Now to answer your question, you can do one of the following:

- add dl('gd.so'); to your code
- edit /usr/local/apache/conf/php.ini and uncomment the line ;extension=gd.so, restart apache


-- cheers
[div align=\"right\"][a href=\"index.php?act=findpost&pid=124732\"][{POST_SNAPBACK}][/a][/div]

desertrat

  • Hero Member
  • *****
  • Posts: 743
    • View Profile
    • http://
Php/apache Zaurus (pdaxrom) Weird Issue
« Reply #7 on: April 30, 2006, 11:57:14 pm »
Quote
However  Have come across another brick wall I was hoping you could help me out on. PHPInfo shows that GD is installed with support for GIF and PNG, but no JPEG support.

I have revision 6b of libjpeg installed, but how to I enable GD to see/use it?
It needs to be recompiled. I'll see it I can find time to do it sometime this week.

-- cheers
SL-C3100 / Ambicon WL1100C-CF / pdaXrom 1.1.0beta3 / IceWM

Hames007

  • Newbie
  • *
  • Posts: 7
    • View Profile
Php/apache Zaurus (pdaxrom) Weird Issue
« Reply #8 on: May 01, 2006, 07:04:25 pm »
Thankyou so much deserat! would be most appreciated!

Quote
It needs to be recompiled. I'll see it I can find time to do it sometime this week.

-- cheers
[div align=\"right\"][a href=\"index.php?act=findpost&pid=125249\"][{POST_SNAPBACK}][/a][/div]

MarcusKracht

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Php/apache Zaurus (pdaxrom) Weird Issue
« Reply #9 on: December 12, 2006, 09:24:52 am »
I am currently experimenting with Apache. I am using 1.1.0beta1 on a C3100. I am
hitting problems both with native compilation and cross compilation.

The cross compilation ends as follows:

Quote
checking whether setpgrp takes no argument... configure: error: cannot check setpgrp when cross compiling
configure failed for srclib/apr

This problem has been posted earlier by someone else but no reply was
given. Does someone have a working version or can someone tell me
how to get around the issue? Preferrably, I'd like to be able to compile
Apache myself so I can experiment with it.

-- MarcusKracht