Shared PHP 5.3 - Dude, where's my PDO?

software development

#1

Looks like I lost access to the mySQL PDO driver after a recent switch from PHP 5.2.x FastCGI to PHP 5.3.x FastCGI. However, phpinfo() shows the PDO compile switch for 5.3. Can anyone shed some light on this, please?

TIA

Mike


#2

why do you conclude that? i use 5.3 with and without FastCGI and no problem using the mysql pdo driver


#3

Hi,

Because of this: “Fatal error: Uncaught exception ‘PDOException’ with message ‘could not find driver’ [snip]: PDO->__construct(‘mysql:host=mysq…’, ‘[username]’, ‘[secret]’)”. No code changes, just the version switch.

Any pointers greatly appreciated.

Mike


#4

Do you have a custom php.ini in place? PDO-MySQL (as well as most other extensions) are compiled as modules for PHP 5.3, so a custom php.ini may be failing to load them.

If not, try running this command in a shell, and let us know if it spits any errors out:


#5

Yep, that’s it! I deleted my somwhat puny php.ini, and now everything works as expected. But, wait!, shouldn’t the local version simply augment the global .ini?

Thanks, Mike


#6

Adding a custom php.ini overrides the global one — it’s made available as an option so that you can (for instance) opt out of loading some of our default extensions.

If you just want to add extra configuration options, or change ones that are already in place, use a phprc file instead. I’ll probably be simplifying this for PHP 5.4.


#7

Just out of curiosity, would opting out of unused modules have an appreciable effect on memory usage or load times? I’d seriously look into this if it does.


#8

[quote=‘andrewf’]
Adding a custom php.ini overrides the global one — it’s made available as an option so that you can (for instance) opt out of loading some of our default extensions.[/quote]

Got it. Thanks for clearing this up & bearing with me on this one!

Bests, Mike


#9

Somewhat, but it’s a pretty slight difference. The application you’re using has a much larger impact on memory usage than the loaded extensions.