PDA

View Full Version : Install did not work


dplatt
01-20-2004, 01:08 PM
Installed and configured phpdig, but am getting the following error from the phpdigdir/search.php page:

Parse error: parse error, unexpected T_STRING in /<dir>/includes/connect.php on line 22

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /<dir>/libs/mysql_functions.php on line 38
Unable to check table. Check connection parameters

----------
I was receiving the previous error message on the same page:

Table engine missing. Table excludes missing. Table keywords missing. Table sites missing. Table spider missing. Table tempspider missing. Table logs missing.

I fixed this by looking up a thread here from someone with the same problem. I changed the following from connect.php:

define('PHPDIG_DB_PREFIX','<dbprefix>');

to:
define('PHPDIG_DB_PREFIX',");

However, this fix created the problem listed at the top.
Any help would be suggested and I'll be glad to provide more information if it will help you.

-David

Charter
01-20-2004, 03:02 PM
Hi. Check that the database tables exist and that the information in the connect.php file matches that for the database.

dplatt
02-04-2004, 12:09 PM
Here is what I pulled from mysql:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 872 to server version: 3.23.54

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SHOW TABLES;
+------------------+
| Tables_in_phpdig |
+------------------+
| engine |
| excludes |
| keywords |
| logs |
| sites |
| spider |
| tempspider |
+------------------+
7 rows in set (0.01 sec)

mysql>

Here is what I have in:
/phpdigdir/includes/connect.php

<?php
/*
--------------------------------------------------------------------------------

PhpDig Version 1.6.x
This program is provided under the GNU/GPL license.
See the LICENSE file for more information.
All contributors are listed in the CREDITS file provided with this package.
PhpDig Website : http://www.phpdig.net/
--------------------------------------------------------------------------------

*/

// Connection configuration
define('PHPDIG_DB_PREFIX',");
define('PHPDIG_DB_HOST','localhost');
define('PHPDIG_DB_USER','*****');
define('PHPDIG_DB_PASS','********');
define('PHPDIG_DB_NAME','phpdig');

//connection to the MySql server
$id_connect = @mysql_connect(PHPDIG_DB_HOST,PHPDIG_DB_USER,PHPDIG_DB_PASS);
if (!$id_connect) {
die("Unable to connect to database : Check the connection script.\n");
}
//Select DataBase
@mysql_select_db(PHPDIG_DB_NAME,$id_connect);
?>


I am still receiving the following message when I go to the search.php page:
Parse error: parse error, unexpected T_STRING in /home/dplatt/public_html/chs/search/includes/connect.php on line 22

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/dplatt/public_html/chs/search/libs/mysql_functions.php on line 38
Unable to check table. Check connection parameters

Please advise.
-David

vinyl-junkie
02-04-2004, 08:00 PM
Double-check and see how your web host actually defines the database name. Mine appends my account name to the database name, so instead of the db name being phpdig, it might be:
accountname_phpdig.

Also make sure you have username and password spelled correctly. Case sensitivity applies, too, so double-check that as well.

Let us know if any of these suggestions help solve the problem.

dplatt
02-05-2004, 08:35 AM
I checked this. I am running Apache on my RH9 box. This wasn't required. Any other ideas? I'm going a little crazy trying to figure it out.

Charter
02-05-2004, 08:55 AM
Hi. What happens when you change localhost to 127.0.0.1, or does your Hosts file contain a "127.0.0.1 localhost" line?

dplatt
02-05-2004, 09:31 AM
I continue to get the same error. Here is what I have in the hosts file. Maybe this will enlighten someone:

[root@frodo etc]# vi hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 frodo localhost.localdomain localhost

Just for your information, I did try setting the DB_HOST line to both localhost, frodo, and 127.0.0.1. The phpdig database was created under localhost, which I did manually and just rechecked under phpmyadmin.

Any more ideas?

-David

Charter
02-05-2004, 10:52 AM
Hi. Do your username and/or password contain any special characters?

In connect.php replace the following:

$id_connect = @mysql_connect(PHPDIG_DB_HOST,PHPDIG_DB_USER,PHPDIG_DB_PASS);

with the following:

$id_connect = mysql_connect(PHPDIG_DB_HOST,PHPDIG_DB_USER,PHPDIG_DB_PASS)
or die("Could not connect: " . mysql_error());

and then call connect.php directly from the browser. What is the output?

dplatt
02-05-2004, 12:48 PM
I received the following by calling the connect.php directly:

Parse error: parse error, unexpected T_STRING in /home/dplatt/public_html/chs/search/includes/connect.php on line 21


Here is the code from connect.php:
// Connection configuration
define('PHPDIG_DB_PREFIX',");
define('PHPDIG_DB_HOST','localhost');
define('PHPDIG_DB_USER','*****');
define('PHPDIG_DB_PASS','*****');
define('PHPDIG_DB_NAME','phpdig');

//connection to the MySql server
$id_connect = mysql_connect(PHPDIG_DB_HOST,PHPDIG_DB_USER,PHPDIG_DB_PASS)
or die("Could not connect: " . mysql_error());

if (!$id_connect) {
die("Unable to connect to database : Check the connection script.\n");
}
//Select DataBase
@mysql_select_db(PHPDIG_DB_NAME,$id_connect);
?>

Thanks,
David

Charter
02-05-2004, 02:39 PM
Hi. Do your username and/or password contain any special characters?

vinyl-junkie
02-05-2004, 05:05 PM
Your code looks correct, but I suspect Charter is right. Check for special characters in your username and password, as that could cause problems.

Also, I'm not sure exactly what line number 21 is in your code, where you're getting the error, but try putting a die() statement in the code just about line 21 and include within the parenthesis whatever variable name is being referenced in line 21. That might give you a clue as to what the problem is.

<added>
And unless what's on line 21 is a password or other sensitive information, or the problem just leaps out at you after following my suggestion or what Charter said to do, please post the results of the die() statement. Thanks.
</added>

Core
02-06-2004, 12:15 AM
Try changing this line

// Connection configuration
define('PHPDIG_DB_PREFIX',");

It looks like you have a double quote ( " ) instead of two singles.

Charter
02-06-2004, 07:35 AM
Hi. Good eye Core! Yes, change that to two single quotes with no space inbetween.

dplatt
02-17-2004, 09:31 AM
That did it.

Gotta love discussion groups to get this stuff solved. Don't know why I didn't see two single quotes instead of double.


Thank you,
-David