PHP - Simplexml_load_file 500 Internal Server Error
Hi guys,
This has been bothering me for quite some time. I have a piece of code that works absolutely fine on my local XAMPP setup but causes a 500 internal server error when I run it on my host (hostgator). $source = "marketplace_feed_v1.xml"; $xml = simplexml_load_file($source,'SimpleXMLElement', LIBXML_NOCDATA); SimpleXML is enabled on hostgator marketplace_feed_v1.xml is located in the same directory as this script I don't understand why this won't work Any help at all is much appreciated. Similar Tutorialstest.php: <?php class Forall{ public $var_a=100; function process(){ echo 'This is for testing'.'<br>'; echo '$var_a: '.$this->var_a.'<br>'; } } $obj=new Forall(); $obj->process(); <form action='post' method='insvideo.php'> videotitle: <input type='text' name='nm_videotitle'/><br> description: <input type='text' name='nm_description' /><br> createddate: <input type='text' name='nm_createddate' /><br> image: <input type='text' name='nm_image' /><br> <input type='submit' /> </form> ?> 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, admin@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. How can i know the line number for error? i tried to access website from a shared network but i keep getting this error. Before this I can access the website through my local host. But since we have started using the shared server.. i cant access most of the websites.. i searched on google they mentioned about php.ini settings. No idea why did my superior changed to iis server.. definitely works on apache before. So I have some php code within an html page (using Apache v2.2, PHP v5.2) that uses MySQLI to connect to a database and fetch some rows from a database. Everything works fine so long as I limit the number of rows fetched, if I try to fetch all the rows, I get a 500 Internal Server Error in my browser. I am using GoDaddy Hosting -- has anyone encountered this problem/know what the hell is going on? Hey guys,
So I making a basic website form to do CRUD operations on a database, and all of my components work, but I keep getting 500 - Internal server error on my index.php
Heres my code:
<?php require_once('config.php'); require_once('menu.php'); echo '<h1>View All Alien Interactions</h1>'; /* Start the table with the fields we want to display Remember $fields is now in config.php */ echo '<table> <tr>'; foreach($fields AS $label){ // th is a table header; the column's title or label. echo "<th>{$label}</th>"; } //Add the edit and delete columns at the end of the table echo '<th>Edit</th><th>Delete</th>'; echo '</tr>'; /* Select the fields we want, from all the rows The first line takes the array keys from our $fields array and implodes them, using backticks and commas. The end result will look like `first_name`, `last_name`, `phone_number`... The next line creates a SELECT query using that string. */ $fields_str = '`contact_id`, `'.implode(array_keys($fields), '`, `').'`'; $sql = "SELECT {$fields_str} FROM `aliens_abduction`"; foreach($dbh->query($sql) as $row) { echo '<tr>'; // Loop through the fields again to display them for this row. // Note: The tutorial originally contained an error here, this has been updated. foreach($fields AS $field=>$value){ // if the field is blank, we want to empty a blank space, otherwise the HTML won't work properly echo '<td>'.(isset($row[$field]) && strlen($row[$field]) ? $row[$field] : ' '.'</td>'); } echo '</tr>'; echo '<td><a href="edit.php?contact_id='.$row['contact_id'].'">Edit</a></td>'; echo '<td><a href="delete.php?contact_id='.$row['contact_id'].'">Delete</a></td>'; echo '</tr>'; echo '</table>'; ?>and heres my config.php code (idk if this is the root of the problem, i dummied out my credentials): <?php //Connect to the database $dbh = new PDO('mysql:host=xxxxxxxxx;dbname=db_demo', 'xxxxx', 'xxxxx'); //Set the default fetch mode to be an associative array. $dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); //Define the fields for our CRUD application $fields = array( 'first_name' => 'First Name', 'last_name' => 'Last Name', 'when_it_happened' => 'When it happened', 'how_many' => 'How many', 'alien_description' => 'Alien description', 'what_they_did' => 'What they did', 'fang_spotted' => 'Fang spotted', 'email' => 'Email' ); ?> Edited by tekkenfan2, 30 June 2014 - 11:56 AM. Whenever I hit submit I get an internal server error. Here is the code:
<?php $modsToBeChecked = str_replace( "\r", "\n", str_replace( "\r\n", "\n", $_POST[ 'modsToBeChecked' ] ) ); $modsToBeChecked = explode( "\n", $modsToBeChecked ); var_dump( $modsToBeChecked );?>$modsToBeChecked is passed in from a textarea form. It is suppose to treat each line in the textbox as one element of the array. Here is the form code in case you need it: <form action=""><textarea name="modsToBeChecked" rows="25" cols="50"></textarea> <input type="submit"> </form> I have no idea why it's doing it. I know I'm missing something, but everything looks right to me. When you submit the registration form it just does the error, and properties say its the process page, so this code below. Sorry posting it all, I'm just not sure period. Code: [Select] <?php require('connect.php'); //check all the posted info function getInfo() { $error = array(); $fname = validateFirstname($_POST['fname']); $lname = validateLastname($_POST['lname']); $uname = validateUsername($_POST['uname']); $email = validateEmail($_POST['email']); $password = validatePass($_POST['password1'], $_POST['password2']); $phone = validatePhone($_POST['phone']); //check for errors error(); } function validateFirstname($str) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[a-zA-Z0-9]{2,}$/',$str)) { return preg_match('/^[a-zA-Z0-9]{2,}$/',$str); } else { $error[] = 'Please enter a valid first name!'; } } function validateLastname($str) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[a-zA-Z0-9]{2,}$/',$str)) { return mysql_real_escape_string($str); } else { $error[] = 'Please enter a valid last name!'; } } function validateUsername($str) { //connect to database $link = mysql_connect($db_host, $db_user, $db_pass); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db($db_name); //pull usernames to make sure new is unique $sql = "SELECT username FROM users WHERE username = '".$str."'"; if ($sql == "") { //This allows just alphanumeric characters and must be 4 - 15 characters. if (preg_match('/^[a-zA-Z0-9]{4,15}$/',$str)) { return mysql_real_escape_string($str); } else { $error[] = 'Please enter a valid user name!'; } } else { $error[] = 'This user name is already registered!'; } } function validateEmail($str) { //connect to database $link = mysql_connect($db_host, $db_user, $db_pass); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db($db_name); //pull usernames to make sure new is unique $sql = "SELECT email FROM users WHERE email = '".$str."'"; if ($sql == "") { if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$str)) { return mysql_real_escape_string($str); }else{ $error[] = 'Please enter a valid email!'; } } else { $error[] = 'This email is already registered!'; } } function validatePass($str, $str2) { //This allows just alphanumeric characters and must be 6-15 characters. if ($str == $str2) { if (preg_match('/^[a-zA-Z0-9]{6,15}$/',$str)) { return md5(mysql_real_escape_string($str)); } else { $error[] = 'Please enter a valid password!'; } } else { $error[] = 'Passwords do not match!'; } } function validatePhone($str) { //This allows just alpha characters and must be at least 2 characters. if (preg_match('/^[0-9]{0,11}$/',$str)) { return mysql_real_escape_string($str); } else { $error[] = 'Please enter a valid phone number!'; } } function error() { if ($error[] == '') { addInfo(); } else { echo "<a href='javascript: history.go(-1)'><-- Go Back</a><br>"; echo $error[]; } } function addInfo() { //setcookie("site_user", $Name, time() + 31536000, "/"); //setcookie("site_pass", $Password, time() + 31536000, "/"); //Connect to database from here $link = mysql_connect($db_host, $db_user, $db_pass); if (!$link) { die('Could not connect: ' . mysql_error()); } //activation link $a = md5(uniqid(rand(), true)); //select the database | Change the name of database from here mysql_select_db($db_name); $sql="INSERT INTO users (firstname,lastname,email,username,password,phone,active,ip,rank,acctcreated) VALUES ('$fname','$lname','$uname',$email','$lastpass','$phone',$a','$ip','$rank',NOW())"; } // Send the email: $message = " To activate your account, please click on this link:\n\n"; $message .= WEBSITE_URL . '/activate.php?email=' . urlencode($Email) . "&key=$activation"; mail($Email, 'Registration Confirmation', $message, 'From:'.EMAIL); // Flush the buffered output. // Finish the page: echo '<div class="success">Thank you for registering! A confirmation email has been sent to ' . $Email .' Please click on the Activation Link to Activate your account </div>'; ?> Hi. I had this form all working, but then I commented out some echo's and changed the name of my custom error variables now all of a sudden when I hit submit without all fields I get an INTERNAL SERVER ERROR PAGE. Code: [Select] Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Apache/1.3.33 Server at www.fusionfashionhair.com Port 80 I don't know what else would have causes this as I had it working yesterday? My code: <?php session_start(); ?> <?php $submit = $_POST['submit']; // Form Data $email = $_POST['email']; $password_old = $_POST['password_old']; $password_new = $_POST['password_new']; $password_new_con = $_POST['password_new_con']; $errorcount = 0; // Edit anything inbetween the " " for the display error message $errormsg['sErrEmail'] = "Email Entered is not in our database"; $errormsg['sErrOldPass'] = "Old Password Entered is Incorrect. Please check your Email"; $errormsg['sErrNewPass'] = "New Password must be between 6 and 32 characters"; $errormsg['sErrNewPassCon'] = "New Passwords do not match."; $errormsg['sErrSecCode'] = "Security Code is Invalid"; $errormsg['sErrdbPass'] = "Invalide Email or activation code. Please Contact <a href='mailto:webmaster@fusionfashionhair.com?subject=Fusion Fashion Hair - Member Activation Error%20Request'>Admin</a>"; $errormsg['NoErr'] = "No Errors, Continue"; $errormsg['PlaceHold'] = ""; $errortrack[] = $errormsg['PlaceHold']; if ($_POST[submit]){ if ($errorstop = "go") { $errorstop="go"; while ($errorstop<>"stop") { //Check for security code if ($_SESSION[key]==$_POST[user_code]){ // echo "True - Continue 0"; // echo "<p>----------</p>"; $_SESSION[key]=''; } else { // echo "False - Stop 0"; $errortrack[] = $errormsg['sErrSecCode']; $errorcount++; $errorstop="stop"; } // check email verification if (!checkEmail($email)) { // echo "False - Stop 1"; $errortrack[] = $errormsg['sErrEmail']; $errorcount++; $errorstop="stop"; } else { // echo "True - Continue 1"; // echo "<p>----------</p>"; } // check for existance if (strlen($password_old)>5) { // echo "True - Continue 2"; // echo "<p>----------</p>"; } else { // echo "False - Stop 2"; $errortrack[] = $errormsg['sErrOldPass']; $errorcount++; $errorstop="stop"; } // check for existance if (strlen($password_new)>32||strlen($password_new)<6) { // echo "False - Stop 3"; $errortrack[] = $errormsg['sErrNewPass']; $errorcount++; $errorstop="stop"; } else { // echo "True - Continue 3"; // echo "<p>----------</p>"; } // check for existance if ($password_new_con==$password_new) { // echo "True - Continue 4"; // echo "<p>----------</p>"; $errorstop="stop";//Get Out of loop } else { // echo "False - Stop 4"; $errortrack[] = $errormsg['sErrNewPassCon']; $errorcount++; $errorstop="stop"; } }//End While Loop // Check database require('dbConfig.php'); // Encrypts old password to check with Database Encryped Password $password_old = md5($password_old); $check = mysql_query("SELECT * FROM {$usertable} WHERE email='$email' AND password='$password_old'"); $checknum = mysql_num_rows($check); if ($checknum==1) { // echo "True - Continue 5 Set password"; // echo "<p>----------</p>"; // Encrypts new password $password = md5($password_new); //run a query to update the account $acti = mysql_query("UPDATE {$usertable} SET password='$password' WHERE email='$email'"); } else { // echo "False - Stop 5"; $errortrack[] = $errormsg['sErrdbPass']; $errorcount++; $errorstop="stop"; }//End if checknum // echo "True - Continue 6 GO TO HEADER PAGE"; // Thank you Page $insertGoTo = "changepass.php"; header(sprintf("Location: %s", $insertGoTo)); //send confirmation email $to = $email; $subject = "Password Changed for Fusion Fashion Hair"; $headers = "From: webmaster@fusionfashionhair.com"; $server = "mail.fusionfashionhair.com"; //change php.ini and set SMTP to $server ini_set("SMTP",$server); $body = " Password Successfuly changed for $email, \n\n Please click on the link provided below to activate the account with Fusion Fashion Hair http://www.fusionfashionhair.com/activate.php?id=$lastid&code=$random \n\n Thank you, Customer Service Contact webmaster for any concerns regarding this email. <a href='mailto:webmaster@fusionfashionhair.com?subject=Fusion Fashion Hair - Password Change Error%20Request'>Admin</a>. "; //function to send email mail($to, $subject, $body, $headers); } else { while($errorcount>=0) { // Test display all error messages // echo "<p>----------</p>"; // echo "<p>Error Count = '$errorcount'</p>"; } $errormsg['MissAll'] = "Please Enter in ALL Fields!"; die ("PLEASE FILL IN ALL FIELDS"); }// End If Error Go }// End if Submit ?> <?php // LINUX PLATFORM OPTION 3 // checkEmail function checks standard email format same as preg_match() // checkEmail function checks DSN records using checkdnsrr Use list() to seperate name and domain using split function // checkdnsrr ONLY WORKS on LINUX PLATFORM // Check to see if domain and username is active // uses fsockopen() to check if its in use using port 25 function checkEmail($email) { // checks proper syntax if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/" , $email)) { // gets domain name list($username,$domain)=split('@',$email); // checks for if MX records in the DNS if(!checkdnsrr($domain, 'MX')) { return false; } return true; } return false; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Fusion Fashion Hair, Loop Hair Extensions Winnipeg, MB </title> <link href="css/thrColLiqHdr.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="css/p7exp.css"/> <link rel="stylesheet" type="text/css" href="css/loginforms.css"/> <!--[if lte IE 7]> <style> .content { margin-right: -1px; } /* this 1px negative margin can be placed on any of the columns in this layout with the same corrective effect. */ ul.nav a { zoom: 1; } /* the zoom property gives IE the hasLayout trigger it needs to correct extra whiltespace between the links */ </style> <![endif]--> </head> <body onLoad="document.getElementById('user_code').focus();"> <body> <div class="container"> <div class="header"><img src="mainlogo3.gif" width="824" height="353" alt="Fusion Fashion Hair" /> </div> <!-- end .header --> <div id="menuwrapper"> <ul id="p7menubar"> <li><a href="#">Home</a></li> <li><a href="#">Products</a></li> <li><a href="#">Shipping</a></li> <li><a href="#">Instructions</a></li> <li id="LastItem"><a href="#">Contact Us</a></li> </ul> </div> <!-- end menuwrapper --> <div class="sidebar1_login"> <h1 class="left">Welcome to Fusion Fashion Hair</h1> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <!-- end .sidebar1 --></div> <div class="content_login"> <p> </p> <div class="divider"><!--Page From Divider Line--> <p> </p> </div> <!--End of Divider--> <p> </p> <form action='newpassform.php' method='post' id="regform"> <fieldset> <legend>Change Password</legend> <p><?php foreach ( $errortrack as $value) { //( $errortrack as $key => $value) echo "<span class='errorcode'>$value</span>";}?> </p> <p> <label for='email'>Email:</label> <input name='email' type='text' maxlength="25" value='<?php echo $email; ?>'/> </p> <p> <label for='password_old'>Old Password:</label> <input name='password_old' type='password' maxlength="32" /> </p> <p> <label for='password_new'>New Password:</label> <input name='password_new' type='password' maxlength="32"/> </p> <p> <label for='password_new_con'>Confirm Password:</label> <input name='password_new_con' type='password' maxlength="32"/> </p> <p><span class="required">*</span> Note, username and password are case sensitive</p> <p>Forgot your password? <a href="forgot_password.php">Click Here</a></p> <p>Login <a href="login.php">Here</a></p> <h2>Security Check</h2> <p>Enter letters below exactly how they are displayed. Letter are case sensitive. </p> <br /> <img src="captcha.class.php?usefile=1" /> <!--OR--> <!--<img src="image.php" />--> <input id='user_code' name='user_code' type='text' size='10' > <p> </p> <input class="reset" type='reset' value='Cancel' name='reset'> <input class="submit" type='submit' value='Continue' name='submit'> </fieldset> </form> <!--End of Form--> <!-- end .content --> </div> <div class="sidebar2_login"> <p> </p> <p> </p> <p> </p> <p> </p> <!-- end .sidebar2 --></div> <div class="footer"> <!-- end .footer --></div> <!-- end .container --></div> </body> </html> I am trying to get this form to submit, but it doesn't go anywhere. I checked the browser console and I see "Failed to load resource: the server responded with a status of 500 (Internal Server Error)". Can someone help me resolve this error?
CODE: <html> <head> <title>PICK 5 :: 13 Ticket System (3 of 5 WHEEL)</title> <style> .wrap{ text-align:center; width:900px; margin: 0 auto; } .row{ margin: 18px 0; } .input{ border:1px solid #ccc; width:800px; float:left; margin:10px; } .output{ width:700px; margin:0 auto; text-align:left; } .output .str{ } .output .number{ font-weight:bold; margin-right:5px; } .clear{ clear:both; } </style> </head> <body bgcolor="#F5F5F5"> <div class="wrap"> <form method="post" action=""> <div class="row"><p><span style="font-weight: bold; color: #0000FF;">PICK 5 :: 13 Ticket System (3 of 5 WHEEL)</span></p> <p>(Guaranteed <span style="font-weight: bold; color: #0080ff;">3-WIN</span>, if 5 of the numbers drawn are in your set of 15 numbers)</p> <label>Please enter 15 numbers and separate them with a comma ","<br></label> <input type="text" name="num" value="<?= isset($_POST['num'])?$_POST['num']:'1,2,3,4,5,6,7,8,9,10,11,12,13,14,15' ?>" /> </div> <div class="row"><input type="submit" name="submit" value="Go" /> </div><br> <?php if(isset($_POST['submit'])){ $num = $_POST['num']; $num_array = explode(',',$num); $alpha_array = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'); $array1 = array(); for($i=0; $i<15; $i++) { $array1[$alpha_array[$i]] = trim($num_array[$i]); } $array2 = array( array('A', 'B', 'C', 'L', 'M'), // Start 15# (3if5 Wheel) - 13 Lines array('A', 'B', 'D', 'H', 'I'), // Where .. (A1, B2, C3, D4, E5, F6, G7, H8, I9, J10, K11, L12, M13, N14, O15) array('A', 'C', 'G', 'H', 'O'), array('A', 'E', 'K', 'N', 'O'), array('A', 'F', 'G', 'J', 'L'), // LINE 5 array('B', 'D', 'F', 'L', 'O'), array('B', 'E', 'F', 'G', 'I'), array('B', 'H', 'J', 'K', 'N'), array('C', 'D', 'E', 'F', 'J'), array('C', 'I', 'K', 'L', 'N'), // LINE 10 array('D', 'G', 'K', 'M', 'N'), array('E', 'F', 'H', 'L', 'M'), array('F', 'I', 'J', 'M', 'O'), // LINE 13 ); $data = ""; foreach($array2 as $arr){ $data1 = ""; foreach($arr as $a){ $data1 .= $array1[$a] . ', '; } $data[] = rtrim($data1,', '); } ?> <div class="output"> <?php foreach($data as $k=>$v){ echo '<span class="number">'.($k+1) . '.</span><span class="str">' . $v . '</span><br>'; } } ?> </div> <div class="clear"></div> </form> </div> </body> </html> Edited February 25, 2019 by requinix please use the Code <> button when posting code. Hello, So I have a weird error where if I fetch more than a certain number of rows from a mysql table, it triggers a 500 Internal Server Error. I am using Apache Web Server (through GoDaddy) and the offending code is below: Code: [Select] set_time_limit(0); $this->Connect(); $Output = array(); $search = "SELECT * FROM <table> WHERE user_id = ?"; if($Statement = $this->MySQLi->prepare($search)){ $Statement->bind_param("i", $UserId); $Statement->execute(); $Statement->bind_result(<result variables>); $count = 0; while($Statement->fetch() && $count++ < 70){ ChromePhp::log(<result variables>); } $Statement->close(); } $this->Disconnect(); ChromePhp::log is a way of dumping things to the Javascript Console in your browser from within a PHP script just as a heads-up. So when I set the stop number as 70, everything is fine. If I try to fetch more than that it triggers a 500 internal server error on Apache Server port 443. I have looked through the error logs and can't figure out the cause but this is almost certainly a server configuration issue? I'd appreciate any feedback, especially anyone familiar with GoDaddy's hosting services Thanks Hello, I am using the Pear Mail and Mail_Mime packages to send SMTP authenticated HTML formatted emails. I was successfully sending emails when I started getting the following error: sendmail: 451 Internal Error I check out the sendmail logs at /var/log/mail.log but that only says the same thing. I am running Linux-Ubuntu and sending emails from an address on a remote server (godaddy hosted). The interesting thing is that this exact same code will run to completion and fail. Any thoughts? Anyone with Pear Mail experience, is there any way to end the SMTP session, maybe that is the problem. I also think an issue might be that the server thinks my IP is sending too many emails, any way to provision against that? Thanks for any insight and please let me know if other information might be helpful to debug this.
Dear all, try{ $excelContent = chr(255).chr(254).@mb_convert_encoding($excelContent, 'UTF-16LE', 'UTF-8'); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } Do you have any idea about this code? I try to catch the error but it's not work Edited June 28 by nitiphone2021That's my first time to see this kind of issue.
The PROD environment: Godaddy, IIS7, PHP5.4.30
The Local environment: Linux, PHP 5.5.X
The framework: CodeIgniter 2.2.0
Process:
I have view have form to update multiple files.
echo form_open_multipart('admin/UploadFiles');The controller will do an initial check, if( isset($_SERVER["CONTENT_LENGTH"]) && ($_SERVER["CONTENT_LENGTH"]>((int)ini_get('post_max_size')*1024*1024))) { $this->session->set_flashdata('upload_error', 'Your file is too big to handle.'); redirect($_SERVER['HTTP_REFERER']); } else { if($_FILES['files']['error'][0] != 0) { $this->session->set_flashdata('upload_error', 'There are no files selected.'); redirect($_SERVER['HTTP_REFERER']); } else { $photo_info = array(); $photo_info = $_FILES['files']; $this->load->model('uploadfile'); $results = $this->uploadfile->UploadImages($photo_info); // My debug echo "<pre>"; print_r($results); echo "</pre>"; // redirect($_SERVER['HTTP_REFERER']); }In my model file, for debug purpose, I only put these lines. Since I have traced the code line one by one, finally found the 500 error happens here. if (!empty($this->CheckFileError($images))) { $results['fail'] = $this->CheckFileError($images); foreach($this->CheckFileError($images) as $err) $error_idx[] = $err['index']; }It happens on empty($this->CheckFileError($images)) //$this->CheckFileError($images) is an arrayIf I just "return $this->CheckFileError($images)", it has no error at all. But If I do the code above, it will give me Internal 500 error. After I change to count($this->CheckFileError($images)) == 0everthing works. All the other logics in the actual model are remain same. I only change this line. It has no problem at all in my local. Only when I run it on my Godaddy IIS share hosting. Initially I thought the temp folder to hold the files is not writable. I even spent whole night to talk to Godaddy guys, but no progress. Even I tried create .user.ini to change the "upload_tmp_dir", it still gave me 500 error. Tonight, I debugged my code lines one by one, tested it in local first, then tested in Godaddy. Finally I found the root cause for my internal 500 error. However, I don't know why empty() will cause this issue. Can anyone explain it? I Googled, but didn't find any userful information. The reason why I use IIS is because I write my most of the services in WCF. Thanks! Edited by TFT2012, 01 October 2014 - 12:33 AM. According to I would like to try to use JWT for my PHP and these are my step
on domain/app/
so I have
and on the login.php try{ echo "1"; require_once('vendor/autoload.php'); use firebase\JWT\JWT; echo "2"; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; }
It's not show any thing and error "HTTP ERROR 500"
According to I have a project need to use PHP 5.6.40 connect to mysql version 5.7.34
when I try to connect it by below coding $servername = "localhost"; $username = "user"; $password = "pass"; $db_database = 'db_unelr'; $db_port = '3306'; // Create connection $conn = mysqli_connect($servername, $username, $password,$db_database,$db_port); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully";
it's show 500 internal error.
This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=351923.0 My first stab at connecting to an API with php. The API takes a url and returns an xml file. When I try this: <?php $apicall = "https://www.graphicmail.com/api.aspx?Username=dyates@salemharvest.org&Password=x&Function=get_newsletters&SID=0"; $xml = simplexml_load_file($apicall); print_r($xml); ?> My local testing server responds with: Warning: simplexml_load_file() [function.simplexml-load-file]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? However, in the php configuration file, php.ini, I have: 'allow_url_fopen = On' which is what the manual says is all you need for https use in most functions that take urls. The url that is $apicall works correctly when just pasted into the browser. When I try the php code on the production server I get no warning (they are turned off) and no output. Any ideas? Hi.
I am trying to fetch xml from a betting website feed. The feed is restricted per IP but I have had the server IP, where the site is located, whitelisted and they have confirmed numerous times that the IP has definitely been whitelisted.
If I try to connect using simplexml_load_file to a BBC xml feed it works fine but to the betting feed I get "failed to open stream: HTTP request failed!"
Is there any way of knowing why it is failing or is there anything else that could prevent it from connecting to that specific feed?
many thanks in advance
Sam
Does the file have to be in the document root? If not, what is the correct syntax to point simplexml_load_file() to a directory on the server that is not the document root? ie what goes between the () this works fine if the .xml file is in my public html root - simplexml_load_file('sample.xml') but when I put the file in a different directory on the server, I can't figure out how to point to it. Help is appreciated. first off I have to make an empty loc.xml file with permissions in order to write contents, I understand the permission idea. secondly, simplexml_load_file does nothing I get it straight from here http://us2.php.net/manual/en/function.simplexml-load-file.php <?php $request='http://z3950.loc.gov:7090/voyager?version=1.1&operation=searchRetrieve&query=dinosaur&startRecord=2&maximumRecords=5'; //echo $request; $filename = dirname(__FILE__)."/loc.xml"; $raw_xml = file_get_contents($request); //echo $raw_xml; $fp = fopen($filename, "w"); fwrite($fp, $raw_xml); fclose ($fp); // The file test.xml contains an XML document with a root element // and at least an element /[root]/title. if (file_exists($filename)) { $xml = simplexml_load_file($filename); print_r($xml); } else { exit('Failed to open loc.xml.'); } ?> Hi all, I have an ajax comment system that is meant to be quite simple! This works fine on localhost, but when on my vps for some reason its throwing a 500 error. I have checked the logs but nothing is mentioned. I am wondering if anyone can throw some light on where to start? Chrome shows this: Request URL:http://www.buy2earn.co.uk/submit.php Request Method:POST Status Code:500 Internal Server Error Request Headers Accept:application/json, text/javascript, */* Content-Type:application/x-www-form-urlencoded Origin:http://www.buy2earn.co.uk Referer:http://www.buy2earn.co.uk/viewm.php?m_id=1 User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 X-Requested-With:XMLHttpRequest Form Data name:admin merchant:1 body:gjgjkgj Response Headers Connection:close Content-Length:0 Content-Type:text/html; charset=UTF-8 Date:Tue, 23 Nov 2010 19:48:22 GMT Server:Apache/2.2.3 (CentOS) X-Powered-By:PHP/5.2.13 submit.php exists at the location shown |