I tried to install GMap on Drupal 5.1. When I try to configure it, it gives me a internal server error.

CommentFileSizeAuthor
#4 cast_arrays.patch1.75 KBowen barton
#3 httpd.conf_.txt18.23 KBxl-network

Comments

michaelfavia’s picture

If you dont provide more information it is nearly impossible to help you. Please put in at least as much time as youd like someone else to.

xl-network’s picture

What would you like to know? I can tell you this: I'ts a clean 5.1 install with only the GMap module installed. My site is hosted at one.com, and on my localhost it also does'nt run. It does'nt give me a error (on my own computer) but the page keeps loading (on my webhost the error appears). If you'd like I can attach my httpd.conf or a error file. btw. I hav'nt found anything in the error file, but then again I am no hard-core PHP programmer.

xl-network’s picture

StatusFileSize
new18.23 KB

Some more information. I tried it on another computer (XP, no clean 5.1 install though, but I disabled most contrib. modules). Same result but now I get the typical XP 'your-program-has-crashed' screen for Apache. So it look's like Apache crashed. I use the default 2.2 installation with this piece added to the end of my httpd.conf

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "c:/programs/php/"
LoadModule php5_module "c:/programs/php/php5apache2_2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

Hope this helps...

Btw. I attached the httpd.conf from my 3rd machine, the one I described in this post.

owen barton’s picture

Title: GMap and Drupal 5.1 = 500 error » GMap and PHP 5 = 500 error
Category: support » bug
Priority: Normal » Critical
Status: Active » Reviewed & tested by the community
StatusFileSize
new1.75 KB

I had the same problem - which needed quite a bit of bug searching to figure out (Apache 500 errors are not exactly helpful!).

I tracked this down to PHP 5 (it works fine in PHP 4), and then to some lines that were array_merging variables without first casting them to arrays (PHP 5 is stricter in this regard - PHP 4 would just automatically cast to the array type).

I am not quite sure why it was crashing PHP (as the logs indicated), possibly some unintended infinite recursion.

Anyway, here is a patch that fixes this for the cases I could find. I haven't tested much other functionality yet, so there could be other PHP 5 issues lurking - but this is enough to at least get the map on the settings page working cleanly.

stella’s picture

I have the same issue every time I visit the Node Locations or User Locations pages. I downloaded everything from CVS yesterday with the DRUPAL-5 tag. I have the following location modules installed - Location, Location Views, GMap, GMap Macro Builder, GMap Views Integration and KML. I also found the following errors in my /var/log/messages file. The first error happened when I visited node locations, the 2nd for user locations.

Feb 15 14:35:11 arithon kernel: [7944956.296685] php-cgi[5805] general protection rip:55f401 rsp:7fffff8abf80 error:0
Feb 15 14:35:22 arithon kernel: [7944967.149824] php-cgi[5807] general protection rip:55f401 rsp:7fffff8ab1c0 error:0

I also found the following errors in my webserver error logfile for each time I got the 500 Internal Server Error

2007-02-15 14:35:22: (mod_fastcgi.c.2430) unexpected end-of-file (perhaps the fastcgi process died): pid: 5801 socket: unix:/tmp/php-fastcgi.socket-3
2007-02-15 14:35:22: (mod_fastcgi.c.3215) response not received, request sent: 1045 on socket: unix:/tmp/php-fastcgi.socket-3 for /index.php , closing connection

By the way, this is a new test site so I have no users or nodes with locative information yet.

Cheers,
Stella

owen barton’s picture

Hi snpower,

These are the exact same errors I had. I have successfully viewed both user and node maps since applying this patch.

Could you try the above patch and let me know if you still have these errors?

Thanks!

stella’s picture

Yep that worked for me. Thanks.

Stella

xl-network’s picture

It (applying the patch) still does'nt work for me. I tried it on 2 different PC's (pretty much the same configuration)

PS. I don't know how to apply a patch, so I changed the lines manualy.

I'm using (on Windows XP):

Drupal	5.1
Configuration file	Protected
Cron maintenance tasks	Last run 1 min 15 sec ago
You can run cron manually.
Database schema	Up to date
File system	Writable (public download method)
GD library	bundled (2.0.28 compatible)
MySQL database	5.0.17
PHP	5.2.0
Unicode library	PHP Mbstring Extension
Web server	Apache/2.0.55 (Win32) PHP/5.2.0
bdragon’s picture

I committed some changes that should hopefully fix this. http://drupal.org/cvs?commit=56794 is the commit number.

xl-network’s picture

Nope... still does'nt work. Btw. I get this error in the error.log (along with a 'your program has crashed' (Apache), typical windows screen).

[Sat Feb 17 13:14:49 2007] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sat Feb 17 13:14:50 2007] [notice] Apache/2.2.3 (Win32) PHP/5.2.0 configured -- resuming normal operations
[Sat Feb 17 13:14:50 2007] [notice] Server built: Jul 27 2006 16:49:49
[Sat Feb 17 13:14:50 2007] [notice] Parent: Created child process 5652
[Sat Feb 17 13:14:50 2007] [notice] Child 5652: Child process is running
[Sat Feb 17 13:14:50 2007] [notice] Child 5652: Acquired the start mutex.
[Sat Feb 17 13:14:50 2007] [notice] Child 5652: Starting 250 worker threads.
[Sat Feb 17 13:14:50 2007] [notice] Child 5652: Starting thread to listen on port 80.
[Sat Feb 17 13:14:59 2007] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sat Feb 17 13:15:00 2007] [notice] Apache/2.2.3 (Win32) PHP/5.2.0 configured -- resuming normal operations
[Sat Feb 17 13:15:00 2007] [notice] Server built: Jul 27 2006 16:49:49
[Sat Feb 17 13:15:00 2007] [notice] Parent: Created child process 4908
[Sat Feb 17 13:15:00 2007] [notice] Child 4908: Child process is running
[Sat Feb 17 13:15:00 2007] [notice] Child 4908: Acquired the start mutex.
[Sat Feb 17 13:15:00 2007] [notice] Child 4908: Starting 250 worker threads.
[Sat Feb 17 13:15:00 2007] [notice] Child 4908: Starting thread to listen on port 80.
[Sat Feb 17 13:15:14 2007] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sat Feb 17 13:15:14 2007] [notice] Apache/2.2.3 (Win32) PHP/5.2.0 configured -- resuming normal operations
[Sat Feb 17 13:15:14 2007] [notice] Server built: Jul 27 2006 16:49:49
[Sat Feb 17 13:15:14 2007] [notice] Parent: Created child process 5588
[Sat Feb 17 13:15:14 2007] [notice] Child 5588: Child process is running
[Sat Feb 17 13:15:14 2007] [notice] Child 5588: Acquired the start mutex.
[Sat Feb 17 13:15:14 2007] [notice] Child 5588: Starting 250 worker threads.
[Sat Feb 17 13:15:14 2007] [notice] Child 5588: Starting thread to listen on port 80.
bdragon’s picture

Title: GMap and PHP 5 = 500 error » [master] GMap and PHP 5 = 500 error
Assigned: Unassigned » bdragon

Marking as master issue for "settings page crashes PHP5."

Duplicates marked:
http://drupal.org/node/119931
http://drupal.org/node/120012

stella’s picture

Just fyi, the latest version from CVS fixes this problem and issue http://drupal.org/node/118816 for me. I'm running lighttpd/1.4.11, php 5.1.2 and mysql 5.0.22 on ubuntu.

owen barton’s picture

Status: Reviewed & tested by the community » Fixed

Latest CVS fixes this for me - thanks!
Marking closed - we can reopen if further issues are found.

mcreature’s picture

I am still getting a PHP 500 error when clicking on admin/settings/gmap
This is with a fresh install of gmap 5x1 dev from feb 20th also fresh install of drupal 5.1

mcreature’s picture

oops forgot my server info, here it is ...
MySQL database 5.0.27
PHP 5.2.0

mcreature’s picture

Status: Fixed » Active

setting this back to active

xl-network’s picture

Still does'nt work for me (tested on 2 of my computers and my hosting company). I want to help fix this issue, so tell my what I should test/try etc.

owen barton’s picture

I can't reproduce this problem (I have PHP 5.1.6).

The easiest way to fix crashes is with an interactive debugger, such and GDB or Xdebug. If that is too hard to set up/use, then an alternative is to go through the code for the settings page & form, putting print "1"; print "2"; etc at various intervals (and turn PHP output buffering off), and see where it counts up to before it crashes, to isolate the line that is the problem. You can also do a similar thing be successively commenting out blocks of code, until it starts working again, and then uncomment the in the same order until it breaks, rinse and repeat until you find the problem line.

Alternatively, a good read through the code looking for places where arrays aren't being initialized might turn up something too.

stella’s picture

It might be a php 5.2 related issue, since the solutions seems to only have worked for people with 5.1.x installed so far.

Stella

xl-network’s picture

Could be... all my machines (including my webhost) are running 5.2.x

My webhost 'status settings'.

Drupal	5.1
Configuration file	Protected
Cron maintenance tasks	Last run 33 min 3 sec ago
You can run cron manually.
Database schema	Up to date
File system	Writable (public download method)
GD library	bundled (2.0.28 compatible)
MySQL database	4.0.24_Debian
PHP	5.2.1
Unicode library	PHP Mbstring Extension
Web server	Apache
Unable to determine your web server type and version. Drupal might not work properly.
evave’s picture

I could replicate this issue with PHP 5.1.6 and the problem is within following block of code in gmap_settings_ui.inc.

$form['markermanager']['gmap_mm_type'] = array(
'#type' => 'radios',
'#parents' => array(),
'#options' => array(
'gmap_marker.js' => t('No manager (use addOverlay directly)'),
'gmarkermanager_marker.js' => t("Google's GMarkerManager"),
'clusterer_marker.js' => t("Jef Poskanzer's Clusterer"),
),
//'#default_value' => variable_get('g
'#description' => t('If you are planning on using many markers on a single map, you may want to consider using a marker manager to speed up map rendering.'),
);

Rgds

stella’s picture

if you remove the line that's commented out does it improve things? maybe php isn't handling that line correctly... there is one open ( but no closing. I know it shouldn't care about it since it's commented out, but I can't see anything else vaguely dodgy with that code.

Stella

owen barton’s picture

The problem is almost certainly with the #options element. This is a FAPI custom form widget field for gmap, and is handled by this function:

/**
* Implementation of hook_elements().
*/
function gmap_elements() {
return array(
'gmap' => array(
'#input' => FALSE, // This isn't a *form* input!!
'#settings' => array_merge(gmap_defaults(),array(
'points' => array(),
'pointsOverlays' => array(),
'lines' => array(),
)),
'#process' => array('expand_gmap' => array()),
),
'gmap_macrotext' => array(
'#input' => TRUE,
'#cols' => 60,
'#rows' => 5,
'#process' => array(
'process_gmap_control' => array('textarea','macrotext')
),
),
'gmap_overlay_edit' => array('#input' => FALSE, '#process' => array('process_gmap_overlay_edit' => array())),
'gmap_address' => array('#input' => FALSE, '#process' => array('process_gmap_address' => array())),
'gmap_align' => array('#input' => TRUE, '#process' => array('process_gmap_align' => array())),
'gmap_latitude' => array('#input' => TRUE, '#process' => array('process_gmap_control' => array('textfield','latitude','gmap_coord'))),
'gmap_longitude' => array('#input' => TRUE, '#process' => array('process_gmap_control' => array('textfield','longitude','gmap_coord'))),
'gmap_latlon' => array('#input' => TRUE, '#process' => array('process_gmap_control' => array('textfield','latlon','gmap_coord'))),
'gmap_markerchooser' => array('#input' => TRUE, '#process' => array('process_gmap_markerchooser' => array())),
);
}

This then hands control, (via the callbacks) to process_gmap_control():

/**
* Generic gmap control processor
*/
function process_gmap_control($element,$edit,$fieldtype,$control,$theme='') {
$element['#type'] = $fieldtype;
gmap_widget_setup($element, $control);
if (!empty($theme)) {
$element['#theme'] = $theme;
}
else {
$element['#theme'] = 'gmap_'.$control;
}
return $element;
}

If you can isolate the issue further within these functions, that would be a big help!

evave’s picture

the comment in the code is OK, the same problem without it.

Commenting out the functions you've suggested doesn't help. And the problem is certainly in the following lines (commenting them Apache doesn't crash):

// 'gmap_marker.js' => t('No manager (use addOverlay directly)'),
// 'gmarkermanager_marker.js' => t("Google's GMarkerManager"),
// 'clusterer_marker.js' => t("Jef Poskanzer's Clusterer"),

xl-network’s picture

Me to... if I comment them out it works... well at least it does'nt give me a error.

xl-network’s picture

I think I have solved it... (just comment '#parents' => array(), out). Can anyone confirm this?

  $form['markermanager']['gmap_mm_type'] = array(
    '#type' => 'radios',
//    '#parents' => array(),
    '#options' => array(
      'gmap_marker.js' => t('No manager (use addOverlay directly)'),
      'gmarkermanager_marker.js' => t("Google's GMarkerManager"),
      'clusterer_marker.js' => t("Jef Poskanzer's Clusterer"),
    ),
    //'#default_value' => variable_get('g
    '#description' => t('If you are planning on using many markers on a single map, you may want to consider using a marker manager to speed up map rendering.'),
  );
bdragon’s picture

Wait a second...
Why the heck did I write that like that? There's no way that code works. The correct solution is to explicitly set #tree to FALSE.

I just committed a fix for gmap_mm_type so it no longer pretends it's a form element with NULL for the key. Sheesh, no wonder PHP was crashing...

Anonymous’s picture

The new dev version now no longer crashes on a windows test machine running Apache 2.2.3 and PHP 5.2.0. Great work. Thanks.

bdragon’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)