patchido Posted April 24, 2013 Share Posted April 24, 2013 Hi, i made an application in my local machine, now that i am done im am going to be plalcing the files into a running server. They told me that the php version is 5.2.5 while my server version is 5.4.3. when i tried running my files int the server i got this errors. Warning: include(/includes/footer.php) [function.include]: failed to open stream: No such file or directory inE:\xampplite\htdocs\Mensajeria\index.php on line 12Warning: include() [function.include]: Failed opening '/includes/footer.php' for inclusion (include_path='.;E:\xampplite\php\pear\') in E:\xampplite\htdocs\Mensajeria\index.php on line 12 What is this mistake? I know it is the version becuase i installed 5.2.5 version via wamp and it creates the same error, help plz! ThX!! Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/ Share on other sites More sharing options...
requinix Posted April 24, 2013 Share Posted April 24, 2013 The paths shouldn't have a leading slash. They should always be absolute. If you want something relative to the root web directory (E:\xampplite\htdocs in this case) then use paths like include $_SERVER["DOCUMENT_ROOT"] . "/includes/footer.php"; Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426436 Share on other sites More sharing options...
Q695 Posted April 24, 2013 Share Posted April 24, 2013 That usually means the file isn't there, is it? Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426437 Share on other sites More sharing options...
patchido Posted April 24, 2013 Author Share Posted April 24, 2013 This is my code, i still get the same error. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <? require_once($_SERVER["DOCUMENT_ROOT"] . "/includes/session.php"); ?> <?php require_once($_SERVER["DOCUMENT_ROOT"] . "/includes/connection.php"); ?> <?php require_once($_SERVER["DOCUMENT_ROOT"] . "/includes/functions.php"); ?> <?php if (logged_in()) { redirect_to("index.php"); } include_once($_SERVER["DOCUMENT_ROOT"] . "/includes/form_functions.php"); // START FORM PROCESSING if (isset($_POST['submit'])) { // Form has been submitted. $errors = array(); // perform validations on the form data $required_fields = array('username', 'password'); $errors = array_merge($errors, check_required_fields($required_fields, $_POST)); $fields_with_lengths = array('username' => 30, 'password' => 30); $errors = array_merge($errors, check_max_field_lengths($fields_with_lengths, $_POST)); $username = trim(mysql_prep($_POST['username'])); $password = trim(mysql_prep($_POST['password'])); $hashed_password = sha1($password); if ( empty($errors) ) { // Check database to see if username and the hashed password exist there. $query = "SELECT id, username, region_id, localidad_id,admin "; $query .= "FROM usuarios "; $query .= "WHERE username = '{$username}' "; $query .= "AND hashed_password = '{$hashed_password}' "; $query .= "LIMIT 1"; $result_set = mysql_query($query); confirm_query($result_set); if (mysql_num_rows($result_set) == 1) { // username/password authenticated // and only 1 match $found_user = mysql_fetch_array($result_set); $_SESSION['user_id'] = $found_user['id']; $_SESSION['username'] = $found_user['username']; $_SESSION['region_id'] = $found_user['region_id']; $_SESSION['localidad_id'] = $found_user['localidad_id']; if($found_user['admin']==0) $_SESSION['admin'] = false; else $_SESSION['admin'] = $found_user['admin']; redirect_to("index.php"); } else { // username/password combo was not found in the database $message = "Username/password combination incorrect.<br /> Please make sure your caps lock key is off and try again."; } } else { if (count($errors) == 1) { $message = "There was 1 error in the form."; } else { $message = "There were " . count($errors) . " errors in the form."; } } } else { // Form has not been submitted. if (isset($_GET['logout']) && $_GET['logout'] == 1) { $message = "You are now logged out."; } $username = ""; $password = ""; } ?> <?php include($_SERVER["DOCUMENT_ROOT"] . "/includes/header.php"); ?> <div id="content"> <h2>Inicio de Sesion</h2> <?php if (!empty($message)) {echo "<p class=\"message\">" . $message . "</p>";} ?> <?php if (!empty($errors)) { display_errors($errors); } ?> <form action="login.php" method="post"> <table> <tr> <td>Username:</td> <td><input type="text" name="username" maxlength="30" value="<?php echo htmlentities($username); ?>" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" maxlength="30" value="" /></td> </tr> <tr> <td colspan="2"><input type="submit" name="submit" value="Login" /></td> </tr> </table> </form> </td> </tr> </table> </div> <?php include("/includes/footer.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426454 Share on other sites More sharing options...
patchido Posted April 24, 2013 Author Share Posted April 24, 2013 Fixed it! thx, but now i get this error. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\xampplite\htdocs\Mensajeria\login.php:3) inE:\xampplite\htdocs\Mensajeria\includes\session.php on line 2Warning: Cannot modify header information - headers already sent by (output started at E:\xampplite\htdocs\Mensajeria\login.php:3) in E:\xampplite\htdocs\Mensajeria\includes\functions.php on line 6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <? require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/session.php"); ?> <?php require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/connection.php"); ?> <?php require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/functions.php"); ?> <?php if (logged_in()) { redirect_to("index.php"); } include_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/form_functions.php"); // START FORM PROCESSING if (isset($_POST['submit'])) { // Form has been submitted. $errors = array(); // perform validations on the form data $required_fields = array('username', 'password'); $errors = array_merge($errors, check_required_fields($required_fields, $_POST)); $fields_with_lengths = array('username' => 30, 'password' => 30); $errors = array_merge($errors, check_max_field_lengths($fields_with_lengths, $_POST)); $username = trim(mysql_prep($_POST['username'])); $password = trim(mysql_prep($_POST['password'])); $hashed_password = sha1($password); if ( empty($errors) ) { // Check database to see if username and the hashed password exist there. $query = "SELECT id, username, region_id, localidad_id,admin "; $query .= "FROM usuarios "; $query .= "WHERE username = '{$username}' "; $query .= "AND hashed_password = '{$hashed_password}' "; $query .= "LIMIT 1"; $result_set = mysql_query($query); confirm_query($result_set); if (mysql_num_rows($result_set) == 1) { // username/password authenticated // and only 1 match $found_user = mysql_fetch_array($result_set); $_SESSION['user_id'] = $found_user['id']; $_SESSION['username'] = $found_user['username']; $_SESSION['region_id'] = $found_user['region_id']; $_SESSION['localidad_id'] = $found_user['localidad_id']; if($found_user['admin']==0) $_SESSION['admin'] = false; else $_SESSION['admin'] = $found_user['admin']; redirect_to("index.php"); } else { // username/password combo was not found in the database $message = "Username/password combination incorrect.<br /> Please make sure your caps lock key is off and try again."; } } else { if (count($errors) == 1) { $message = "There was 1 error in the form."; } else { $message = "There were " . count($errors) . " errors in the form."; } } } else { // Form has not been submitted. if (isset($_GET['logout']) && $_GET['logout'] == 1) { $message = "You are now logged out."; } $username = ""; $password = ""; } ?> <?php include($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/header.php"); ?> <div id="content"> <h2>Inicio de Sesion</h2> <?php if (!empty($message)) {echo "<p class=\"message\">" . $message . "</p>";} ?> <?php if (!empty($errors)) { display_errors($errors); } ?> <form action="login.php" method="post"> <table> <tr> <td>Username:</td> <td><input type="text" name="username" maxlength="30" value="<?php echo htmlentities($username); ?>" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" maxlength="30" value="" /></td> </tr> <tr> <td colspan="2"><input type="submit" name="submit" value="Login" /></td> </tr> </table> </form> </td> </tr> </table> </div> <?php include("/includes/footer.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426455 Share on other sites More sharing options...
jcbones Posted April 25, 2013 Share Posted April 25, 2013 EVERYTHING before: <? require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/session.php"); ?> is sent as soon as the server sees it. Which would mean that the server MUST send the headers also. You cannot make any header function calls after ANY output (including BOM's, blank lines, or char's of any kind), because PHP cannot put information into the header of a document after it is sent. Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426464 Share on other sites More sharing options...
patchido Posted April 25, 2013 Author Share Posted April 25, 2013 and what am i sending before?? the doctype? why will it work in later versions? Thx Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426537 Share on other sites More sharing options...
trq Posted April 25, 2013 Share Posted April 25, 2013 Your issues have nothing to do with what versions of php you are using. Your newer version obviously has error reporting set too low, so you are simply not seeing these errors. When you are developing you should have error reporting set so that you can see ALL errors. Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426538 Share on other sites More sharing options...
patchido Posted April 25, 2013 Author Share Posted April 25, 2013 actually my php.ini has this enabled, error_reporting = E_ALL Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426544 Share on other sites More sharing options...
patchido Posted April 25, 2013 Author Share Posted April 25, 2013 I dont know what i am sending before the header, i even commented the doctype and i get this error Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\xampplite\htdocs\Mensajeria\index.php:2) in E:\xampplite\htdocs\Mensajeria\includes\session.php on line 2Warning: Cannot modify header information - headers already sent by (output started at E:\xampplite\htdocs\Mensajeria\index.php:2) in E:\xampplite\htdocs\Mensajeria\includes\functions.php on line 8 <!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">--> <? require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/session.php"); ?> <?php require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/connection.php"); ?> <?php require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/functions.php"); ?> <?php if (logged_in()) { redirect_to("index.php"); } include_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/form_functions.php"); // START FORM PROCESSING if (isset($_POST['submit'])) { // Form has been submitted. Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426623 Share on other sites More sharing options...
mac_gyver Posted April 25, 2013 Share Posted April 25, 2013 a html comment is still content that is being sent to the browser. you must remove all characters being output to the browser that come before the session_start() statement. Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426624 Share on other sites More sharing options...
seandisanti Posted April 25, 2013 Share Posted April 25, 2013 I dont know what i am sending before the header, i even commented the doctype and i get this error Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\xampplite\htdocs\Mensajeria\index.php:2) in E:\xampplite\htdocs\Mensajeria\includes\session.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at E:\xampplite\htdocs\Mensajeria\index.php:2) in E:\xampplite\htdocs\Mensajeria\includes\functions.php on line 8 <!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">--> <? require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/session.php"); ?> <?php require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/connection.php"); ?> <?php require_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/functions.php"); ?> <?php if (logged_in()) { redirect_to("index.php"); } include_once($_SERVER["DOCUMENT_ROOT"] . "/Mensajeria/includes/form_functions.php"); // START FORM PROCESSING if (isset($_POST['submit'])) { // Form has been submitted. even a blank line sent before a header will make it impossible to reset headers, that's one reason that a lot of people are taught to avoid closing their php blocks ?> in files that only contain php, an errant carraige return after a closing tag can be a real pain in the butt to track down. Some use output buffering to get around it, but it's a lazy poor practice. Quote Link to comment https://forums.phpfreaks.com/topic/277274-downgrading-my-php/#findComment-1426667 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.