PHP problem or MySql problem , maybe both?

Discussion in 'Server Operation' started by reddog, Aug 11, 2006.

  1. reddog

    reddog New Member

    I've been trying setup apache, mysql, php, and phpmyadmin on a linux box here at home. I have apache up and running, that one is easy. MySql is also running and has a root user and password set. Php is working as far as i can tell, at least the phpinfo() script says so. phpMyAdmin is working fine as well, and as far as i can tell is connecting to the database. So i loaded up nuke7.5 for testing, installed the sql for 7.5. However when i go to http://mysite.com/index.php, i get the following errors:


    Warning: main(db/mysql.php) [function.main]: failed to open stream: No such file or directory in /srv/www/htdocs/db/db.php on line 53

    Warning: main() [function.include]: Failed opening 'db/mysql.php' for inclusion (include_path='/usr/share/php') in /srv/www/htdocs/db/db.php on line 53

    Fatal error: Cannot instantiate non-existent class: sql_db in /srv/www/htdocs/db/db.php on line 86



    Coincidentally, when i run the phpinfo(). Under the MySql section the following values read like this:


    MySql Includes = "No Value"
    MySql Libs = "No Value"
    MySql_Modules_Type = "None"



    I'm thinking i missed something in one of the config files, and I've gone over it many times. But the errors throw me off, because i don't know diddly about php. So i was hoping one of you gurus could interpret what the errors mean.Thanks in advance for any replies !!

    Here are a few more specs:
    Suse Linux 10.0
    Apache2 - 2.0.54
    MySql - 4.1.13
    PHP4 - 4.4.0
    phpMyAdmin - 2.7.0 -pl2

    btw, here is a copy of db.php
    Code:
    <?php
    /***************************************************************************
     *                                 db.php
     *                            -------------------
     *   begin                : Saturday, Feb 13, 2001
     *   copyright            : (C) 2001 The phpBB Group
     *   email                : [email protected]
     *
     *   $Id: db.php,v 1.10 2002/03/18 13:35:22 psotfx Exp $
     *
     *
     ***************************************************************************/
    
    /***************************************************************************
     *   This file is part of the phpBB2 port to Nuke 6.0 (c) copyright 2002
     *   by Tom Nitzschner ([email protected])
     *   http://bbtonuke.sourceforge.net (or http://www.toms-home.com)
     *
     *   As always, make a backup before messing with anything. All code
     *   release by me is considered sample code only. It may be fully
     *   functual, but you use it at your own risk, if you break it,
     *   you get to fix it too. No waranty is given or implied.
     *
     *   Please post all questions/request about this port on http://bbtonuke.sourceforge.net first,
     *   then on my site. All original header code and copyright messages will be maintained
     *   to give credit where credit is due. If you modify this, the only requirement is
     *   that you also maintain all original copyright messages. All my work is released
     *   under the GNU GENERAL PUBLIC LICENSE. Please see the README for more information.
     *
     ***************************************************************************/
    
    /***************************************************************************
     *
     *   This program is free software; you can redistribute it and/or modify
     *   it under the terms of the GNU General Public License as published by
     *   the Free Software Foundation; either version 2 of the License, or
     *   (at your option) any later version.
     *
     ***************************************************************************/
    
    global $forum_admin;
    if ($forum_admin == 1) {
        $the_include = "../../../db";
    } elseif ($inside_mod == 1) {
        $the_include = "../../db";
    } else {
        $the_include = "db";
    }
    
    switch($dbtype) {
    
    	case 'MySQL':
    		include("".$the_include."/mysql.php");
    		break;
    
    	case 'mysql4':
    		include("".$the_include."/mysql4.php");
    		break;
    
    	case 'postgres':
    		include("".$the_include."/postgres7.php");
    		break;
    
    	case 'mssql':
    		include("".$the_include."/mssql.php");
    		break;
    
    	case 'oracle':
    		include("".$the_include."/oracle.php");
    		break;
    
    	case 'msaccess':
    		include("".$the_include."/msaccess.php");
    		break;
    
    	case 'mssql-odbc':
    		include("".$the_include."/mssql-odbc.php");
    		break;
    	
    	case 'db2':
    		include("".$the_include."/db2.php");
    		break;
    
    }
    
    $db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
    if(!$db->db_connect_id) {
        die("<br><br><center><img src=images/logo.gif><br><br><b>There seems to be a problem with the MySQL server, sorry for the inconvenience.<br><br>We should be back shortly.</center></b>");
    }
    
    ?>
     
    Last edited: Aug 11, 2006
  2. sjau

    sjau Local Meanie Moderator

    does nuke 7.5 make use of PEAR? This sounds very much like a PEAR problem
     
  3. falko

    falko Super Moderator ISPConfig Developer

    You could modify that script so that it shows you the value of $the_include:
    Code:
    global $forum_admin;
    if ($forum_admin == 1) {
        $the_include = "../../../db";
    } elseif ($inside_mod == 1) {
        $the_include = "../../db";
    } else {
        $the_include = "db";
    }
    [B][COLOR="Red"]echo $the_include;[/COLOR][/B]
    
    Then check your installation if all files are where that scripts expects them to be.
     
  4. reddog

    reddog New Member

    hello Falko,

    I added your script to my phpinfo(), however i get the same results.

    do you mean to check the install of php-nuke? if so, the install looks good, everything is where it should be. Also php-nuke loads it's own .htaccess files, do i need to change my apache config to accomodate for those .htaccess?

    this is what httpd.conf contains

    thanks for your help !!
     
  5. falko

    falko Super Moderator ISPConfig Developer

    With the echo statment, you should be able to find out where phpNuke expects the file. Then either copy the files to the location where phpNuke expects them, or change the value of $the_include.

    Maybe.

    That's the wrong section. There must be other <Directory> stanzas, find the one for the directory or one of the parent-directories where phpNuke is installed.

    What's in the .htaccess file?
     
  6. reddog

    reddog New Member

    hello Falko,

    well, i got a lead on what may be the problem. originally i installed apache, php, and mysql through yast, in suse10. I have been told that i need to compile apache with the options: "--with-mysql" as well as "--with-mysqli"

    so im off to give that try.

    thank you for your time and help with my problems !!
     
  7. reddog

    reddog New Member

    just a quick update, and more for anybody else that may have had the same problems i did. I did a clean install of suse10 (the old windows in me) following a portion of perfect setup for suse10, mostly for the os itself and proftpd.

    as for apache2, mysql, php5, and phpmyadmin. All were compiled from source, and after a bit of configuration, it all worked.......woot !!

    dont mean to step on anyones toes, but here is the tut i followed:

    http://laffers.net/howtos/howto-install-mysql
     
  8. Ben

    Ben ISPConfig Developer ISPConfig Developer

    as far as i can remember ./configure --help tells you to either use --with-mysql or --with-mysqli, but not both...
     

Share This Page