MySQL PDO:无法在一个虚拟主机上找到驱动程序

I frankly don't know where to start solving this one...

My dev environment is on OSX (10.8.5 if that matters). I'm running apache web server, php and mysql database locally. From PHP I'm connecting to MySQL using PDO - and everything works fine.

In my /etc/hosts I have this line:

127.0.0.1 localhost dev.local

My apache is configured with virtual hosts localhost and dev.local in such a way that if I put http://dev.local in the browser, I access code from DocumentRoot /var/www/dev.local and if I access it in any other way (e.g. put 127.0.0.1 in the browser), I access code from DocumentRoot /var/www/localhost.

Now I need to be able to test the app from another device (ipad, as the client wants the app to run on ipad). I've changed my apache config so that the default access is to the /var/www/dev.local DocumentRoot. Now, whether I put http://dev.local or http://localhost into the address bar, I get to the same code. And here's where the issue starts.

As I mentioned above, I use PDO from PHP to connect to MySQL. If I put http://dev.local into the browser address bar, then everything works correctly. If, however, I access my app as http://localhost or from another device, I receive error message could not find driver. This is the most bizarre thing, as I'm accessing the same code base and get an error one way but don't get it in another way.

I do have PDO enabled and drivers installed correctly. If I access my app with http://localhost, I do have pdo_mysql in my phpinfo, therefore the driver is installed correctly.

Any ideas where to start investigating is greatly appreciated.