Installing PDO driver for MySQL on windows - php

I am using quickphp to process my php file with was previously processed using wamp server. I also installed mysql for the database. I am using pdo with was working fine on wamp but i get this error while trying to access the site now.
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\Users***\Documents***\includes\database.php:3 Stack trace: #0 C:\Users***\Documents***\includes\database.php(3): PDO->__construct('mysql:host=loca...', 'root', 'root') #1 C:\Users***\Documents***\menu.php(7): require('C:\Users\selfse...') #2 {main} thrown in C:\Users***\Documents***\includes\database.php on line 3
How can i install pdo driver for mysql. I have searched the net but still clueless.

It's a common problem, and one I've solved for a few people recently. Make sure you check the following list to ensure you have put them in place:
Ensure both php_pdo_sqlsrv_54_ts.dll and php_sqlsrv_54_ts.dll are in
your /ext directory. Ensure the following lines are present in your
php.ini file: extension=php_pdo_sqlsrv_54_ts.
dll & extension=php_sqlsrv_54_ts.dll.
Ensure you have installed VC++ redist located here. Make sure you download and install the x86
version regardless of the architecture of your OS otherwise this
will not work.
Check these things and come back to me with an answer.

Related

PHP grpc extension not working on WAMP, despite working on CLI

After about a week of trying to install grpc for Firestore with PHP, I managed to get it working, however only when ran in terminals / cmd. This php.ini / environment is on my desktop in a folder and when executing files with firestore commands it works. No errors.
However, when in WAMP, it crashes the page with:
Fatal error: Uncaught Google\Cloud\Core\Exception\GoogleException: The requested client requires the gRPC extension. Please see https://cloud.google.com/php/grpc for installation instructions. in D:\wamp64\www\karma\vendor\google\cloud-core\src\ClientTrait.php:76 Stack trace: #0 D:\wamp64\www\karma\vendor\google\cloud-firestore\src\FirestoreClient.php(139): Google\Cloud\Firestore\FirestoreClient->requireGrpc() #1 D:\wamp64\www\karma\functions.php(32): Google\Cloud\Firestore\FirestoreClient->__construct(Array) #2 D:\wamp64\www\karma\Firestore.php(8): Firestore->__construct('test') #3 {main} thrown in D:\wamp64\www\karma\vendor\google\cloud-core\src\ClientTrait.php on line 76
Now what is really weird is that I copied the directory from desktop and literally pasted it into the WAMP PHP area and there is no difference. It even says in the config that php_grpc is loaded! I dont think the bottom dlls are needed so I don't think its an issue they're missing but I find it incredibly strange the same directory on the desktop will run php files from the command line but not in WAMP. WAMP is 64 bit and so is the plugin. PHP version of wamp was 7.0.1 but I replaced the whole 7.0.1 folder with the new 7.4.x version as with the plugin of that version.
Why would it say its loaded and yet say it isnt?
I too have have the same issue.I tried all possible ways to fix it.The extension is loaded in waamp but the php shows missing error.
I had to completely reinstall wamp to fix this error, in a new directory, reinstall php and made sure I had the correct grpc version. I have no idea what caused the error, but try every recent grpc version (I think there is four) and ensure that in your config file every addition copies the format.
I had a new php install outside of WAMP which worked, but as wamp has it's own that was bugged for me

Connect PHP Oracle Database

I've been trying to connect the oracle SQL Database for my PHP Project. I have followed along the steps listed online as well as tried following along with this tutorial.
I have tried:
Installing appropriate Instant Client version 12.1 and adding to system PATH
Un-commented the line relating the oracle database in php.ini
Downloading and replacing the DLL files under xampp/php/ext with the ones from PECL
This still showed an "oci_connect()" could not be recognized.
Versions
OS Version: Windows 10 Pro
XAMPP: x64
PHP version: 7.2.12 Architecture: x86
Instant Client: x64 (Tried with x86 as well but no difference)
However, I have not been able to troubleshoot and despite the above attempts the "oci_connect()" function doesn't get recognized. Any help or guidance will be appreciated.
Fatal error: Uncaught Error: Call to undefined function oci_connect() in C:\xampp\htdocs\test\scriptdemo.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test\scriptdemo.php on line 7
the xampp runs on x86 or x64 version? an the oracle client should be in sync with xampp - same version!

PHP 7 SQLSRV driver doesn't load

I been trying to connect to my local MSSQL database using php.
Right now I am stuck at installing the correct drivers for php to work with MSSQL.
SO far I have:
1.Downloaded and setup Xampp
2.Downloaded the the SQLSRV driver at:https://github.com/Microsoft/msphpsql/releases/tag/v4.3.0
3.Placed the files within my extension_dir and double checked php.ini varible to point to the correct folder.
4. Manually added
extension=php_pdo_sqlsrv_71_ts.dll
extension=php_sqlsrv_71_ts.dll
to the list of extension within php.ini.
Yet I am still seeing the same Fatal error and a boolean checking if the driver has been loaded returns false:
bool(false)
Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in
C:\xampp\htdocs\firsttest\api.php:9 Stack trace: #0 {main} thrown in
C:\xampp\htdocs\firsttest\api.php on line 9
Did I miss a step? I have been following different guidelines and some of them seemed outdated. I tried installing ODBC driver and the installer said that I had a higher version. Therefore I expect that shouldn't cause any problems.
By double checking everything I realize that Xampp always install as a 32-bit application. Therefore i should've taken the 86-bit version of the .dll files instead of the 64-bit.
Atleast this solved the problem for me.

How to update php version 5.3.8 into php version 5.6

I use Facebook integration using CodeIgniter and I use PHP version 5.3.8
and when I click on Facebook login page it will show the error.
"Fatal error: Uncaught exception 'Exception' with message 'The
Facebook SDK v4 requires PHP version 5.4 or higher.' in
C:\xampp\htdocs\coaherr_test\autoload.php:32 Stack trace: #0
C:\xampp\htdocs\coaherr_test\fbconfig.php(4): require_once() #1 {main}
thrown in C:\xampp\htdocs\coaherr_test\autoload.php on line 32"
How to resolve this issue.
backup Your all htdocs files and Mysql databases(keep backup outside XAMPP folder. ex: place it on another drive).
Uninstall XAMPP completely
and Download Setup here
Install it and place your files and databases.
Upgrade your xampp
Download latest portable version of XAMPP .
Extract the archive(not where XAMPP already installed).
Copy the PHP folder from the extracted archive.
Keep back up of htdocs folder which is in installed XAMPP directory. ...
Paste the htdocs folder which you copied from the extracted archive.

updating php to 5.3 not working

I get this error when using some library called: Mcrypt extension:
Fatal error:
Uncaught exception 'Exception' with message 'I cannot generate a secure
pseudo-random key. Please use PHP >= 5.3 or Mcrypt extension'
in C:\xampp\htdocs\PoliticalForum\Administrator\secure_session.php:74
Stack trace:
#0 C:\xampp\htdocs\PoliticalForum\Administrator\secure_session.php(107): SecureSession->_randomKey(32)
#1 [internal function]: SecureSession->open('C:\xampp\htdocs...', 'PHPSESSID')
#2 C:\xampp\htdocs\PoliticalForum\User\User\headerSite.php(31): session_start()
#3 C:\xampp\htdocs\PoliticalForum\mainHome.php(14): include_once('C:\xampp\htdocs...')
#4 {main} thrown in C:\xampp\htdocs\PoliticalForum\Administrator\secure_session.php on line 74
I found the class in this link:
secure session
I dont understand what version of php do I have!?!? and why hasnt the php updated, I have only updated my xamp to the newest version right now..
Note: there is no mistake in the class as it was made by one of Oreilly books' author and was used and recommended by a few people in here.
You can find your php version on the command line using: php -v
You can find out your php version, loaded extensions, and just about everything about PHP by putting the following in a file and calling it from your web browser:
<?php phpinfo(); ?>
Of course, don't leave that up on your production server.
As for the error, you need to find your php.ini, which will be at C:\xampp\php\php.ini and uncomment or add the line extension=php_mcrpyt.dll
You might want to have a peek in C:\xampp\php\extensions\ and make sure that dll actually exists. If not (and you have verified you do have PHP 5.3) you can go download the "Zip" version of the windows installer which matches your version, unzip it, and then simply copy that file to your extensions.
EDIT:
I had a look at the php manual for mcrypt and found this: "mcrypt is built in for PHP 5.3.x on windows, you don't need to do anything with a dll anymore."; I think it's entirely possible that you upgraded PHP to a different directory than your XAMPP install; check those versions (http://localhost should take you to the xampp panel where you can find phpinfo() in the sidebar)
If you get this message and you have PHP 5.3 or later. You have not in your php.ini file enabled the OpenSSL extension.
What you need to do is to have the following line in your php.ini file:
extension=php_openssl.dll
I asume that you are using windows, other wise change the extension accordingly

Categories