PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, May 16, 2022

[FIXED] How to connect to MySQL using PHP PDO in easyphp 16.1.1

 May 16, 2022     easyphp, mysql, pdo, php     No comments   

Issue

I'm trying to move over to PHP7 and use the latest EasyPHP but I can't for the life of me figure out how to connect to MySQL using the PDO

I've set up a working directory: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\TechMexv3 with cURL

I've installed all my database tables in phpMyAdmin which has worked fine

I'm now trying to connect with the following:

$DBH = new PDOEx('mysql:host=localhost; dbname=techsmex; charset=utf8mb4', 'root', '');

And I'm getting the error: could not find driver

Do I need to install a driver from somewhere that doesn't come with EasyPHP?


Solution

In EasyPHP Devserver 16.1.1, the default configuration file for php (php.ini) has the PDO MySQL extension disabled by default.

You have to enable it and restart your server before you can connect to your database.

In order to do this,

  1. Go to your EasyPHP Devserver Dashboard;
  2. Stop your HTTP Server in case it is running;
  3. Select the version you are using for PHP in the left panel;
  4. Open the corresponding folder for your PHP.

In it, is your php.ini file. Open the file with your preferred text editor, and search for ;extension=php_pdo_mysql.dll

Simply remove the semicolon in the beginning so the extension gets activated upon restarting of the HTTP server. Go to your dashboard's main page, and restart the HTTP server.



Answered By - Daniel Nora
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing