I'm attempting to insert rows in table in a database hosted in MS SQL Server 2016 installed in my local computer.
Here is my snippet $dbc = mssql_connect('MwangiCJ-PC/mwangi','sqluser','xxxx','mydb');
I have tried out the answer from
mssql_connect() with PHP5 and MSSQL2012 Express but I still get the error Fatal error: Uncaught Error: Call to undefined function mssql_connect()
When i run a simple phpinfo() I can see that I already have both sqlsrv and pdo_sqlsrv available.
Am I missing anything else? Please help. Thank you.
From the PHP docs:
Warning
This function was REMOVED in PHP 7.0.0.
Alternatives to this function include:
PDO::__construct()
sqlsrv_connect()
odbc_connect()
Related
I'm using PHP to read encryted file using opensll.
when doing
openssl_pkcs12_read($storedfile, $certificateinfo, $passwd)
in my script, error came out is :
Fatal error: Call to undefined function openssl_pkcs12_read()
I'm trying to install openssl extension for my Suse Linux Enterprise Server 11.
Can anybody help me how to install openssl extension in SLES. or how to solve this problem.
thanks
I am running MAMP and attempting to connect to ibm db2, however running into issues. It seems db_connect and odbc_connect are unavailable. How do I resolve? PHP version 7.2.1.
Uncaught Error: Call to undefined function odbc_connect()
I appreciate any guidance. thanks in advance for your help.
I am trying to connect with PHP to SQL server. I have installed Microsoft ODBC Driver 13 for SQL Server and I have test it using 'isql' command. Now when I am trying to connect to the server in PHP it always crashes and says "http error 500". Here is the code:
<?php
$server = merkur.edikt.local;
$database = ITServiceE;
$connection = odbc_connect("Driver={ODBC DRIVER 13 for SQL Server};
Server=$server;Database=$database;",
'user',
'PW'
);
echo "connected";
?>
I am using Ubuntu 16.04 server and Apache2 and PHP 7.
I think it might be problem with permissions for the Apache(if the Apache can access the ODBC Driver) but I am not really sure how this works.
EDIT:
Here is the log from Apache errors:
PHP Notice: Use of undefined constant merkur - assumed 'merkur' in /var/www/html/index.php on line 2
PHP Notice: Use of undefined constant edikt - assumed 'edikt' in /var/www/html/index.php on line 2
PHP Notice: Use of undefined constant local - assumed 'local' in /var/www/html/index.php on line 2
PHP Notice: Use of undefined constant ITServiceE - assumed 'ITServiceE' in /var/www/html/index.php on line 3
PHP Fatal error: Uncaught Error: Call to undefined function odbc_connect() in /var/www/html/index.php:4\nStack trace:\n#0 {main}\n thrown in /var/www/html/index.php on line 4
and the file odbc.ini is empty and odbcinst.ini looks like this:
[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0
Threading=1
UsageCount=2
Call to undefined function odbc_connect() means that your PHP system doesn't have any function with that name.
Since it isn't a user function written in pure PHP but a function from a PHP extension, that means that you haven't installed such extension. It's worth noting that the PHP extensions is not the same as the SQL Server driver (you need both).
Your code also contains some undefined constants which I guess are meant to be strings. I strongly recommend you enable full error reporting in your development box so you don't need to check the error logs to learn about simple errors.
i have a problem with function oci_connect. now, i used xampp version 5.6.14-4, i've tried to uncomment this code like the suggestions in other posts on stack overflow
extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client
extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client
i already restart the xampp, but still have the same error..
Fatal error: Call to undefined function oci_connect() in
C:\xampp81\htdocs\aaa\inc\db.php on line 71
is there any step that i missed? can you help me?
thank you so much :D
you can also see this answer from this question
here is tutorial of installing oci8 drivers for PHP
my answer for same question please review this
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 :-)