PHP - Sendmail: 451 Internal Error
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. 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? 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? 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.
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 nitiphone2021I 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>'; ?> That'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" 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> 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. 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. 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
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 I am getting an error on a form which sends an email if the form is succesfull. I think there may ne an issue with the sendmail function. I am using a hosting company and not sure if sendmail is something that has to be enabled in the .ini file. Is there any way to check without getting the hosting company involved? I wrote this code and I keep getting Parse error: syntax error, unexpected $end in the last line <?php $subject = 'Registration'; $fname = $_POST['fname']; $lname = $_POST['lname']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $email = $_POST['email']; $mortgage = $_POST['mortgage']; $comments = $_POST['comments']; if($fname == ""){ echo 'Please fill out a First Name'; exit(); }elseif($lname == ""){ echo 'Please fill out a Last Name'; exit(); }elseif($address == ""){ echo 'Please fill out an Address'; exit(); }elseif($city == ""){ echo 'Please fill out a City'; exit(); }elseif($state == ""){ echo 'Please fill out a State'; exit(); }elseif($zip == ""){ echo 'Please fill out your Zip Code'; exit(); }elseif($phone == "") { echo 'Please fill out a Telephone Number'; exit(); }elseif($mortgage == "") { echo 'Please fill out a Mortgage Company'; exit(); }else{ $to = 'amphit@live.com'; $mailfrom = '$email'; $header = "from: $fname $lname <$mail_from>"; $detail = "First name - $fname <br> Last Name - $lname <br> Address - $address <br> City - $city <br> State - $state <br> Zip - $zip <br> Phone - $phone <br> Email - $email <br> Mortgage - $mortgage <br> Comments - $comments"; $send_mail=mail($to,$subject,$detail,$header); if($send_mail){ echo "We've recived your contact information"; } else { echo "ERROR"; } ?> Hi, my webhost has the mail() function disabled. However, my emails are hosted in the offices sever and can't use smtp due to the firewall blocking it. How do I setup sendmail instead of the mail(). I tried googling this but keep coming across to the mail() functions. This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=359470.0 Here is my sendmail.php code: <?php //capture form data in name/value structure //ie. fName = "Pouya" $fNameVar = $_POST['fName']; $lNameVar = $_POST['lName']; $emailVar = $_POST['email']; $commentVar = $_POST['comment']; $telVar = $_POST['tel']; //echo "First Name is {$fNameVar}, last name is {$lNameVar}, email is {$emailVar} and comment is {$commentVar}"; // The e-mail function requires 3 types of info // A. Destination e-mail // B. Subject line // C. Body of your message // D. E-mail of sender mail("puya.turkiyan@gmail.com", "Message from my New Media Sources", $commentVar, "From:$emailVar"); //echo "Thank you $fNameVar" header("Location:thankyou.php"); ?> In the mail section I can only send 2 variables. As soon as I add the third it doesn't even send anything to my e-mail. Please help, its driving me crazy. Here is my table page: <?php include "header.html"; ?> <div id="templatemo_menu"> <ul> <li><a href="index.php">Home</a></li> <li><a href="about.php">About Us</a></li> <li><a href="services.php">Services</a></li> <li><a href="gallery.php">Gallery</a></li> <li><a href="#">Blog</a></li> <li><a href="contact.php" class="current">Contact Us</a></li> </ul> </div> <!-- end of templatemo_menu --> <?php include "socialmedia.html"; ?> <div class="cleaner"></div> </div> <div class="cleaner"></div> </div> <!-- end of header --> </div> <!-- end of header_wrapper --> <div id="templatemo_content_wrapper"> <div id="templatemo_content"> <h1>Contact Information</h1> <p>Here are a few ways to get a hold of us. The best way would be e-mail or phone but you can also use other methods such as <a href="http://www.twitter.com/pehlavoon"><img src="images/twitter-1.png" alt="twitter" width="30" height="30"/> </a> or <a href="http://www.facebook.com/puya.turkiyan"><img src="images/facebook-1.png" alt="facebook" width="30" height="30"/></a> to contact us.</p> <div class="cleaner_h50"></div> <div class="two_column float_l"> <div id="contact_form"> <h2>Contact Form</h2> <fieldset> <legend>Contact me</legend> <form action="sendmail.php" method="post"> <ul> <li><label for="fName">First Name: </label> <input type="text" name="fName" value="" id="fName" /></li> <li><label for="lName">Last Name: </label> <input type="text" name="lName" value="" id="lName" /></li> <li><label for="email">E-mail: </label> <input type="text" name="email" value="" id="email" /></li> <li><label for="tel">Phone number: </label> <input type="text" name="tel" value="" id="tel" /></li> <li><label for="comment">comment: </label> <textarea cols="5" rows="5" name="comment" id="comment"></textarea></li> <li><input type="submit" value="Send" /></li> </ul> </form> </fieldset> </div> </div> <div class="two_column float_r"> <h6>Contact our development team:</h6> Located in Vancouver Canada<br /> <strong>Email:</strong> <a href="mailto:puya.turkiyan@gmail.com">puya.turkiyan@gmail.com</a> <p><strong>Phone:</strong> 1+778-991-7892</p> <div class="cleaner_h60"></div> <h6>Contact our Account manager</h6> Located in Downtown Vancouver Canada<br /> <strong>Email:</strong> <a href="mailto:richardboulier@gmail.com">richardboulier@gmail.com</a> <p><strong>Phone:</strong> 1+778-230-1084</p> </div> <div class="cleaner"></div> </div> <!-- end of content --> </div> <!-- end of content_wrapper --> <?php include "footer.html"; ?> Take a look and see if you can help me. |