PHP - Require_once() Error Prompt Suddenly
Need help urgent.
the website sudden prompt out error below: Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/var/www/vhosts/db2020.co.uk/application/application/config/admin/config.live.php) is not within the allowed path(s): (/var/www/vhosts/db2020.co.uk/subdomains/admin/httpdocs:/tmp) in /var/www/vhosts/db2020.co.uk/subdomains/admin/httpdocs/index.php on line 11 Warning: require_once(/var/www/vhosts/db2020.co.uk/application/application/config/admin/config.live.php) [function.require-once]: failed to open stream: Operation not permitted in /var/www/vhosts/db2020.co.uk/subdomains/admin/httpdocs/index.php on line 11 Fatal error: require_once() [function.require]: Failed opening required '/var/www/vhosts/db2020.co.uk/application/application/config/admin/config.live.php' (include_path='.:') in /var/www/vhosts/db2020.co.uk/subdomains/admin/httpdocs/index.php on line 11 and also after this problem occur, trafic of this domain go overlimit. how can i solve this problem? urgent.... website = https://db2020.co.uk/ thanks. Similar TutorialsI have a page that was working perfectly. I decided to move that page. Once I did that, I changed my require_once statement to reflect that the page had moved. Although the paths seem correct, I am getting this error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '../../../data/MoStopsDEV/ConnectionStrings.php' (include_path='.;C:\Program Files\Jcx.Software\VS.Php\2008\php 5\pear;C:\Program Files\Jcx.Software\VS.Php\2008\') I researched this error but am not able to find anything helpful. Any ideas? My site has been working fine for years but, all of a sudden, is throwing server errors on the pages that call for PHP includes. My provider isn't saying whether there's been an update but the fact that the site has always worked fine and now isn't, well...
So, here's some sample code from a .html page that calls for the TPL file:
<?php include('/home/MyPath/public_html/MySite.com/tpl/footer.tpl'); ?>
A long time ago, I was told to put this in my htaccess file:
AddType application/x-httpd-php5 .html
AddHandler application/x-httpd-php5 .html
If I delete both of these lines from the htaccess file, the site will load without the internal server error but my includes don't work at all. There's just an empty space where the content from the tpl file is supposed to be. I know they installed php 5.4 but my site was automatically put on 5.2 as a default.
I submitted a ticket with my provider and this was the response.
This is the error message as it is being recorded from the server itself when the domain returns a 500 error: [root@provider /home1/MyPath/public_html/mysite.com]# grep mysite.com /usr/local/apache/logs/error_log |tail -6 [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] Cannot load the ionCube PHP Loader - it was built with configuration 2.2.0, whereas running engine is API220100525,NTS, referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] Zend Optimizer requires Zend Engine API version 220060519., referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] The Zend Engine API version 220100525 which is installed, is newer., referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] Contact Zend Technologies at http://www.zend.com/ for a later version of Zend Optimizer., referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] , referer: http://www.mysite.com/ [Sat Sep 20 15:42:16 2014] [error] [client 192.190.1.20] malformed header from script. Bad header=<br />: index.html, referer: http://www.mysite.com/ This will be because there is a mismatch between the php version being called and the php.ini that is being loaded for the domain. Reviewing the mod_rewrite statements that call the various php versions within the direct file path to your domain shows the following: [root@provider /home1/MyPath/public_html/mysite.com]# grep -H -A 3 -B 1 'AddHand' /home1/MyPath/.htaccess /home1/MyPath/public_html/.htaccess /home1/MyPath/public_html/mysite.com/.htaccess /home1/MyPath/.htaccess-# Use PHP52 as default /home1/MyPath/.htaccess:AddHandler application/x-httpd-php52 .php /home1/MyPath/.htaccess-<IfModule mod_suphp.c> /home1/MyPath/.htaccess- suPHP_ConfigPath /opt/php52/lib /home1/MyPath/.htaccess-</IfModule> -- /home1/MyPath/public_html/mysite.com/.htaccess-#AddType application/x-httpd-php5 .html /home1/MyPath/public_html/mysite.com/.htaccess:#AddHandler application/x-httpd-php5 .html /home1/MyPath/public_html/mysite.com/.htaccess- /home1/MyPath/public_html/mysite.com/.htaccess- /home1/MyPath/public_html/mysite.com/.htaccess-## You would need to also declare the suphp for the php.ini to be used and upload a version matching php.ini to that location.I am completely lost as to what this means. I don't even know where to begin. Can someone please help me so I can get my site back to normal? Thank you in advance! As the title above says im trying to use this code: Code: [Select] require_once("http://www.example.com/connect_file.php"); its giving this error: Warning: mysql_query() [function.mysql-query]: Access denied for user 'username'@'localhost' (using password: NO) in /template/header.php on line 56 if i was to just use this code it works fine: Code: [Select] require_once("./connect_file.php"); Just incase it makes a difference, im testing this on index.php, however the codes above are not inside index.php, instead they are inside my /templates/header.php file which is included at the top of index.php any ideas? I was wondering how to get around the security warning that pops up when I add require_once ('includes/prochart.php') to my webpage. I edited my .htaccess file to make all pages https, but when i do this include it isn't considered a secure page so an annoying popup comes up that you have to click no on to load my content. Is there a way around this? Hi, I think I understand this but want to check. If I have files register, user.class and dbconnect. If both register and user.class use require_once dbconnect will the dbconnect still only be required on the first time? Ben im writing php application in windows 7 using apachi . iwant to include php file to another php file. This is the code. test.php ------------- before <?php require_once 'footer.php'; ?> after fotter.php -------------- test 1 ------------------------- test2 when I include the above footer.php into test.php file I got the following result. before <?php require_once 'footer.php'; ?> after Could you please tell me wher i goes woring? I'm writing a rather large script and it appears that I'm running into some require_once problems. So far I only have a few files wrote for my script.. ./includes/objects/database.class.php require_once("../../config.php"); ./test.php require_once("./config.php"); require_once("./includes/objects/database.class.php"); When I try running the test.php I get the following error: Code: [Select] Warning: require_once(../../config.inc.php) [function.require-once]: failed to open stream: No such file or directory in /includes/objects/database.class.php on line 27 Fatal error: require_once() [function.require]: Failed opening required '../../config.inc.php' (include_path='.:/opt/lampp/lib/php') in /includes/objects/database.class.php on line 27 However, when I run the database.class.php by itself it doesn't have any errors at all and it requires (sounds weird.. includes I guess?) the file just fine. I only get the above error from running test.php. I'm running on a local environment using XAMPP so there might be some php configuration option that I'm not aware of. I've tried doing some reading and I'm honestly not sure what could be the problem. Help? I have 4 php files. 1. dbuser.php, declares class dbuser.php, no includes 2. dbobject.php, declares class dbobject.php, includes file 1. 3. casedetails.php, includes files 1 and 2 4. viewcase.php, includes files 1 and 3. When I try to run file 4, i get cannot redeclare class dbuser.php - error Even every require is followed by _once, but I still get "Cannot redeclare class dbuser"-error when running file 4. Full PHP-code below. I tried also putting "if(!class_exists('dbuser')) { ... " around class dbuser declaration but I still got the same error.. Is this a bug in PHP? I'm running version 5.x on apache 2 Thanks! 1. dbuser.php Code: [Select] <?PHP //$time = round(microtime(), 3); session_start(); require_once("settings.php"); //this is just simple array class dbuser { //Constructor function __construct($username=NULL, $password=NULL, $cookies=FALSE) { //Yhdistet��n tietokantaan ja k�ynnistet��n sessio require_once("dbconnect.php"); //Jos ei annettu parametrein� kayttajanimea ja salasanaa if (!isset($username) | !isset($password)) { //Jos salasana ja kayttaja tallennettu SESSION variableen if (isset($_SESSION['user']['email']) && $this->checkFingerprint($_SESSION['user']['fingerprint'])) { $this->logged = TRUE; foreach($_SESSION['user'] as $key => $value) { $this->$key=$value; } //Jos salasana ja kayttaja tallennettu kekseihin } elseif ( isset($_COOKIE['email']) && isset($_COOKIE['password']) ) { $this->logged = ($this->login($_COOKIE['email'], $_COOKIE['password'], FALSE, TRUE)); } //Jos annettu parametrein� knimi ja pwd } else { $this->logged = ($this->login($username, $password, $cookies, FALSE)); } //Costructor loppuu } //Kirjautuu sisaan, ottaa parametreina knimen ja pwd:n sek� tallennetaanko kekseihin, sa sen onko pwd kryptattu valmiiksi public function login($username, $password, $cookies=FALSE, $precrypted=FALSE) { global $settings; if ($precrypted) { $password = mysql_real_escape_string($password); } else { $password = sha1($password); } $username = mysql_real_escape_string($username); //MySQL query $time = time(); $loginQuery = "SELECT * FROM users WHERE email='$username' AND salasana='$password' AND aktiivinen='1' AND (vanhenee>'$time' OR vanhenee='')"; $fprint = $this->createFingerprint(); if($precrypted) { $loginQuery .= " AND fingerprint='$fprint'"; } $result = mysql_query($loginQuery) or trigger_error(mysql_error); $login = mysql_num_rows($result) or trigger_error(mysql_error()); if ($login != 1) { setcookie("email",'',-100000, "/"); setcookie("password",'',-100000, "/"); mysql_close(); session_destroy(); return FALSE; } else { $result = mysql_fetch_assoc($result); foreach ($result as $field => $value) { $this->$field=$value; $_SESSION['user'][$field] = $value; } $update = "UPDATE users SET kirjautunut='" . time() . "' WHERE id='" . $this->id . "'"; mysql_query($update) or trigger_error(mysql_error()); $update = "UPDATE users SET fingerprint='" . $fprint . "' WHERE id='" . $this->id . "'"; mysql_query($update) or trigger_error(mysql_error()); $this->kirjautunut=time(); $_SESSION['user']['kirjautunut'] = time(); if ($cookies) { setcookie("email",$username,($settings['REMEMBER_LOGIN_DURATION'] + time()), "/"); setcookie("password",$password,($settings['REMEMBER_LOGIN_DURATION'] + time()), "/"); } return TRUE; } } public function adduser($values) { if ($this->logged) { $insert = "INSERT INTO users ("; $vals = " VALUES("; $values['salasana'] = sha1($values['salasana']); foreach($values as $key => $value) { $insert .= mysql_real_escape_string($key) . ', '; $vals .= "'" . mysql_real_escape_string($value) . "', "; } $insert = substr($insert, 0, -2); $vals = substr($vals , 0, -2); $insert .= ')'; $vals .= ')'; $insert .= $vals; mysql_query($insert) or trigger_error(mysql_error()); return TRUE; } else { return FALSE; } } public function getusers($where=NULL, $order=NULL, $desc=NULL) { $query = "SELECT * FROM users"; if (isset($where)) { $query .= " WHERE "; foreach($where as $column => $value) { $query .= $column . " = '" . $value . "' AND "; } $query = substr($query, 0 ,-4); } if (isset($order)) { $query .= " ORDER BY " . $order . " "; } if (isset($desc)) { $query .= 'DESC'; } $values = mysql_query($query) or trigger_error(mysql_error()); $counter = 0; while ($row = mysql_fetch_assoc($values)) { foreach ($row as $key => $value) { $return[$counter][$key] = $value; } $counter++; } return $return; } public function update($id, $data) { $insert = "UPDATE users SET "; foreach($data as $key => $value) { $insert .= $key . '='; $insert .= "'" .$value . "', "; } $insert = substr($insert, 0, -2); $insert .= " WHERE id = '" . $id . "'" ; unset($data['id']); mysql_query($insert) or trigger_error(mysql_error()); } public function remove($id) { $rem = "DELETE FROM users WHERE id=$id LIMIT 1"; mysql_query($rem) or trigger_error(mysql_error()); } private function createFingerprint() { $print = "NJIARDL"; $print .= $_SERVER['HTTP_USER_AGENT']; $print .= $_SERVER['REMOTE_ADDR']; return md5($print); } private function checkFingerprint($real) { $print = $this->createFingerprint(); if ($real == $print) { return TRUE; } else { return FALSE; } } // Class dbuser loppuu } 2. dbobject.php Code: [Select] <?PHP //$time = round(microtime(), 3); require_once("dbuser.php"); .... lots of irrelevant code... class dbobject { .... ?> 3. Code: [Select] <?PHP require_once('../PHPcore/dbuser.php'); // this causes the error somehow... $user = new dbuser(); if(!$user->logged) { Header("Location:index.php"); } ... Lots of irrelevant code.. 4. I tried running this file when got the error... Code: [Select] <?PHP session_start(); require_once("PHPcore/dbuser.php"); $user = new dbuser(); if(!$user->logged) { Header("Location:index.php"); } require_once("views/casedetails.php"); Is it possible to set the require_once, so that later in the script PHP does not require_once the file? Code: [Select] $file = $root.'filename.php'; set_require_once($file);//this would be nice require_once($file);//so this does not load Hi,
I hope someone can help. I am fairly new to php and have the following problem that I cannot get a solution for.
We are building a logon system for a website and are receiving the following error.
?>PHP Warning: require_once(classes/Config.php): failed to open stream: No such file or directory in C:\Domains\hellopoker.co.za\wwwroot\test\php\core\init.php on line 22 PHP Fatal error: require_once(): Failed opening required 'classes/Config.php' (include_path='.;C:\php\pear') in C:\Domains\hellopoker.co.za\wwwroot\test\php\core\init.php on line 22
Code for index.php
<?php require_once 'core/init.php'; echo Config::get('mysql/host'); ?> Code for config.php <?php class Config{ public static function get ($path = null){ if ($path){ $config = $GLOBALS['config']; $path = explore('/',$path); foreach($path as $bit){ if(isset($config[$bit])){ echo 'Set'; } } } } } ?> Code for init.php <?php session_start(); $GLOBALS['config'] = array( 'mysql' => array( 'mysql' => 'xxxxxxx', 'username' => 'xxxxxx', 'password' => 'xxxxxxx', 'db' => 'xxxxxxx' ), 'remember' => array( 'cookie_name' => 'hash', 'cookie_expiry' => 604800 ), 'session' => array( 'session_name' => 'user' ) ); spl_autoload_register(function($class) { require_once 'classes/' . $class . '.php'; }); ?> ?> Any help will be greatly be appreciated. Greetings all! I've been working on a project for about a week now and everything had been going fine until this evening. I'm querying a single row from a user information table based on the userID and doing various things based off of the information that is returned. For whatever reason, the query is not returning all of the information anymore. Code follows: Code: [Select] $userToEdit = mysqli_real_escape_string($GLOBALS['link'], $_POST['userToEdit']); $userSQL = "SELECT fName, lName, email, volunteer, staff, admin, active, volunteerID FROM userinfo WHERE userID=" . $userToEdit; $result = mysqli_query($GLOBALS['link'], $userSQL); if (!$result) { $message = 'There was an error retrieving the user information from the database.'; include '../html/error.html.php'; exit(); } $editInfo = mysqli_fetch_assoc($result); The strange part is that the database i'm querying is located on my remote host(GoDaddy). When I run the app from my local Apache server and query the remote DB, everything works fine, however, when I upload the files to my host, not all of the information is being returned. For example, using the print_r() function while on my local host, i get: Code: [Select] Array ( [fName] => Taylor [lName] => Hughes [email] => taylor@gmail.com [volunteer] => 1 [staff] => 0 [admin] => 0 [active] => 1 [volunteerID] => 13 ) But when I execute the app on my remote host, the print_r() function outputs: Code: [Select] Array ( [fName] => Taylor [lName] => Hughes [email] => taylor@gmail.com [volunteer] => [staff] => [admin] => [active] => [volunteerID] => 13 ) I'm not sure why this is happening but it is affecting multiple queries and subsequently multiple forms and functionality in different parts of the application. Any thoughts or suggestions would be greatly appreciated. I've browsed around for about an hour with no luck. I'm writing in PHP 5.3 and the remote MySQL DB is version 5.0 Oh! And if it helps, I just came to the realization that all the items not being returned are of the BIT data type in the tables. Hello Everyone So i have this script that pulls some stuff out of a db and displays it. Pretty basic. It used to work fine but now it omits one entry from the table. It always shows one less than its supposed to. I.E. if there are 4 table entries, it only shows 3. It didnt do this before and I'm not sure why it changed. I didnt edit the code at all. Here it is: Code: [Select] else{ $sql = "SELECT * FROM article WHERE lang='" . $validlang ."' AND cat_id=" . $validentry . " ORDER BY id DESC LIMIT 5"; $result = mysql_query($sql); if(!$result){ echo "Error querying the database." . mysql_error(); exit; } else{ $row = mysql_fetch_assoc($result); } if(!$row){ echo "Error: No articles found." . mysql_error(); exit; } else{ echo "<div id='section'>Organization News</div>"; while($row = mysql_fetch_assoc($result)){ echo "<h3><a href='" . $validlang . "/" . $row['location'] . "'>" . $row['title'] . "</a></h3>"; echo "<div id='subtitle'>" . $row['summary'] . "</div>"; } } } Any help would be appreciated. Thanks We have a php application that is just a form, that takes in data to a mysql database and then displays that data in queue(php web page) for the client. It has been working for the past 5 or more years. Six weeks ago, the client noticed that the numbering started skipping a number each time a request was entered. It then seemed to stop, now it has started again. See attached image. Some detail he after user has completed web form and hits submit, three fields are populated in the mysql "REQUEST" table, then the actually data from the submitted web form is sent to the ANSWER table. The REQUEST table is in sync and is always populated, and numbering is in sequence but upon submit, the actual data from the request does NOT always go to the ANSWER table hence the "skipping of numbers." What do I even begin looking at/for to determine what happened? Reminder: this is a 5+ year old app that worked fine until maybe 6 weeks ago. No changes have been made to the database or the code base since 2008. The code that adds the data to the ANSWER table [the one that appears to skip] is below. The applicate is in php 4.3.1, mysql 5, linux server. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=330724.0 Hey guys, I have come across what I think is one of the craziest bugs I have ever seen. I'm developing a site on my local machine using WAMP (version 2.2). I have a pretty standard database connection class but for some reason all of a sudden tonight it's stopped working. The code: Code: [Select] if(!defined("IN_PHPBB")) { exit; } require 'config.php'; class db_conn { public $connection = NULL; function db_conn() { global $abchost, $abcname, $abcpasswd, $abcuser; if(!$this->connection = mysql_connect($abchost, $abcuser, $abcpasswd)) { echo "Error connecting to the database. Please check the config file."; if(defined('DEBUG')) { echo "<br />MySQL Error: " . mysql_error(); } exit; } if(!mysql_select_db($abcname, $this->connection)) { echo "Error selecting the database. Please check the config file."; if(defined('DEBUG')) { echo "<br />MySQL Error: " . mysql_error(); } exit; } } } $db_conn = new db_conn; Config.php contains nothing but the four variables for connecting to the db. Nothing has changed across either file but for some reason if I try to echo out the variables in the function they are all empty. Even stranger, the first part of the connection works (with 3 empty variables!), and it's mysql_select_db that's throwing an error. Why, completely out of the blue, with nothing changing, would the function not be able to read the variables any more. If I manually copy and paste the variables from the config file into the class function then it connects fine. err, dunno if i managed to put it in the right thread but if i didn't, please tell me. thank you.
getting back on topic, my father asked me to create a website for a school. i know how to make a website but the problem is, how do i start? should i ask about their objectives or something? color of the webpage etc? in short, i don't know the practicalities and processes used in making a website for a certain client. you could say this would be my first time in doing this (kind of like an on-the-job training) so...any ideas? i would very much appreciate any help given.
I've been pulling my hair out for the past couple of hours working with simplexml_load_file(). I was attempting to consume a web service generated by asp.net that I've been consuming using CURL and a function to remove the BOM (byte order marker) so that I could load it into simplexml_load_string(). When I switched over to simplexml_load_file() to call the file instead of using CURL and my function, I was getting errors that it could not find the beginning '<' and that the document was empty and so on.. I couldn't find anything about simplexml_load_file() handling BOM characters, so I went for a walk. I came back to my desk and refreshed the page.. and it just started working. I changed nothing! Guess I should be happy that it started working, but I'd sure like to know why it was breaking in the first place, and then why it would suddenly start working without me doing anything. Has anyone else seen anything like this? I'm trying to make a simple website where people register to my website. When the user doesn't fill anything inside the boxes they get a message "Please fill all required fields" on the register.php page On my local host require_once works good. It shows up.
But when i upload the files to my sever the require_once does not show up on the register.php It just refreshes and i dont get the message "Please fill all required fields"
This is the code that works in local host but not in a live server <?php require_once 'messages.php'; ?>
Here is my full code
Register page: <html> <?php require_once 'messages.php'; ?> <br><br> <form action="register-clicked.php" method="POST"> Username:<br> <input type="text" name="usernamebox" placeholder="Enter Username Here"> <br><br> Email:<br> <input type="text" name="emailbox" placeholder="Enter email here"> <br><br> Password:<br> <input type="password" name="passwordbox" placeholder="Enter password here"> <br><br> Confirm Password:<br> <input type="password" name="passwordconfirmbox" placeholder="Re-enter password here"> <br><br> <input type="submit" name="submitbox" value="Press to submit"> <br><br> </form> </html>
Register clicked <?php session_start(); $data = $_POST; if( empty($data['usernamebox']) || empty($data['emailbox']) || empty($data['passwordbox']) || empty($data['passwordconfirmbox'])) { $_SESSION['messages'][] = 'Please fill all required fields'; header('Location: register.php'); exit; } if ($data['passwordbox'] !== $data['passwordconfirmbox']) { $_SESSION['messages'][] = 'Passwords do not match'; header('Location: register.php'); exit; } $dsn = 'mysql:dbname=mydatabase;host=localhost'; $dbUser='myuser'; $dbPassword= 'password'; try{ $connection = new PDO($dsn, $dbUser, $dbPassword); } catch (PDOException $exception){ $_SESSION['messages'][] = 'Connection failed: ' . $exception->getMessage(); header('Location: register.php'); exit; }
messages.php <?php session_start(); if (empty($_SESSION['messages'])){ return; } $messages = $_SESSION['messages']; unset($_SESSION['messages']); ?> <ul> <?php foreach ($messages as $message): ?> <li><?php echo $message; ?></li> <?php endforeach; ?> </ul> Edited Wednesday at 12:49 AM by bee65 I need to process a CSV file in database (MySql using LOAD DATA INFILE)), while the code is working fine but it works only with file that is already on my apache server (where php is installed). Is there any way (Java/Ajax or anything) that I can prompt user to select a file from any loaction they prefer including there desktop?? Thanks in advance!! I have a PHP script with no HTML in it. The script runs through and updates a bunch of fields in our Active Directory LDAP accounts. Well, I don't want it to just update every account automatically. I want it to prompt me for for each user. Ex. "Would you like to update John Doe's position to Director?" "Yes/No" I'm guessing I'll have to use Javascript for this. But I don't want to add any HTML/JS if possible. But I'm guessing this isn't possible without adding some. Thanks Mike |