Problem to load PDO class with rewrite on

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 2
Joined: Fri Jan 24, 2014 3:59 am

Problem to load PDO class with rewrite on

Postby mcronline » Fri Jan 24, 2014 4:19 am


I'm having kinda weird stuff going on here.

I'm trying to create a PDO Object normally, like:

Code: Select all

$dbh = new PDO('mysql:host='.$hostname.';dbname='.$dbname,$username, $password);

I have RewriteEngine On in my .htaccess and when I run the script in a way that trigger a rewrite rule it returns the following error:

Code: Select all

Fatal error: Class 'PDO' not found

I have a rule to not apply any rewrite when trying to run the script directly from his directory, in this case "php" directory, like:

Code: Select all

RewriteRule ^(php)($|/) - [L]

If I run the code directly from this directory, the script create the PDO object normally.

anyone have an idea of why this happen?

thank you

Return to “PHP coding => General”

Who is online

Users browsing this forum: Baidu [Spider] and 5 guests