Overriding PHP.ini to use PDO

Hi,

I’m trying to access a MySQL database on a hosting company server using PHP and PDO commands.
I ran my index.php script and got the following error…
Fatal error: Class ‘PDO’ not found in index.php on line 9

using phpinfo() i found the following in the “configure command” section
Command ‘./configure’ ‘–disable-pdo’

i don’t have access to modify the exisiting php.ini file on the hosting server.

i contacted the support desk and was told i maybe able to do something with the .htaccess file - but the support person couldn’t be anymore specific - i got the feeling that was the standard reply to any user query.

is there anyway i can override the exisiting php settings and allow my script to use PDO commands ?

Thanks…

Nothing in the .htaccess can enable PDO if it’s not installed.
Either your host needs to install PDO or your plain out of luck I’m afraid.

…and everything was going oh so well up until that point…

thanks for ya help…

ScallioXTX - I’ve just been in touch again with the hosting company’s support guys.
They assure me that regardless of my phpinfo() output - PDO has been enabled. The final comment was…

You will find you can probably enable it using an .htaccess of php.ini file

I have googled and looked - but all i can find is applying php values of either true and false in the .htaccess file - not overriding settings by reading my own “local” php.ini file.

I have taken a copy of the server’s php.ini and saved a “local copy” with the additional line added
extension=php_pdo_mysql.so

can you tell me how i load the my “local” copy of php.ini using the .htaccess file ?

Thanks for ya help…

Major caveat, I haven’t tried this… (and probably wouldn’t…)

The problem with allowing people to insert their own libraries in PHP is that php is often linked in with the web server, so, if you could load your own .so, your module could apply for the remainder of that httpd’s life-span. (this is one of the sucky things about shared hosts) This is sort of why mod_perl never really took off on the commodity hosts.

What you may be able to do is run php as a CGI script, if your provider allows you to compile/upload/whatever your own binaries. In this model, your own process won’t affect the web server and you should be able to link in whatever you want.

Sounds like a big hassle to me though, one that might be some-what fragile. Probably better off getting another hosting provider. (check into the VPS servers or if you can find one, a freebsd jail where you have more control over your own web server.)

Your problem caught my interest because I’m interested in using PDO, (or at least something with place-holders) but with PHP it’s sort of shooting in the dark, you have no idea whats supported on what host. A list some place showing which parts of PHP are actually in use on 90% of the hosts would be most helpful.

I never gave PDO a thought when it came to hosting. I’ve only recently started coding in PHP and because that was the way i was shown how to do it - that’s the way i coded. I just took PDO to be “the norm”.

Tis definitely something to bare in mind when choosing a host.

Thanks for ya comments and advice.