500 Internal Server Error

Status
Not open for further replies.

sonicsshadow

Member
Messages
200
Reaction score
0
Points
16
Code:
        <?php
       if(isset($_POST['Submit']))
       {
           $size = 150; // the thumbnail height
           $filedir = 'pics/'; // the directory for the original image
           $thumbdir = 'pics/'; // the directory for the thumbnail image
           $prefix = 'small_'; // the prefix to be added to the original name
           $maxfile = '2000000';
           $mode = '0666';
           $userfile_name = $_FILES['image']['name'];
           $userfile_tmp = $_FILES['image']['tmp_name'];
           $userfile_size = $_FILES['image']['size'];
           $userfile_type = $_FILES['image']['type'];
           if (isset($_FILES['image']['name'])) 
           {
               $prod_img = $filedir.$userfile_name;
               $prod_img_thumb = $thumbdir.$prefix.$userfile_name;
               move_uploaded_file($userfile_tmp, $prod_img);
               chmod ($prod_img, octdec($mode));
               $sizes = getimagesize($prod_img);
               $aspect_ratio = $sizes[1]/$sizes[0]; 
               if ($sizes[1] <= $size)
               {
                   $new_width = $sizes[0];
                   $new_height = $sizes[1];
              }else{
                  $new_height = $size;
                   $new_width = abs($new_height/$aspect_ratio);
              }
              $destimg=ImageCreateTrueColor($new_width,$new_height)
                   or die('Problem In Creating image');
               $srcimg=ImageCreateFromJPEG($prod_img)
                   or die('Problem In opening Source Image');
               if(function_exists('imagecopyresampled'))
               {
                   imagecopyresampled($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg))
                   or die('Problem In resizing');
               }else{
                   Imagecopyresized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg))
                   or die('Problem In resizing');
               }
               ImageJPEG($destimg,$prod_img_thumb,90)
                   or die('Problem In saving');
               imagedestroy($destimg);
          }
          echo '
           <a href="'.$prod_img.'">
              <img src="'.$prod_img_thumb.'" width="'.$new_width.'" heigt="'.$new_height.'">
           </a>';
       }else{
           echo '
           <form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data">
           <input type="file" name="image"><p>
           <input type="Submit" name="Submit" value="Submit">
           </form>';
       }
       ?>
I'm trying to run this code as a test:
paranoidk.com/test.php
or
zlools.exofire.net/paranoidk.com/test.php

But I keep getting 500 server error. Whenever I run a file of this sort it gives me an error.
Does this mean that I need to upgrade to int php version?
If not, what's wrong :(?
 

Jarryd

Community Advocate
Community Support
Messages
5,534
Reaction score
43
Points
48
For sure, that might not be the exact problem, but if you are going to use PHP at all, it's worth getting the upgrade, because somewhere in your PHP files you will have something that is blocked in the basic, so upgrade, it may take 12 hours or so to upgrade, let us know how it goes.
 

sonicsshadow

Member
Messages
200
Reaction score
0
Points
16
Ok I submitted a request for V2 php. I'll see if that fixes the problem.
In the meantime, anyone see anything else that could cause this?
 

Russ

<b>Retired *****</b>
Messages
3,168
Reaction score
2
Points
38
I don't see anything, however.. log into cPanel, find the Logs section and click on Error logs, see what it has in there.. Most 500 errors will make an entry into that log telling you what caused it.
 

Russ

<b>Retired *****</b>
Messages
3,168
Reaction score
2
Points
38
You need to login to www.x10hosting.com/login under the "PHP Details" Section, apply for the intermediate version of PHP.

Changes take about 24 hours to fully complete. Once this is done, your issues should be solved.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Are you still receiving a 500 error? I do not get one when I attempt to upload files.
 
Last edited:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Alright. If you need further support, please re-open this thread.
 
Status
Not open for further replies.
Top