2.0.4 install problem involving require_once

Please report bugs here!

Moderator: Thorsten

Post Reply
Sumaleth
Posts: 4
Joined: Wed Jan 09, 2008 5:45 am
Contact:

2.0.4 install problem involving require_once

Post by Sumaleth »

We just upgraded our server to PHP5, and I now get this message during the install process:

Code: Select all

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/admin/domains/testing.installatron.com/public_html/phpmyfaqa3/inc/PMF_DB/Mysql.php on line 67

The connection to the database server could not be established.

The error message of the database server:
This happens right after the database/user settings screen.

I tracked the problem down to this line in installer.php:

Code: Select all

    // connect to the database using inc/data.php
    require_once(PMF_ROOT_DIR."/inc/data.php");
The PMF_ROOT_DIR value is correct, and the inc/data.php file has the correct contents, yet it returns from that call with an empty $DB.

If I change it to require() or include(), the install process works correctly.

I did a test of require_once(), and it does work on the server.

What's the cause of this problem?

(I understand that I can install it by manually editing the file, but I'd like to know why the problem exists.)

Thanks,
Rowan.
Thorsten
Posts: 15769
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

do you use an password in data.php?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Sumaleth
Posts: 4
Joined: Wed Jan 09, 2008 5:45 am
Contact:

Post by Sumaleth »

Hi,

This is a sample data.php:

Code: Select all

<?php
$DB["server"] = 'localhost';
$DB["user"] = 'admin_i913php';
$DB["password"] = 'xNurXNipETajs';
$DB["db"] = 'admin_i913php';
$DB["prefix"] = 'faq_';
$DB["type"] = 'mysql';
?>
Rowan.
Thorsten
Posts: 15769
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

is the file data.php readable?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Sumaleth
Posts: 4
Joined: Wed Jan 09, 2008 5:45 am
Contact:

Post by Sumaleth »

Yes, even when the file is CHMOD 777 it still has the problem. And require()/include() are able to use it, it's just require_once() that fails.

Rowan.
Thorsten
Posts: 15769
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

does it work when you change require_once() to require()?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Sumaleth
Posts: 4
Joined: Wed Jan 09, 2008 5:45 am
Contact:

Post by Sumaleth »

Yes, if I change this particular require_once() in install.php--

Code: Select all

// connect to the database using inc/data.php
require_once(PMF_ROOT_DIR."/inc/data.php");
--to either require() or install() then the install script works successfully.

I don't really understand why require_once wouldn't work. The data.php file is only just created by that point, so it can't have been previously included. Very strange.

Rowan.
pmaisonneuve
Posts: 1
Joined: Sat Jan 19, 2008 4:57 am

same error

Post by pmaisonneuve »

I found the exact same situation myself today. (first time ever installing phpmyFAQ).

I made the exact same changes and it installed without a hitch.

Just verifying the previous posts.

Thanks. I think I will enjoy the script. If all goes well, I'll send donation.

Paul
Post Reply