Migration of website... PHP/Mysql -which path for DB.php

 
Thread Tools Search this Thread
Homework and Emergencies Emergency UNIX and Linux Support Migration of website... PHP/Mysql -which path for DB.php
# 1  
Old 05-28-2012
Migration of website... PHP/Mysql -which path for DB.php

Hi,

I have two websites:

website1.com and website2.com

I didn't write either but have successfully moved all the files from website1.com to website2.com

I (thought) I installed all the correct php modules and website2 is mostly up and running. However, my boss found that when we go to a particular page;


Quote:
Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in /home/mywebsiteDirectory/public_html/include/test_place/db_connect.php on line 7

Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mywebsiteDirectory/public_html/include/test_place/db_connect.php on line 7
Okay, so I found where the original DB.php lives and (since I moved ALL the files over) -I made reference to that file. Bad things happened or more explicitly
"DB Error: not found"
Which is strange because the exact same code runs well on website1.com

Anyways, I believe this is a case where the Pear Libraries are in a different location than where the code assumed it to be. One huge hint is that my init.php file has the following string;

Code:
<?php ini_set("include_path", ".:./include:/usr/lib/php"); ?>
<?php
  require_once 'DB/DataObject.php';
  
  $config = parse_ini_file('db/dataobjects.ini',TRUE);
  foreach($config as $class=>$values) {
    $options = &PEAR::getStaticProperty($class,'options');
    $options = $values;
  }
?>

and a general "Find" linux command gives me thus;

Code:
-bash-3.2$ find /home/mywebsiteDirectory -name 'DB.php'
/home/mywebsiteDirectory/php/DB.php
/home/mywebsiteDirectory/php/DB/NestedSet/DB.php
/home/mywebsiteDirectory/public_html/dev2/nps/include/DB/DB.php
/home/mywebsiteDirectory/public_html/prod_backup/nps/include/DB/DB.php
/home/mywebsiteDirectory/public_html/include/DB/DB.php
/home/mywebsiteDirectory/public_html/backup/include/DB/DB.php
/home/mywebsiteDirectory/public_html/dev/nps/include/DB/DB.php
/home/mywebsiteDirectory/public_html/dev_experimental/nps5/nps2/include/DB/DB.php
/home/mywebsiteDirectory/public_html/dev_experimental/nps/trunk/include/DB/DB.php
/home/mywebsiteDirectory/public_html/dev_experimental/nps6/include/DB/DB.php
/home/mywebsiteDirectory/public_html/dev_experimental/gcc/emprise/include/DB/DB.php
/home/mywebsiteDirectory/public_html/dev_experimental/nps3/nps/include/DB/DB.php
-bash-3.2$

is there any other string I should add to my include?
do you need any other information to help/

thanks

---------- Post updated at 08:16 PM ---------- Previous update was at 06:34 PM ----------

I'm still stuck on this. Here is the original code which runs fine on website1

Code:
require_once 'DB.php';

$db_engine = 'mysql';
$db_user = 'mywebsiteDirectory';
$db_pass = '*********';
$db_host = 'localhost';
$db_name = 'mywebsiteDirectory_testlogin';

$datasource = $db_engine.'://'.
              $db_user.':'.
              $db_pass.'@'.
               $db_host.'/'.
                $db_name;


$db_object = DB::connect($datasource, TRUE);
echo $datasource;
/* assign database object in $db_object, 

if the connection fails $db_object will contain

the error message. */

// If $db_object contains an error:

// error and exit.

if(DB::isError($db_object)) {
    die($db_object->getMessage());
}

$db_object->setFetchMode(DB_FETCHMODE_ASSOC);

// we write this later on, ignore for now.

include('check_login2.php');

?>


Last edited by Astrocloud; 05-28-2012 at 07:35 PM.. Reason: forgot thanks and question
# 2  
Old 05-28-2012
Your error message says:

Quote:
Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in /home/mywebsiteDirectory/public_html/include/test_place/db_connect.php on line 7
Please cut and past the contents of this file in your next post, so we can see exactly what is going on in this file.

/home/mywebsiteDirectory/public_html/include/test_place/db_connect.php
This User Gave Thanks to Neo For This Post:
# 3  
Old 05-29-2012
There is an old saying that 90% of all Unix problems are permission problems. Did you check the file systems permissions and ownerships of the file(s) and made sure they match?

Just a suggestion.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 4  
Old 05-29-2012
Quote:
Originally Posted by Neo
Your error message says:



Please cut and past the contents of this file in your next post, so we can see exactly what is going on in this file.

/home/mywebsiteDirectory/public_html/include/test_place/db_connect.php
No problem;

Code:
require_once 'DB.php';

$db_engine = 'mysql';
$db_user = 'mywebsiteDirectory';
$db_pass = '*********';
$db_host = 'localhost';
$db_name = 'mywebsiteDirectory_testlogin';

$datasource = $db_engine.'://'.
              $db_user.':'.
              $db_pass.'@'.
               $db_host.'/'.
                $db_name;


$db_object = DB::connect($datasource, TRUE);
echo $datasource;
/* assign database object in $db_object, 

if the connection fails $db_object will contain

the error message. */

// If $db_object contains an error:

// error and exit.

if(DB::isError($db_object)) {
    die($db_object->getMessage());
}

$db_object->setFetchMode(DB_FETCHMODE_ASSOC);

// we write this later on, ignore for now.

include('check_login2.php');

?>

# 5  
Old 05-29-2012
There is no line numbers in the file above.

Would be good if you could post your code in a way which others can read the line numbers.
# 6  
Old 05-29-2012
Line 7 is;
Code:
require_once 'DB.php';

---------- Post updated at 09:58 AM ---------- Previous update was at 09:54 AM ----------

Code:
1        <?php
2        
3        
4        //require the PEAR::DB classes.
5        
6        
7        require_once 'DB.php';
8        
9        
10        $db_engine = 'mysql';
11        $db_user = 'mywebsiteDirectory'; //use this as a username as well as a websitename
12        
13        $db_pass = '********';
14        $db_host = 'localhost';
15        $db_name = 'mywebsiteDirectory_testlogin';
16        
17        $datasource = $db_engine.'://'.
18          $db_user.':'.
19          $db_pass.'@'.
20          $db_host.'/'.
21          $db_name;
22        
23        
24        $db_object = DB::connect($datasource, TRUE);
25        
26        /* assign database object in $db_object, 
27        
28        if the connection fails $db_object will contain
29        
30        the error message. */
31        
32        // If $db_object contains an error:
33        
34        // error and exit.
35        
36        if(DB::isError($db_object)) {
37        die($db_object->getMessage());
38        ?>

# 7  
Old 05-29-2012
OK, Thanks!

I suggest you replace 'DB.php' with the full path.

What is the full path, BTW?

And what are the permissions for that file (output of ls -la)... ?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Need a tracking PHP Script – “how long people stay on the website?”

I want to know, is there a way to track how long anyone has been logged into website and then insert it up for each time they have logged on. In case, user a logs in for 30 minutes, then later comes back and logs in for an hour, then later comes back and logs in for 50 minutes, Add... (1 Reply)
Discussion started by: AimyThomas
1 Replies

2. Programming

PHP and MySQL

Hello, While I was interpretation the PHP manual on database security the recent past, it said that you should by no means connect to the database as the super user but rather as one more user with more limited options. My question is: How do you generate new users and set access... (2 Replies)
Discussion started by: AimyThomas
2 Replies

3. Web Development

Request to check:PHP website design help

Hi I have a website name www.gentrepid.org I have all the setting scripts for this website in php now as a research part, I am new to this as I havent done that before. I have to make certain changes in the website Include some icons on the left like "Drugs" when user click on it... (0 Replies)
Discussion started by: manigrover
0 Replies

4. Shell Programming and Scripting

Mysql is not connected in php

Hi, The php is not able to connect into my mysql database. But i can able to connect by manually. I think that I have missed some points. Please guild for the same. Thanks, Mani (1 Reply)
Discussion started by: Mani_apr08
1 Replies

5. Programming

MySQL - PHP

Hello every one i have question i want to build DATAbase using PHP as interface i use shell to access to linux . i have in linux psql and SQLplus i'll call all html files that has db tabels from shell directory. what should to do before design php pages. can build the database sql design... (3 Replies)
Discussion started by: Scotch
3 Replies

6. Shell Programming and Scripting

Problem with PHP and MySQL

Okay, I'm new to this PHP and MySQL stuff, so help would be VERY much appreciated. :) On my iMac runnning Panther, it has MySQL and PHP installed. Yet when I view a PHP file from the iMac or another computer at my house, I get the source code. What's wrong? (11 Replies)
Discussion started by: Danny_10
11 Replies

7. UNIX for Dummies Questions & Answers

PHP and MySQL

I want to design a database, using mysql as a backend, and PHP as the frontend, I wanna be able to easily build forms in PHP to communicate with MySQL, is there any programs that will allow this, I really dont want to program all the forms by hand.. thankyou (2 Replies)
Discussion started by: kwalick
2 Replies

8. Shell Programming and Scripting

PHP: problem after login on website

I have a auction website i downloaded and when i log in as the admin, i get the following error whats wrong. the username and password are correct for the log in. Its trying to run another script called admin_catorgies_class.php . thats what i can see in the php script anyway. here the... (5 Replies)
Discussion started by: perleo
5 Replies

9. Cybersecurity

mysql php

with a limited knowledege of php and sql, what is a good and secure way to do passwords running an https server? (1 Reply)
Discussion started by: macdonto
1 Replies
Login or Register to Ask a Question