Class 'mysqli' not found?

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
To clarify, are you getting error messages that all the previously missing extensions (mysqli, PDO, gd, mbstring) are still missing? Are just a few of them missing? Are you getting different error messages?
 
Last edited:

Tarzan

New Member
Messages
66
Reaction score
0
Points
0
It seems so. I have to try them one at a time because each error halts the script.

When I try to instantiate a new mysqli object ("new mysqli...") I get
Code:
Fatal error:  Class 'mysqli' not found in/home/tarzan/public_html/... on line x

When I try using mb_strtoupper I get
Code:
Fatal error:  Call to undefined function mb_strtoupper() in /home/tarzan/etc/func_createUserGraphics.php on line y

Using imagecreate creates
Code:
Fatal error:  Call to undefined function imagecreate() in /home/tarzan/etc/func_createUserGraphics.php on line z
(same with gd_info())

I had trouble with it for a long time, then suddenly it popped back about a week ago. But since the 19th of May I had the problem again. I really appreciate all the help I get.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
A thought occurs to me: try a different PHP executable. I see you're using the one at "/usr/bin/php". Try "/usr/local/bin/php" and post the results.
 
Last edited:

Tarzan

New Member
Messages
66
Reaction score
0
Points
0
Unfortunately no luck, still complaining about the missing mysqli.
The only difference I noticed was that the $_SERVER['PHP_SELF'] variable was populated with "/home/tarzan/etc" instead of being empty. (I noticed because I check that variable in the script.)
Is there any other php executable to try? :)
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Try calling it from the web via wget. Add cron_key test to make sure it is not called by bots, etc.

Code:
wget -O -  http://YOURSITE/cron.php?cron_key=a1b9k77Atz >>/home/USERNAME/public_html/cron_log.txt 2>&1
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
To extend the security of the script, you can generate a new key each time the cron job is run. Try:

Code:
key=$RANDOM; echo $key > $HOME/.cron_key; wget -O - http://YOURSITE/cron.php?cron_key=$key >>$HOME/logs/cron_log.txt 2>&1

The PHP script would compare $_GET['cron_key'] to the contents of ~/.cron_key before proceeding. The above command could be the cron job command or placed in a script file (e.g. ~/bin/cronscript) which is run from the cron job.
 

Tarzan

New Member
Messages
66
Reaction score
0
Points
0
Thanks guys, it worked!

The randomized cron key was a smart move. I increased the security a bit by deleting the ".cron-key" file after the validation check. That way noone can read it and use the information to run the cron script.
I also put the log file outside the public_html directory.

Now I can wait for the normal php cron jobs to be fixed without being so impatient :) Thanks again!
 
Top