sqlsrv driver for Windows PHP PDO SQL server - php

I've added and enabled in php.ini given .dll, got Microsoft SQL Server 2012 Native Client, previously configured it successfully on 2 other machines, but on my local one It just says could not find driver have I missed something?
php.ini: extension=php_pdo_sqlsrv_54_ts.dll
script: new PDO("sqlsrv:Server={$_dbConfig['server']};Database={$_dbConfig['dbName']}", $_dbConfig['username'], $_dbConfig['password'])
In php error log I get strange: [08-Nov-2014 18:18:31 UTC] PHP Warning: PHP Startup: in Unknown on line 0 but have no idea why, php.ini itself is configured as my other working machines.

I had to change in php.ini:
extension_dir = "ext" to extension_dir = "C:\PHP\ext"
Got it from here: https://serverfault.com/a/240012/193005

Related

PHP Thread class not founded with PHP7

I am trying to enable Thread with PHP script. I have followed the following steps for enabling PHP thread.
Step 1:- Download and unzip pthread lib from here
Step 2:- Copy php_pthreads.dll and paste into the php\php7.2.14\ext and php\php7.2.14\ folder.
Step 3:- and pthreadVC2.dll and paste into the apache\apache2.4.37\bin
Step 4:- Enable thread in php.ini which is located in apache\apache2.4.37\bin and after updating its look like something below.
; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
; http://php.net/enable-dl
enable_extension=On
extension=php_pthreads.dll
Step 5:- Enable thread in php.ini in which located at \php\php7.2.14
; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
; http://php.net/enable-dl
enable_dl = On
extension=php_pthreads.dll
Step 6:- I have restarted wampp server with all services.
Still, I am getting the error as
Fatal error: Class 'Thread' not found in {PHP file with location with line number}.
Update
I have changed DLL files and restarted a server as we discussed and redirect to a new error as below.
[24-Jan-2019 10:29:20 UTC] PHP Fatal error: The apache2handler SAPI is not supported by pthreads in Unknown on line 0
[24-Jan-2019 10:29:20 UTC] PHP Fatal error: Unable to start pthreads module in Unknown on line 0

Error on https even if I enabled openssl

I'm trying to do a simple script like this with easyphp installed on my pc:
<?php
include_once ('C:\EasyPHP-Devserver-17\eds-binaries\php\php713vc14x86x170802204733\simple_html_dom.php');
$html = file_get_html('https://www.sports-reference.com/olympics/summer/1896/');
echo $html;
?>
I enabled in php.ini the php_openssl extension but I still get the error:
Warning: file_get_contents(): Unable to find the wrapper "https" - did
you forget to enable it when you configured PHP? in
C:\EasyPHP-Devserver-17\eds-binaries\php\php713vc14x86x170802204733\simple_html_dom.php
on line 75
What else could I do?
I have this from phpinfo:
I tried to put php.ini files into c:\windows but it still does not work.

Windows PHP 5.6 built in server SQLite3

I have PHP 5.6 installed on windows 7 and I used the built in server to run websites locally for testing. I want to connect to a Sqlite3 file and I've uncommented the appropriate lines in the php.ini file in my C:\Program Files\php folder. I still get this error when trying to view the page on my local server: Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\Users\USERX\Documents\pageloadbasic.php:13 Stack trace: #0 C:\Users\USERX\Documents\pageloadbasic.php(13): PDO->__construct('sqlite:db/lhblo...') #1 {main} thrown in C:\Users\USERX\Documents\pageloadbasic.php on line 13
Why do I get this error?
A couple of notes: my phpinfo file shows:
Configuration File (php.ini) Path C:\Windows(for some reason this always defaults to C:\Windows even if there is not php.ini file in there)
Loaded Configuration File C:\Program Files\php\php.ini
But there is no php.ini file in C:\Windows. Also, my php folder does not include a php_pdo.dll in the ext folder, but I added one that I extracted from the pecl-5.0.5-Win32 archive as instructed in some other sites.
I added extension=php_pdo.dll in my php.ini file.
I uncommented extension=php_pdo_sqlite.dll.
I uncommented extension=php_sqlite3.dll.
I have these two lines in my php.ini which related to sqlite:
[sqlite]
; http://php.net/sqlite.assoc-case
;sqlite.assoc_case = 0 (I did not change anything on these two lines because I'm not sure what it is for...)
[sqlite3]
sqlite3.extension_dir = "ext" (on this line I added the "ext" directory as suggested on another post)
I have this in my php code to connect to my db file using pdo:
$db = new PDO('sqlite:db/xxxxx.db');
What am I missing? What do I need to do to get PDO to work with Sqlite3?
Problem solved. Even though I had properly uncommented all my dlls, and uncommented the sqlite3.extension_dir = "ext", you need to specifically uncomment the windows ext location on the line following ; On windows:'
extension_dir = "ext"`
And then restart your server.

PHP Startup: Unable to load dynamic library php_sqlsrv_54_ts.dll

I'm hopelessly stuck on this: I'm trying to connect to MS SQL Server 2008 R2 with PHP, but I can't seem to get the configuration right.
Windows Server 2012 Standard
MS SQL Server 2008 R2
PHP:
Version: 5.4.31
Branch: HEAD
Build: C:\php-sdk\php54dev\vc9\x86\obj\Release_TS
All I need is to call a PHP script from command line and save result to database. But I get following error:
C:\ankety>php uctenka.php 1012814411
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php-5.4.31-ts\ext\php_sqlsrv_54 in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\php-5.4.31-ts\ext\php_sqlsrv_54_ts.dll in Unknown on line 0
PHP Fatal error: Call to undefined function sqlsrv_connect() in C:\ankety\zpracuj.php on line 157
Fatal error: Call to undefined function sqlsrv_connect() in C:\ankety\zpracuj.php on line 157
Now, of course there is correct version of php_sqlsrv_54_ts.dll in correct folder (C:\php-5.4.31-ts\ext\). In php.ini I changed:
extension_dir = "C:\php-5.4.31-ts\ext\"
extension=php_sqlsrv_54_ts.dll
When I run the script it also says that MSVCP100.dll is missing on a computer, but it is in fact there - in C:\Windows\System32 and I also tried C:\php-5.4.31-ts\ext\ but without luck.
In phpinfo() there isn't loaded sqlsrv part.
I don't know where I could possibly went wrong, I searched this problem but none of those solutions worked. Hope someone has an idea how to fix this.
For those, who don't want to waste time as myself - try restarting the IIS server :-)

phpwebsocket - Undefined Function socket_create() - Have php_sockets enabled on Windows/WAMP

I checked out the PhpWebSockets project from here:
https://code.google.com/p/phpwebsocket/
It's in its own project on my localhost (Windows 7 64-bit) box, inside of a WAMP server. I issue the following command in Windows Command Line to run the server.php file:
C:\wamp\bin\php\php5.4.12\php.exe C:\wamp\www\phpwebsocket\server.php
But it results in the following error message:
PHP Fatal error: Call to undefined function socket_create() in C:\wamp\www\phpwebsocket\server.php on line 58
My WAMP instance DOES have the php_sockets extension enabled (since I saw this similar question who had that problem).
Anyone know what I could possibly be doing wrong?
Found the answer in another thread:
Error with PHP Websocket and Wamp Server
Turns out running the file on the command line means it uses a different php.ini file than the WAMP server does. Seems stupid, but turned out php_sockets wasn't uncommented in that php.ini file, and removing it removed the error with it.

Categories