PDO Exception: Could not find driver (PHP to MS Access) - php

I am trying to connect to a MS Access Db that I have made from my apache server using PHP. I keep coming up with the error "could not find driver". I have searched through just about every web page on the internet and have found nothing of importance. I have undocumented the parts of the php.ini file to allow the odbc drivers to work. I also have tried to list all of the working drivers using the PDO::getAvailableDrivers() code yet nothing shows up no matter how many drivers I undocument from the php.ini file. I've created the DNS connection and linked it to the database yet I'm not sure how to connect to it.
Any help would be greatly appreciated.

For everyone else that needs an answer to this:
MS Access has stopped updating and hosting their odbc connection to php in 2010 (approximately). It will still work if you make sure you're using a 32-bit system. I'm now using 32-bit Apache and PHP. It works flawlessly now.

Related

PHP Socket PDO SQLSTATE[HY000] [2002] No such file or directory

Introduction
For the past couple of days I’ve been messing about with PHP web sockets, in an attempt to retrieve some information in real-time for the user about the various different people connected.
I’m on Ubuntu, running the latest version of XAMPP (located under /opt/lampp/), the web socket I run using PHP which I’ve installed using apt-get install php. This opens a socket with no problem whatsoever.
The problem I’m facing has to do with establishing a connection to the database from the web socket with a little help from PDO. Whenever I attempt to establish the connection to the database located on localhost, I get the following error message:
SQLSTATE[HY000] [2002] No such file or directory
Since PHP and my MySQL server isn’t aware of one another, considering MySQL is run through the instance of XAMPP and the server is run using the version of PHP (which is the same as the one as for XAMPP) I’ve installed using apt-get, one might think that this is the cause of problems. But shouldn’t the server be reachable as long as you have the correct username and password to the server configuration?
Research
I’ve been doing quite some research on the subject, and have found multiple potential solutions for the problem, but neither one appears to do the job. For example, on this question, it is suggested that you can solve this error by doing some witchery to your server software, as well as PHP—I’ve tried this with to apparent success.
On other questions, it’s instead suggested that you change this DSN PDO setup:
$dsn = "mysql:host=$host;port=$port;dbname=$name;charset=$charset";
To instead of using "localhost" for the host, you stick with 127.0.0.1—as a matter of fact, I can’t even connect unto my server if I were to do this. Doing this, my XAMPP gets stuck in some form of endless loop. A minute or so after changing from 127.0.0.1, back to localhost, it starts working again.
I can’t remember where, but I also remember seeing somebody saying it’s not at all doable (connecting to MySQL from a PHP socket), which I’d find extremely strange.
Some people also seem to suggest switching to Node.js for handling real-time connections, but I’d very much like to keep it all PHP if possible.
Furthermore
I’m probably just being a complete moron (I was ;-)), but if anybody can point me in the right direction it would be highly appreciated!
you need to specify the path of the socket
example:
$dsn = 'mysql:dbname=testdb;unix_socket=/path/to/socket';
Try to search the file mysql.sock inside the /opt/lamp

Remote MS ACCESS connection with PHP ODBC on CentOS [duplicate]

Does anyone know if it's possible to connect and query an MS Access database from a Linux Server using PHP?
If it is possible I'm thinking install ODBC driver on the Linux server, but will it work to connect to Access is the question. I've read it's possible with MSSQL.
My knowledge is very limited when it comes to any Windows related DBs so any advice much appreciated.
Yes, it's possible. I've done it using ODBTP, which took advantage of the ODBC driver on the (Windows) machine that hosted the Access database file.
It's also theoretically possible to use an ODBC driver on the Linux server to read an Access database on a Windows networking share if the Linux box can "see" it. However, I've never had very good luck with Access ODBC on Linux so I wouldn't recommend spending too much time trying to get it working.

Connect to remote MS Access database from Linux Server using PHP

Does anyone know if it's possible to connect and query an MS Access database from a Linux Server using PHP?
If it is possible I'm thinking install ODBC driver on the Linux server, but will it work to connect to Access is the question. I've read it's possible with MSSQL.
My knowledge is very limited when it comes to any Windows related DBs so any advice much appreciated.
Yes, it's possible. I've done it using ODBTP, which took advantage of the ODBC driver on the (Windows) machine that hosted the Access database file.
It's also theoretically possible to use an ODBC driver on the Linux server to read an Access database on a Windows networking share if the Linux box can "see" it. However, I've never had very good luck with Access ODBC on Linux so I wouldn't recommend spending too much time trying to get it working.

Connection error to sql server when doing massive queries with sqlsrv

i was wondering if anyone knows why i am getting the following error.
I have an application doing massive queries to a SQL 2008 Server. The main application runs over PHP on linux , I call many php scripts simultanously to a windows server running PHP over xampp, this server queries the sql database and this is where I am getting the error.
On this windows server I hava PHP 5.4.4 with the sqlsrv extension. I have the sql server configured to handle unlimited connections. however when I send many API calls (thousands) i eventually start getting connection errors like the one below,
Unable to connect to server
I read that mssql conection can be tuned with the max_procs config, however I am using sqlsrv extension instead and I havent found any info regarding this .
Has anyone experienced this issue before.
Thanks in advanced.

No database selected on PHP MySQL

Error: No Database Selected
I have a website that was hosted with ARVIXE (windows 2008 server) and presently with IXWEBHOSTING (windows 2003 server). It was very simple to move. It was a matter to just download/upload the site PHP files and export/import MySQL database and change the config PHP file to point to the new
database information and voila!
Now I am trying to move the site to my own server. Trust me I have no problems with DNS, servers, networking stuff. I've being doing this for 15 years (not programming).
This is my actual server: Windows 2003 STD SP2, IIS6, PHP5.2.12, MySQL 5.0.96, FastCGI 1.5. and all MS Updates.
Now here me out before you conclude that is the code or MySQL permissions... I have read I think all the No Database Selected errors on the Internet including here and is usually a little code modification or missing code or permission issue on the database...but not this one, see the scenarios below and you will see why not.
Scenario 1
PHP Files are sitting in the IXWEBHOSTING servers. The config PHP file points to my own MySQL server it works fine.
Scenario 2
PHP Files are sitting in the IXWEBHOSTING servers. The config PHP file points to IXWEBHOSTING MySQL server it works fine.
Scenario 3
PHP Files are sitting in my Win2k3 servers. The config PHP file points to IXWEBHOSTING MySQL server, I get error "No database selected".
scenario 4
PHP Files are sitting in my Win2k3 servers. The config PHP file points to my own MySQL server, I get error "No database selected".
So I know for a fact it has nothing to do with MySQL permission on my own MySQL server or PHO code as scenario 1 proves it. It seems to be a problem with PHP on my server.
Prior of installing the OLD PHP and MySQ, I had the lastest version of each PHP 5.3.13 and MySQL 5.5.25 and same FastCGI version. I had the exact same problem!!!! The reason why I installed the old versions is because I wanted to match IXWEBHOSTING server versions.
Prior to the above installations, Windows was installed from scratch each time on a hyper-v server. No updates MS updates were done on the server the first attemps and the last installation it has all the MS updates and I still have the same problem.
I had the same problem with Windows 2008 STD, PHP 5.3.13 and MySQL 5.5.25.
PHP is loading all the proper extensions to make the connections to MySQL. I also have PHPmyAdmin running without problems.
I also tried with in the config file and no luck
There is a lot of stuff in the index but this is what is needed to make the connection to the database and the query and where it fails.
config file
<?
$usuarios_sesion="youth";
$host="localhost";
$user="usernamehere";
$pass="passwordhere";
$db="databasehere";
$tabla="users";
?>
Index.php File
<?
require ("enlaces_config.inc.php");
$menu=mysql_query("SELECT id_cat, name_cat FROM categories WHERE access=0 AND published=1") or die ("Can't select categorias MySQL says: ".mysql_error());
?>
At this point I have no idea what else it can be... permissions, maybe but not in MySQL permission, the user has full priviledges to the database. Scenario 1 and 2 proves it too.
If you need to check PHP information let me know. I will post the name of the php file for excution
Help!
The problem is not with all that you have written w.r.t your server.
When you try to fetch data from a database you must essentially follow these steps-
Create a connection
That involves connecting using Database, User Name, and Password, along with Hostname. You can use mysql_connect(), although deprecated.
You need to select the database from that host.
You go for any mysql query using selected db connection in step 2.
I would suggest you to get a good grip on database concepts first and then implementation using php.
Best place to start http://w3schools.com

Categories