Help - Search - Members - Calendar
Full Version: cron job error message
Hostony Board > General Support > PHP/MySQL
snorkelface
I can't seem to get a response from tech support on this after two emails, so I thought I would see if anyone knows the answer.

I setup a small php script to run as a cron job every night. It simply goes through a database and updates a field with either a '1' or '0'. The script seems to run ok. If I run it from a browser, it runs without errors.

Anyway, I get the following email everytime it runs and was wondering if this is something I need to be concerned with.

File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#14' is not a compiled character set and is not specified in the 'NONEXISTENT/charsets/Index' file
Content-type: text/html
X-Powered-By: PHP/4.3.8

Anything I found on Google talks about the base directory of mysql not being properly specified in some config file.

I have no idea if this is a configuration problem or ???
Vanya
What is your domain name?
snorkelface
sellalmostanything.com
Vanya
Ok, the error should gone now.
snorkelface
Thank you.
snorkelface
Ah, it's still emailing me those same error messges.

File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#14' is not a compiled character set and is not specified in the 'NONEXISTENT/charsets/Index' file
Content-type: text/html
X-Powered-By: PHP/4.3.8

jeff
Stanly
You see the default chraracter set at the server is en_US.UTF-8
If you need to work with some enother encoding from your scripts you need to set it at MySQL (in case if script use MySQL) or your shell.
Try to read PHP documentation to find this out.
snorkelface
Here's my entire php script that returns the email errors. If I run this from the url line directly, it doesn't return any errors, if that helps. Would this script produce that error?

I studied the php manual and I don't *think* I'm using any different character set here.

ez_sql.php is simply a class for connecting to and retruning a result set from mysql. It hsa no character set specified.

Is the error message something that I should be concerned with or can I just ignore it? I'm just concerned that it's either a bug in a certain version of php or a misconfiuration in some file that I don't have access to. These are what google kept showing for a search on that error.

Any help or ideas are appreciated.

jeff
-------------------------------------------------
<?PHP
include_once "ez_sql.php";

$query = "SELECT item_num, item_end, expired FROM items";

$rows = $db->get_results($query);

foreach ($rows as $item) {

// Check for expired

$today = date('Y-m-d');
$end_date = $item->item_end;

// If today is past end date and it's not already marked as expired, mark it.

if (($today > $end_date) && ($item->expired == 0)) {

$query = "UPDATE items SET expired='1' WHERE item_num = '".$item->item_num."'";
$db->query($query);
}
}
?>
-----------------------------------------------------------------------------
Here's some links that I found googling. They may or may not be any help.

http://bugzilla.redhat.com/bugzilla/long_l...i?buglist=60793

http://www.jsw4.net/info/list-archives/mys...7/msg00349.html

http://bugs.php.net/bug.php?id=7678

http://www.manucorp.com/archives/php-bugs/...09/msg00075.php

http://www.phpbuilder.com/lists/php-develo...000111/0766.php
Vanya
I've created a symlink NONEXISTENT in your www dir. Try to run the script now.
snorkelface
Didn't change anything. I am still getting the same errors.

Any ideas as to what it might be or what the error means?
Were the links any help?

Is the error being generated by php, mysql or something to do with the cron process? Again, I don't get any indication of an error if I run it from the url of the browser, only when I run it as a cron job.
Stanly
Try to add the following string to the beginning of your file (as first line):

#!/usr/local/bin/php
snorkelface
I'm still getting the exact same error messge.

If someone could tell me what program or what process is issuing the error message, I might be able to explore different things on m own, but I don't know where to start.

Everything I find while googling, points to some configuration file that is misconfigured, or something wasn't compiled properly. I've never run across this before, so I don't know what to check. I'm hoping that someone can help.
MartinB
Find your answers at: http://www.mysql.com/doc/P/r/Problems_with...acter_sets.html
snorkelface
mblendinger,

After reading the entire page several times, I'm sorry, I can't seem to figure out what it was that you thought might help me from your link to the mysql manual.

Assuming that this page was the page that you wanted me to read, it says at the top;
----------------------------------------------
5.8.7 Problems With Character Sets

If you try to use a character set that is not compiled into your binary, you might run into the following problems:
------------------------------------------------
First of all, I'm not trying to use anything but the default character set. In other words, I'm not specifying any other character set in my script.

Second, every error message on that page (link you sent me) has the word or directory 'mysql' somwhere in the error message. My error message has no mention of mysql in it.

Third, why does it only give this error when I run my php script as a cron job and not from the url address from a browser.

Maybe I'm missing something that you thought I would see. If so, could you please ponit it out to me or be a little more detailed in what you think would solve my problem?

I have scoured the mysql and php manual and can't find anything that seems to help in this situation. I'm still searching though.

Thank you
MartinB
hmm... i search too in google but all the pages associated with this error are in other languages and i can't understand them.... sad.gif

i have a crazy and intuitive tip for you....

get all the .php files evolved, open the notepad, copy & paste the content of your files in, check if you have some extrange character in your files content, and then save it again with the NOTEPAD.

then upload your new "cleaned" files in ascii (not binary) to the correct locations and try it....... blink.gif

you have nothing to loose . cool.gif
snorkelface
Thanks for you suggestion. I did something better than that. I wrote this simple php program in 'Kate' (a linux notepad) and ran it as a cron job. I've kept it as simple as I can. It simple connects to mysql, selects a db, then does a select on it.

I'm getting the exact same error messages. I also tried changing permissions on this an my other cron job, thinking that just maybe it had to be 'executable'. Didn't make any difference.
------------------------------------------
<?PHP
$database = mysql_connect("localhost","sellalmo_yard","xxxxxx");
mysql_select_db("test",$database);
$result = mysql_query("Select * from user",$database);
?>
-----------------------------------------
Password ommitted for obvious reasons.

So, based on this, I have to assume that it's not something that I'm doing wrong.

This leads me to believe that it's either a configuration problem on the server, something that Hostony will have to resolve or a compile or permissions, or something wrong on the server that won't allow simple php cron jobs to run against mysql.

The only thing I read that made any sense was the user removed the mysql libraries and replaced them with the php libraries for mysql access. This was in one of the links that I included in an earlier post.

I mean, unless the support folks at Hostony can tell me I'm doing something wrong in my script or how I set up the cron job (per their recommendation), then the ball's in their court now. I've run out of ideas. They should try and figure out what is happening.
MartinB
I do the same, I write a file called test.php with:

CODE
#!/usr/local/bin/php -q
<?php
$database = mysql_connect("localhost","wizhosti_admindb","xxxxxx");
mysql_select_db("wizhosti_admindb",$database);

$result = mysql_query("select * from cliente",$database);

if (mysql_num_rows($result)>0)
{
       while ($item = mysql_fetch_array($result, MYSQL_ASSOC))
       {
       echo $item['nombre'];
       }
}

?>


i make it executable and then i do a

./test.php

and it work ok, no error messages returned.

I'm in server 20.
can you reproduce my work in your server (with valid sql values for your scheme) ?
snorkelface
I took you script, which is almost the same as the one I just wrote and made the changes for my databas and ran it as a cron job.

Same Error!

Let's make sure we're on the same page here.

You say that you;

"i make it executable and then i do a

./test.php"

From where do you do the './test.php' from?

Remember, the error only happens if any of my scripts are run as cron jobs, not from the command line. It has something to do with how cron jobs get run. None of my scripts get any errors if run from a browser url line.

Have you run yours as a cron job?

Both your program and mind give the same email error message:

File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#14' is not a compiled character set and is not specified in the 'NONEXISTENT/charsets/Index' file
Content-type: text/html
X-Powered-By: PHP/4.3.8

I'm on server 23 if that makes a difference.

Le me know if you think I'm doing something wrong. I appreciate you trying to help.
MartinB
hum i do a

chmod +775 test.php

then i ran it from the command line.

Now i will set up a cron job.

( */15 * * * * /home/wizhosti/test.php )

i will notify you about results.

smile.gif
snorkelface
Update -

I moved my crontest.php file from a subdirectory to the docroot and ran it as a cron job.

Now I get an email with the following:
-----------------------------
Content-type: text/html
X-Powered-By: PHP/4.3.8
------------------------------

The error has disappeared.

1. Why am I still getting an email with this on it?
2. What does the php- -q do? I can't find any docs in the man pages on -q
3. The subdirectory has a 755 permissions on it. Docroot has 750. Is that OK?
4. Why would I get the previous error if I ran it from a sub directory of docroot?

Can you try moving yours to a sub directory off of your docroot and let me know what happens when you run it as a cron job?
MartinB
-q = quiet != verbose smile.gif

ok i will try move the script to other subdirectory.
MartinB
i put it in a subdirectory, and it work fine too.
no mails received.

are you sure you are putting the complete path to the file in the cron ? (like "/home/youruser/x/y/z/yourfile.php")

if you are doing all that good, I will starting to think something is bad with your server/user local configuration.... but only a Hostony's staff can say the last world. ph34r.gif

ps:

QUOTE
Docroot has 750. Is that OK?


is ok,docroot has all permissions for the owner (you), read and execute for the group (apache user and relate), and nothing for the rest of the world (security)
snorkelface
QUOTE
are you sure you are putting the complete path to the file in the cron ? (like "/home/youruser/x/y/z/yourfile.php")


Yes, even the eamail subject line has the full command, including the full path and filename.

Could the fact that I'm getting an email have anything to do with the '-q' option NOT being used?

Does the fact that I'm getting an email mean that there is an error, even though it doesn't show an error when I put the cron job in the docroot instead of a sub directory?

Can you think of any other reason that the email messages would be different, just because I'm using a php script in the docroot instead of a sub directory?

I just ran some more tests.

The -q didn't make any difference.

If I copy the same php script into the docroot and the sub directory and run both as cron jobs, I receive an email from the docroot job with just the following in it;

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

However, that same php script in the sub directory, produces an email with the following in it;

File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#14' is not a compiled character set and is not specified in the 'NONEXISTENT/charsets/Index' file
Content-type: text/html
X-Powered-By: PHP/4.3.8

So, Something is different and it's not the scripts.

I would be happy to give you or anyone else that can help the exact script and directories offline so you can see what is happening.
MartinB
A simple question... is your script doing the job ? or it's not working ?

if it's working just try deleting the line:
CODE
MAILTO="yourmail@yourdomain.com"

from your crontab and problem finished! biggrin.gif

i'm really sorry, but i think i can't help you with this f****g problem, i can't see the problem in my account so i think is something wrong in your server's configuration, not a problem of your code, the code i send you generate the error messages in your account but not in my own account, and is the same script. sad.gif

perhaps I am only soiling the way, I am sure that Alec can offers a much more valuable help to you.

Anyways, if i found anything that i think can help, i will notify it to you wink.gif
snorkelface
mblendinger,

I really appreciate you trying to help. If your code doesn't give you errors and I used the same script on my server and it gives me errors, I have to asume that there is some configuration problem with my server (23).

One last question.
Do you have any idea why I would receive an error from the script run in the sub directory and not the same script run in the docroot directory? What does that mean to you?

Anyway, yes, I just rechecked and the script does what it's designed to do properly, no matter where it's located.

Thanks again.

I just hope the tech support at Hostony can figure it out and let me know what is happening on server 23 that isn't happening on yours.
MartinB
i can't figure why you can get an error in a subdirectory but not in the docroot.
i think this difference can be only a PATH problem.

Hm..... if you change your cron to:

CODE
cd /home/youruser/x/y/z; ./yourfile.php


maybe is a problem when your code try to include external files like "ez_sql.php".

like:

CODE
*/15 * * * * cd /home/wizhosti/public_html/testdir; ./test.php


instead of:

CODE
*/15 * * * * /home/wizhosti/public_html/testdir/test.php
snorkelface
I tried your suggestion. No luck.

I get ALMOST the same error message as before;

File 'NONEXISTENT/charsets/?.conf' not found (Errcode: 2)
Character set '#14' is not a compiled character set and is not specified in the 'NONEXISTENT/charsets/Index' file

These last two lines were NOT in the error email this time;
Content-type: text/html
X-Powered-By: PHP/4.3.8

Does that give you any clues?

Do you know what process is issuing the error message, not just the email?

e.g. cron, php, mysql ?
MartinB
no clue.

i found recently this link https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=60793
and

http://bugs.php.net/bug.php?id=7678&edit=1

maybe it can help. unsure.gif

what version of php do you have in your server ?
snorkelface
Yes, I saw that when I first started searching. I included that in one of my links for tech support to look at.

QUOTE
Workaround is either not to specify default-character-set in /etc/my.cnf (it
breaks localized behaviour) or to symlink /usr/share/mysql to NONEXISTENT in
actual directory.


They also tried the symlink, but it didn't change anything.

That was also on an old version of php. 4.0.6-12

php 4.3.8 is running on server 23.

The fact that this problem is not wide spread and I can't find too much on the different search engines, leads me to believe that this is simply a configuration problem of some kind on server 23. There has to be a lot of people trying to do what I'm doing, running php programs using cron. If this was a major problem, I think we would see much more information about it out on the internet.

I think we proved that with your little program that runs on your server without any email messages and running it on server 23, produces the error email.
MartinB
yes, here is the point when Support Staff must continue.
Greetings and good luck wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.
IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here