Thread: [phpodpworld-users] Categories with the ' characters
Status: Beta
Brought to you by:
hansfn
|
From: Howard L. <hl...@gm...> - 2007-07-02 09:29:59
|
Dear all, Some of the DMOZ categories have the ' character. I found that these categories are not displayed. It seems the ' character is escaped and displayed as \'. For example, this error message is shown when I access the page: The category "Reference: Education: Colleges and Universities: North America: United States: Women\'s Colleges" was not found. I checked the apache log and it is not escaped. 210.17.204.242 - - [02/Jul/2007:01:58:57 -0700] "GET /Reference/Education/Colleges_and_Universities/North_America/United_States/Women's_Colleges HTTP/1.1" 200 1897 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)" I am using MySQL 5.0 as the database, and the category is indeed there. Does anybody experience the same problem? Thank you. Howard |
|
From: Hans F. N. <Han...@hi...> - 2007-07-02 22:16:55
|
* Howard Lee <hl...@gm...> [2007-07-02]:
> Dear all,
>
> Some of the DMOZ categories have the ' character. I found that these
> categories are not displayed. It seems the ' character is escaped and
> displayed as \'. For example, this error message is shown when I
> access the page:
> The category "Reference: Education: Colleges and Universities: North
> America: United States: Women\'s Colleges" was not found.
>
> I checked the apache log and it is not escaped.
> 210.17.204.242 - - [02/Jul/2007:01:58:57 -0700] "GET
> /Reference/Education/Colleges_and_Universities/North_America/United_States/Women's_Colleges
> HTTP/1.1" 200 1897 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
> 5.1; SV1; .NET CLR 2.0.50727)"
>
> I am using MySQL 5.0 as the database, and the category is indeed
> there. Does anybody experience the same problem? Thank you.
As you all know (?), phpodpworld is just a hobby project of mine. It
basically means there are plenty of bugs - this is one of them. My
guess is that you have activated magic_quotes_gpc[1] and my code isn't
checking for that. Could you please try to turn off magic_quotes_gpc
and see if the problem is fixed? If so, I'll add some checks for magic
quotes before the next release.
Hans
[1] This is a PHP setting so it will not affect the Apache logs.
(Look in your php.ini. It can be disabled at directory level
using .htaccess.)
|
|
From: Howard L. <hl...@gm...> - 2007-07-03 14:58:46
|
Thanks for the reply as always, I really appreciate it. Nowadays all software are full of bugs , commercial, free or otherwise :) Apparently what your saying is correct, it's just a PHP setting. This is not really a bug, perhaps any decent web admin would figure it out, but not me :-O I actually checked the codes in index.php and functions.php before sending to the list. Of course I couldn't find anything about the extra quotes, and it left me wondering. Anyway, I hope somebody else would find this useful too. Howard |
|
From: Nicholas J. <joh...@ne...> - 2007-07-04 15:30:22
|
Hello all, Using phpodpworld.pl to import structure or content in the database, all records are successfully loaded, but then followed by the error below: DBD::mysql::db do failed: File 'C:WINDOWSTEMP1NfxkiP8CnW' not found (Errcode: 2) at C:\\mypath\phpodpworld.pl line 576. The temp file is created successfully in the correct directory, but then cannot be found successfully. I can only think that the path shown, C:WINDOWSTEMP1NfxkiP8CnW, is not successful because it doesn't contain the slashes required... Any help would be greatly appreciated, Nick Johnston |
|
From: Howard L. <hl...@gm...> - 2007-07-05 05:52:17
|
On 7/4/07, Nicholas Johnston <joh...@ne...> wrote:
> Hello all,
>
> Using phpodpworld.pl to import structure or content in the database, all
> records are successfully loaded, but then followed by the error below:
>
> DBD::mysql::db do failed: File 'C:WINDOWSTEMP1NfxkiP8CnW' not found
> (Errcode: 2) at C:\\mypath\phpodpworld.pl line 576.
>
> The temp file is created successfully in the correct directory, but then
> cannot be found successfully. I can only think that the path shown,
> C:WINDOWSTEMP1NfxkiP8CnW, is not successful because it doesn't contain the
> slashes required...
I use it on Linux and MySQL and this problem does not occur.
Apparently MySQL requires double backslashes for paths in LOAD DATA
statement on Windows.
For testing purpose, I would suggest to change the below statements
and see if it works or not. There might be a better way to do it
though.
From:
$dbh->do("LOAD DATA LOCAL INFILE '$tempname' INTO TABLE xurls FIELDS
OPTIONALLY ENCLOSED BY \"'\"");
To:
my $tempname_mysql = $tempname;
$tempname_mysql =~ s/\\/\\\\/g;
$dbh->do("LOAD DATA LOCAL INFILE '$tempname_mysql' INTO TABLE xurls
FIELDS OPTIONALLY ENCLOSED BY \"'\"");
From:
$dbh->do("LOAD DATA LOCAL INFILE '$temp_res' INTO TABLE resources
FIELDS OPTIONALLY ENCLOSED BY \"'\"");
$dbh->do("LOAD DATA LOCAL INFILE '$temp_str' INTO TABLE structure
FIELDS OPTIONALLY ENCLOSED BY \"'\"");
To:
my $temp_res_mysql = $temp_res;
my $temp_str_mysql = $temp_str;
$temp_res_mysql =~ s/\\/\\\\/g;
$temp_str_mysql =~ s/\\/\\\\/g;
$dbh->do("LOAD DATA LOCAL INFILE '$temp_res_mysql' INTO TABLE
resources FIELDS OPTIONALLY ENCLOSED BY \"'\"");
$dbh->do("LOAD DATA LOCAL INFILE '$temp_str_mysql' INTO TABLE
structure FIELDS OPTIONALLY ENCLOSED BY \"'\"");
Howard
|
|
From: Nicholas J. <joh...@ne...> - 2007-07-05 19:34:29
|
Thanks Howard, I've added those lines and will attempt it again overnight.
For the time being I imported the temp files into mysql directly.
I now have an issue where, after counting the categories, the index.php page
does not display anything - just a white page. The maintinence page
displays fine. Any known or obvious issues there?
Nick
-----Original Message-----
From: Howard Lee [mailto:hl...@gm...]
Sent: 05 July 2007 06:52
To: Nicholas Johnston
Cc: php...@li...
Subject: Re: [phpodpworld-users] Phpodpworld.pl temp file not found
On 7/4/07, Nicholas Johnston <joh...@ne...> wrote:
> Hello all,
>
> Using phpodpworld.pl to import structure or content in the database,
> all records are successfully loaded, but then followed by the error below:
>
> DBD::mysql::db do failed: File 'C:WINDOWSTEMP1NfxkiP8CnW' not found
> (Errcode: 2) at C:\\mypath\phpodpworld.pl line 576.
>
> The temp file is created successfully in the correct directory, but
> then cannot be found successfully. I can only think that the path
> shown, C:WINDOWSTEMP1NfxkiP8CnW, is not successful because it doesn't
> contain the slashes required...
I use it on Linux and MySQL and this problem does not occur.
Apparently MySQL requires double backslashes for paths in LOAD DATA
statement on Windows.
For testing purpose, I would suggest to change the below statements and see
if it works or not. There might be a better way to do it though.
From:
$dbh->do("LOAD DATA LOCAL INFILE '$tempname' INTO TABLE xurls FIELDS
OPTIONALLY ENCLOSED BY \"'\"");
To:
my $tempname_mysql = $tempname;
$tempname_mysql =~ s/\\/\\\\/g;
$dbh->do("LOAD DATA LOCAL INFILE '$tempname_mysql' INTO TABLE xurls FIELDS
OPTIONALLY ENCLOSED BY \"'\"");
From:
$dbh->do("LOAD DATA LOCAL INFILE '$temp_res' INTO TABLE resources FIELDS
OPTIONALLY ENCLOSED BY \"'\""); $dbh->do("LOAD DATA LOCAL INFILE '$temp_str'
INTO TABLE structure FIELDS OPTIONALLY ENCLOSED BY \"'\"");
To:
my $temp_res_mysql = $temp_res;
my $temp_str_mysql = $temp_str;
$temp_res_mysql =~ s/\\/\\\\/g;
$temp_str_mysql =~ s/\\/\\\\/g;
$dbh->do("LOAD DATA LOCAL INFILE '$temp_res_mysql' INTO TABLE resources
FIELDS OPTIONALLY ENCLOSED BY \"'\""); $dbh->do("LOAD DATA LOCAL INFILE
'$temp_str_mysql' INTO TABLE structure FIELDS OPTIONALLY ENCLOSED BY
\"'\"");
Howard
|
|
From: Howard L. <hl...@gm...> - 2007-07-08 07:30:59
|
On 7/6/07, Nicholas Johnston <joh...@ne...> wrote: > I now have an issue where, after counting the categories, the index.php page > does not display anything - just a white page. The maintinence page > displays fine. Any known or obvious issues there? Not that I know of. I can only think of the difference between the maintainance page and the actual page is the database connection. Have you checked that PHP can connect the MySQL successfully? |
|
From: Hans F. N. <Han...@hi...> - 2007-07-09 10:42:55
|
* Howard Lee <hl...@gm...> [2007-07-08]:
> On 7/6/07, Nicholas Johnston <joh...@ne...> wrote:
> > I now have an issue where, after counting the categories, the index.php page
> > does not display anything - just a white page. The maintinence page
> > displays fine. Any known or obvious issues there?
>
> Not that I know of. I can only think of the difference between the
> maintainance page and the actual page is the database connection. Have
> you checked that PHP can connect the MySQL successfully?
(Sorry for the late reply - spent some time off-line.)
That sounds like good advice, Howard. The MySQL extension for PHP must
be enabled/installed - check your phpinfo. Nicholas, have you checked
the webserver error logs (where PHP normally logs it's error
messages)? You could also turn on logging ("use_logging") in the
phpODPWorld config, but I guess this problem happens at the PHP
system level (missing MySQL extension).
Regards Hans
|
|
From: Nicholas J. <joh...@ne...> - 2007-07-09 11:20:20
|
Thank you both for your diagnosis.
Briefly using display_errors, it became apparent that I was missing
something. This was infact Pear DB, thanks to my lack of familiarity with
PHP.
I am now on to hopefully my last issue - when viewing the index page, I am
greeted with:
-----Original Message-----
From: php...@li...
[mailto:php...@li...] On Behalf Of Hans
F. Nordhaug
Sent: 09 July 2007 11:43
To: php...@li...
Subject: Re: [phpodpworld-users] Phpodpworld.pl temp file not found
* Howard Lee <hl...@gm...> [2007-07-08]:
> On 7/6/07, Nicholas Johnston <joh...@ne...> wrote:
> > I now have an issue where, after counting the categories, the
> > index.php page does not display anything - just a white page. The
> > maintinence page displays fine. Any known or obvious issues there?
>
> Not that I know of. I can only think of the difference between the
> maintainance page and the actual page is the database connection. Have
> you checked that PHP can connect the MySQL successfully?
(Sorry for the late reply - spent some time off-line.)
That sounds like good advice, Howard. The MySQL extension for PHP must be
enabled/installed - check your phpinfo. Nicholas, have you checked the
webserver error logs (where PHP normally logs it's error messages)? You
could also turn on logging ("use_logging") in the phpODPWorld config, but I
guess this problem happens at the PHP system level (missing MySQL
extension).
Regards Hans
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the
FREE version of DB2 express and take control of your XML. No limits. Just
data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
phpodpworld-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/phpodpworld-users
|
|
From: Nicholas J. <joh...@ne...> - 2007-07-09 11:26:29
|
Oops, I hit a shortcut key...
Thank you both for your diagnosis.
Briefly using display_errors, it became apparent that I was missing
something. This was infact Pear DB, thanks to my lack of familiarity with
PHP.
I am now on to hopefully my last issue - when viewing the index page, I am
greeted with:
The category "" was not found. The closest matches are:
In this case I'm trying to display all categories, in a similar way to DMOZ
does. Currently in the config.inc.php categories array, I've just got
"Top", but testing this and replacing this with "Business" for example,
creates the same effect.
The category "Business" was not found. The closest matches are:
Any help again would be greatly appriciated.
Kind regards,
Nick Johnston
-----Original Message-----
From: php...@li...
[mailto:php...@li...] On Behalf Of
Nicholas Johnston
Sent: 09 July 2007 12:20
To: php...@li...
Subject: Re: [phpodpworld-users] Phpodpworld.pl temp file not found
Thank you both for your diagnosis.
Briefly using display_errors, it became apparent that I was missing
something. This was infact Pear DB, thanks to my lack of familiarity with
PHP.
I am now on to hopefully my last issue - when viewing the index page, I am
greeted with:
-----Original Message-----
From: php...@li...
[mailto:php...@li...] On Behalf Of Hans
F. Nordhaug
Sent: 09 July 2007 11:43
To: php...@li...
Subject: Re: [phpodpworld-users] Phpodpworld.pl temp file not found
* Howard Lee <hl...@gm...> [2007-07-08]:
> On 7/6/07, Nicholas Johnston <joh...@ne...> wrote:
> > I now have an issue where, after counting the categories, the
> > index.php page does not display anything - just a white page. The
> > maintinence page displays fine. Any known or obvious issues there?
>
> Not that I know of. I can only think of the difference between the
> maintainance page and the actual page is the database connection. Have
> you checked that PHP can connect the MySQL successfully?
(Sorry for the late reply - spent some time off-line.)
That sounds like good advice, Howard. The MySQL extension for PHP must be
enabled/installed - check your phpinfo. Nicholas, have you checked the
webserver error logs (where PHP normally logs it's error messages)? You
could also turn on logging ("use_logging") in the phpODPWorld config, but I
guess this problem happens at the PHP system level (missing MySQL
extension).
Regards Hans
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the
FREE version of DB2 express and take control of your XML. No limits. Just
data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
phpodpworld-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/phpodpworld-users
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the
FREE version of DB2 express and take control of your XML. No limits. Just
data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
phpodpworld-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/phpodpworld-users
|
|
From: Hans F. N. <Han...@hi...> - 2007-07-09 11:52:25
|
* Nicholas Johnston <joh...@ne...> [2007-07-09]: > Oops, I hit a shortcut key... > > Thank you both for your diagnosis. > > Briefly using display_errors, it became apparent that I was missing > something. This was infact Pear DB, thanks to my lack of familiarity with > PHP. OK, glad you found the problem. (It is listed in the dependencies section - http://phpodpworld.sourceforge.net/#depend - but that might not make much sense to everyone.) > I am now on to hopefully my last issue - when viewing the index page, I am > greeted with: > > The category "" was not found. The closest matches are: > > In this case I'm trying to display all categories, in a similar way to DMOZ > does. Currently in the config.inc.php categories array, I've just got > "Top", but testing this and replacing this with "Business" for example, > creates the same effect. > > The category "Business" was not found. The closest matches are: > > Any help again would be greatly appriciated. Did you try "Top/Business"? (Just "Business" doesn't exist.) I'm guessing that the import of the RDF into your db failed or is incomplete. (What version are you using by the way - 3.0 pre1 or the latest from SVN?) You should check the db using a mysql client. (If that doesn't make any sense you could try to import a sub-sub-category and in the db perl scripts change my $single_insert = 1; to my $single_insert = 0; This will be slower, not loading the data from (temp) files, but it should work without errors. If it works, you know that you did a mistake when you tried to fix the problems you had.) In general, never work with the complete RDF/all categories, until you have it working for a small sub-sub-category. Hans |