HTTP 500 Internal Server Error

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Shak
-


Joined: 02 Jun 2005
Posts: 5

PostPosted: Thu Jun 02, 2005 9:13 pm    Post subject: HTTP 500 Internal Server Error Reply with quote

I've searched through the forum and tried to discover the reason for my problem, but I had no luck.

I'm running this simple php download script:
Code:
<?php
if (ob_get_level() == 0) { ob_start(); }
$u = "file.zip";
$u2 = "folder/file.zip";
$xtype= "application/octet-stream";

       header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
       header ("Content-Type: $xtype");
       header ("Content-Length: " . filesize($u2));
       header ("Content-Disposition: attachment; filename=$u");
         
       flush();
       ob_flush();

   $fd = fopen($u2, "r");
   fpassthru($fd);
   fclose ($fd);
?>


Now this script works fine on apache, a download prompt comes up asking the user to save the file. However, when I tried running this script on Abyss I kept getting a 500 Internal Server Error. When I went to check my logs, I found this in cgi.log:
Code:
CGI: [C:\PHP\php.exe  ]   URI: /test2.php   Broken pipe
CGI: [C:\PHP\php.exe  ]   URI: /test2.php   Broken pipe
CGI: [C:\PHP\php.exe  ]   URI: /test2.php   Broken pipe
CGI: [C:\PHP\php.exe  ]   URI: /test2.php   Broken pipe


The repetitions show the different times I tried the script... I don't know whats causing it. Click here for a live test.

Any help would be really appreciated, im using Abyss on all my servers and I dont want to change on all of them because of this problem.
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Thu Jun 02, 2005 10:59 pm    Post subject: Reply with quote

It works fine for me , all I did was create test.php and put file.zip in a folder
called folder and ran test.php , now I see a download prompt so it works. :-)

Did you even install PHP correctly ? try this!

File_name: info.php
Code:

<?php
phpinfo();
?>


Sincerely , TRUSTpunk
Back to top View user's profile Send private message Visit poster's website
Shak
-


Joined: 02 Jun 2005
Posts: 5

PostPosted: Thu Jun 02, 2005 11:10 pm    Post subject: Reply with quote

Hmm, very odd. I'm sure I installed php correctly... or at least normal php functions work correctly, how can I make sure?

Heres my php info: http://shikamaru.info/info.php

Can you paste me your entire code?

And also, what of all the Broken Pipe errors im getting in my cgi.log?
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Jun 03, 2005 12:00 am    Post subject: Reply with quote

I used the same code you posted , here's some detailed instructions on how to
use this PHP script. I will use Step By Step intructions in order to demonstrate.

Step One:
Save the code at the top in a file called
test.php and put this in your htdocs.

Step Two:
Create a new folder in your htdocs and call it folder.
Put a zip archive file in that folder called file.zip

Step Three:
Run test.php from your browser and you
should see a download show up.

Sincerely , TRUSTpunk
Back to top View user's profile Send private message Visit poster's website
Shak
-


Joined: 02 Jun 2005
Posts: 5

PostPosted: Fri Jun 03, 2005 10:35 am    Post subject: Reply with quote

I tried what you said down to the very last letter, and I get a HTTP 500 error and a "Broken Pipe" error in my cgi.log.

Could you post a link to a live example running on Abyss?
Back to top View user's profile Send private message
Shak
-


Joined: 02 Jun 2005
Posts: 5

PostPosted: Fri Jun 03, 2005 12:33 pm    Post subject: Reply with quote

I just realized what the problem is, it seems to work fine with small files (the max it seems to like is 10mb-15mb), but as soon as I try and output a large file (100-200mb) it gives that HTTP 500 error, hmm, at least we know the problem now, any ideas?
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Jun 03, 2005 1:02 pm    Post subject: Reply with quote

You may need to increase the output_buffering from 4096 to a much higher
number and maybe that will fix it but I have no idea. The file I tested was a
small file so that could be the cause of why you got the Error 500.

Sincerely , TRUSTpunk
Back to top View user's profile Send private message Visit poster's website
Shak
-


Joined: 02 Jun 2005
Posts: 5

PostPosted: Fri Jun 03, 2005 11:10 pm    Post subject: Reply with quote

Yes, im starting to think theres a max amount that can be stored in the buffer... how can I expand on this size? Also output_buffering doesn't exist as a function in php.
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sat Jun 04, 2005 2:17 am    Post subject: Reply with quote

ob_ is output_buffering , you can increase this in your php.ini file which should
be located in C:\Windows or C:\Winnt depending on your Windows OS. LateR!

Sincerely , TRUSTpunk
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group