You are here:  » not sure how to fix some errors


not sure how to fix some errors

Submitted by dflsports on Sun, 2006-11-05 04:13 in

David, not sure you received my email(s) about needing help then retracting after doing a reinstall.

Well, I reinstalled the scripts using the the latest version. I dropped all the tables and then ran setup.php. When I reinstalled I just overwrote the files, except a few that I had to modify like the htaccess file and some of the config data I copied from the old config, the new config has the added "related" products part.

I am able to import some feeds via the admin area. I can do test imports on all files, no errors.

When I try to run import.php @ALL via a .sh page as a cron job I get this error

X-Powered-By: PHP/4.4.3
Content-type: text/html

Warning: main(includes/javascript.php) [function.main]: failed to open stream: No such file or directory in /home/xxx/public_html/includes/common.php on line 16

Warning: main(includes/javascript.php) [function.main]: failed to open stream: No such file or directory in /home/xxx/public_html/includes/common.php on line 16

Fatal error: main() [function.require]: Failed opening required 'includes/javascript.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxx/public_html/includes/common.php on line 16

For those feeds I imported using the admin control panel, they import just fine. I imported 17,000+ products.

The search works fine, product pages too.

But I do get this error on a page I use the search script to populate the page with:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/includes/database.php on line 21

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/includes/database.php on line 26

If I'm doing a clean install, what is the best process? (I'm thinking a clean install migh be the best way to solve my problem.)

Any advice would be appreciated.

Submitted by support on Sun, 2006-11-05 09:25

Hi Don,

It sounds like you may not be executing import.php from the scripts directory. Try using a cd command before import.php in your automation script, for example:

cd /home/you/path/to/pricetapestry/scripts
php import.php @ALL

Regarding your page that uses the search script, it's difficult to tell what is causing that without seeing your code; but it may be that one of the search value is empty, e.g. $q. Can you let me know more about how you've integrated it into your custom page, specifically which Price Tapestry files you have included.

Cheers,
David.

Submitted by dflsports on Sun, 2006-11-05 15:35

I figured out the code on the custom pages. Thanks!

I logged in via SSH and when I tried CD then the import file, cd /home/xxx/public_html/scripts/

php import.php @ALL

I received

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/xxx/public_html/includes/database.php on line 18

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/includes/database.php on line 22

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/includes/database.php on line 27
backfilling reviews/home/dflsport/public_html.
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/xxx/public_html/includes/database.php on line 44

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/xxx/public_html/includes/database.php on line 18

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/includes/database.php on line 22

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/includes/database.php on line 27

Thanks!

Submitted by support on Sun, 2006-11-05 16:34

Hi Don,

This implies that MySQL is not working correctly when running on the command line. The libraries are definitely compiled in (otherwise you would get an undefined function error) so it could be a permissions problem.

Could you try a test script with the following code in your /scripts/ directory...

test.php

<?php
  $link 
mysql_connect("localhost","username","password")
    or die(
"Database Error: " mysql_error());
  print 
"<p>MySQL Version ".mysql_get_server_info($link)."</p>";
?>

Replace username and password with the same values that you have configured in config.php, and then do the same as before - cd into the /scripts directory and

php test.php

The MySQL error message which should be displayed will give more information about the problem - so if you could post the output from this script that will help work out what's going on.

Cheers,
David.

Submitted by dflsports on Sun, 2006-11-05 16:47

I see this:

MySQL Version 4.1.21-standard

I'll add this tidbit, when my site was running very slow, I emailed support and they sent this

I have checked the server and found there are many sleeping mysql process in the server. Please make sure the scripts that are using the database are closing the tables properly otherwise those process wil got to sleeping state consuiming memory and cpu. I have turned off the mysql.allow_persistent in php.ini to reduce this

Not sure if that may have caused a problem

After that I reinstalled the script and all is well except trying to run the import.php @ALL

Submitted by support on Sun, 2006-11-05 17:06

Hi Don,

That's interesting - I don't really understand what is preventing it from accessing the database. Can you try this:

<?php
  
require("../includes/common.php");
  
$link mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword)
    or die(
"Database Error: " mysql_error());
  print 
"<p>MySQL Version ".mysql_get_server_info($link)."</p>";
?>

That should replicate the conditions in import.php. The allow persistent connections should cause any problem.

Cheers,
David.

Submitted by dflsports on Sun, 2006-11-05 17:20

This is the output:

Warning: mysql_connect(): Access denied for user 'xxx'@'localhost' (using password: NO) in /home/dflsport/public_html/scripts/test.php on line 3

I substituted xx for my username

Submitted by support on Sun, 2006-11-05 17:45

Hi Don,

That's interesting - so it worked when you entered your username and password directly, but not when it used the versions from your config.php file.

Next thing to do is to modify the script to print them and see if you can see a difference between what you think they should be and what is being used:

<?php
  
require("../includes/common.php");
  print 
"Using database server: ".$config_databaseServer."\n";
  print 
"Using database username: ".$config_databaseUsername."\n";
  print 
"Using database password: ".$config_databasePassword."\n";
  
$link mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword)
    or die(
"Database Error: " mysql_error());
  print 
"<p>MySQL Version ".mysql_get_server_info($link)."</p>";
?>

Do the server, username and password look correct when you run this script?

Cheers,
David.

Submitted by dflsports on Sun, 2006-11-05 17:51

It's showing blanks for the username and password

Using database server:
Using database username:
Using database password:

Warning: mysql_connect(): Access denied for user 'xxx'@'localhost' (using password: NO) in /home/xxx/public_html/scripts/test.php on line 6
D

I'm currently importing data using the admin panel. That seems to be workgin fine. So far all import have worked. I'm only importing smaller datafeeds at the moment 109,000 products and counting.

Maybe there is somethgin not right in the common.php file?

Submitted by support on Sun, 2006-11-05 18:00

Hi Don,

This is really strange as if there was any problem opening the config file there should have been an error generated.

Did you have the automation scripts working before the re-install?

Cheers,
David.

Submitted by dflsports on Sun, 2006-11-05 18:06

Yes the script was working before the reinstall.

Submitted by support on Sun, 2006-11-05 18:36

Hmmm, I don't really understand this.

This test will see if $config_databaseUsername is set and is empty:

<?php
  
require("../includes/common.php");
  if (isset(
$config_databaseUsername))
  {
    print 
"database username is set and is '".$config_databaseUsername."'";
  }
  else
  {
    print 
"database username is not set";
  }
  
$link mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword)
    or die(
"Database Error: " mysql_error());
  print 
"<p>MySQL Version ".mysql_get_server_info($link)."</p>";
?>

If that prints the message saying database username is set; it implies that this installation of Price Tapestry is not configured. What output do you get?

Cheers,
David.

Submitted by dflsports on Sun, 2006-11-05 19:12

output:

database username is not set
Warning: mysql_connect(): Access denied for user 'xxx'@'localhost' (using password: NO) in /home/xxx/public_html/scripts/test.php on line 11

Submitted by support on Sun, 2006-11-05 19:35

Hi,

This test script should print the data from config.php directly. Can you confirm that you see your correct database username and password:

<?php
  
require("../includes/common.php");
  
$fp fopen("../config.php","r");
  while(!
feof($fp))
  {
    print 
fgets($fp)."\n";
  }
  
fclose($fp);
  
$link mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword)
    or die(
"Database Error: " mysql_error());
  print 
"<p>MySQL Version ".mysql_get_server_info($link)."</p>";
?>

(as before, run this in the same directory as import.php)

Cheers,
David.

Submitted by dflsports on Sun, 2006-11-05 20:07

everything looks good, after the config file was displayed, this was as well

Warning: mysql_connect(): Access denied for user 'xxx'@'localhost' (using password: NO) in /home/xxx/public_html/scripts/test.php on line 9

Submitted by support on Sun, 2006-11-05 20:10

Is everything else working fine apart from the automation scripts?

I'm afraid i've never seen anything like this before - it just doesn't make sense. I'd need to be able to login to your server and have a look in order to work this out - would you be able to create a temporary password for me to login? Reply to your reg code email or forum registration email with the details if you want me to take a look...

Cheers,
David.

Submitted by dflsports on Sun, 2006-11-05 20:12

I have been poking around and everything else seems to be working, no errors except when trying to use import.php from a command line or script. Bizarre :(

Submitted by dflsports on Sun, 2006-11-05 20:54

email sent :)