What can be the reason for this Internal Server error ?

4 posts / 0 new
Last post
#1 Fri, 07/03/2009 - 12:36
Anonymous

What can be the reason for this Internal Server error ?

Hello,

I am trying to run a short script that that reads a csv file into an array.

Here is the script:

PHP Code:

<?php
 

echo "<br> Hello - 1";

$csvArray = file('geoiptext.csv');

echo "<br> Hello - 2";

$data = array();
$i = 0;

echo "<br> Hello - 3";

foreach ($csvArray as $row) {
      
   $cells = str_explode(', ',$row);
   $data[$i]['ip1'] = $cells[0];
   $data[$i]['ip2'] = $cells[1];
   $data[$i]['country'] = $cells[2];

$i++;
  }

echo '<pre>';
print_r($data);
echo '</pre>';
?>

The echoes are there just to track the progress, but at present there is not any

I just get this error:

Quote: Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

I set the chmod to 777 for the directory.

The file it is reading is about 7.5 megabytes.

Any ideas why this is happening ?

Also it suggest looking at logs - which log do you recommend that I look at ? Is that in Webmin ?

Thanks

Fri, 07/03/2009 - 13:10
Davvit

Hello again,

I found a log that told me the server was out of memory.

I divided up my file into 4 chunks and now there is no server problem. :)

Fri, 07/03/2009 - 18:24 (Reply to #2)
Joe
Joe's picture

You could also increase the available memory for PHP apps. If you're using mod_fcgid you'd set it in /home/domain/etc/php.ini, or if using mod_php in the system-wide php.ini (or in httpd.conf using a php_value option for the domain in question).

--

Check out the forum guidelines!

Fri, 07/03/2009 - 13:44
andreychek

Glad to hear you figured it out!

For anyone running into this issue later, problems with Apache and PHP scripts and such would report their errors in $HOME/logs/error_log.

Have a good one,

-Eric

Topic locked