Sybase extension doesn't work - php

I'm currently working on a project that has to write to both MSSQL and a Sybase database.
I'm working on a Microsoft Server 2008 R2 server with IIS 7 and PHP installed (cause I've got to work in PHP.)
When in IIS-management I go to the PHP manager, and try to activate the sybase extension (php_sybase_ct.dll). It gets transferred to the activated group, but when I run my script I keep getting "undefined function sybase_pconnect();"
What am I doing wrong? The .dll is in place, it is activated in the .ini file. What is the problem?
Hope someone can help me, cause from looking around the internet, I've seen a lot of problems with PHP and sybase.

The PHP client download page for Sybase states
The PHP modules require SQL Anywhere 10.0.1.3767 or greater.*
You can download the SQL Anywhere database client here.
If the SQL Anywhere client libraries are missing (or not found by PHP), you'd get exactly the symptoms you're getting.

Related

Sqlsrv extension for php 5.6 x86 and Windows Server 2012

I've been running in circles for about three days now. I've just set up a local SQL database and I transferred some php code I'm trying to run on it. Problem is, this php code uses the sqlsrv library and runs on a slightly older version of microsoft server.
No matter what I do, I can't get sqlsrv to load. I have quadruple checked my php.ini file, I had this problem with PHP 7, read some resources online that said sqlsrv doesn't work with php7, so I switched to php 5.6. I've tried the microsoft driver for sqlsrv for this php distribution. I've downloaded the SQL server native client.
Through all this, I can't get phpinfo() to load up sqlsrv. I've read various sources saying that sqlsrv isn't available for this version of PHP either, but I want a straight answer before I go through the motions of installing a different php.
Any help is appreciated. I've been through a lot of stack overflow questions and still couldn't find a straight answer, I'm happy to provide more information if required. (Also, I'm a noob in this kind of development, so forgive me if any of this is unclear)
Thank you!
My solution:
I ended up using an "unofficial" sqlsrv extension found here: https://onedrive.live.com/?id=669EE24817961774%21123&cid=669EE24817961774
I think I have an odd combination of 32 bit php 5.6 and Windows Server 2012. Hopefully this helps someone!

How to get SQLSRV on Xampp working with Medoo?

I got a PHP project which uses Medoo for accessing a database on MS SQL Server 2012. I used to test my project on the same server, but since copy-pasting through remote desktop got kinda annoying and inefficient, I wanted to move on a local system, so I installed Xampp (with PHP 5.6.19 VC11). Since I still need to use the server database, I first encountered the problem that the PDO MSSQL extension is not available anymore, and my script failed to send a query to the database. So tried using the SQLSRV 3.0 extension instead (5.4 thread-safe - why isn't there a version 5.6? Is 5.4 supposed to be forward compatible?), which still sends me an uncaught exception with message 'could not find driver', thrown from the PDO constructor and forwarded through Medoo. I'm not sure if this fails on Medoo, the driver, or something else. Moving the database to phpMyAdmin is no option... Has anyone an idea how I can solve this?
All information you need are on this this web page https://msdn.microsoft.com/en-us/library/cc296170(v=sql.105).aspx.
As you can see you need version 3.2 for PHP 5.6 support. I found download link and information about adding SQLSRV extension to php.ini for you.
https://www.microsoft.com/en-us/download/details.aspx?id=20098
https://msdn.microsoft.com/en-us/library/cc296203(v=sql.105).aspx
Finally you have to install Microsoft ODBC Driver 11 for SQL Server.
In short, download SQLSRV 3.2, add PDO extension to php.ini (choose right version for your PHP), install Microsoft ODBC Driver 11 for SQL Server on your local enviroment.

Connect to a remote Windows Sybase database from Ubuntu via PHP

Ubuntu 12.04 LTS Precise
I'm trying to use PHP to connect to a remote Windows Sybase database. Let us assume Windows 7 Enterprise SP1. I'm currently doing this in PHP:
$db = sybase_connect("10.1.208.111", "$user", "$pass");
And I'm getting an error of:
Warning: sybase_connect(): Unable to connect to server: 10.1.208.111
I understand that the server I'm connecting to (10.1.208.111), needs to be in the interfaces file. I'm trying to figure out where that is, or even if I have one on the Ubuntu server (I'm still new to linux itself). I read that the path for the file is located in the SYBASE environmental variable. I don't know where that is either. Can anyone shed some light? I can offer more information if you need it, I just don't know what you need right off the bat.
PS: The windows machine has Micros RES installed on it. That's the database I'm trying to pull data from. Not sure if that matters.
The default installation directory for Sybase ASE in windows is C:\sybase, so your interfaces (interfaces.ini) should be located there.
For SQL Anywhere, the interfaces file is called SQL.ini, and it's location varies, but you should be able to do a search of your system drive to find it.
For SQL Anywhere you probably want to use the PHP apis that are provide by SAP Sybase. The SQL Anywhere documentation is a pretty good place to start, as it covers all the pieces that need to be installed to get SQL Anywhere to talk to PHP.
SQL Anywhere 11: SQL Anwhere PHP API
You may also be able to find good information over at the SAP Community Network site for SQL Anywhere.

Access DB PDO not working in Windows Server x64 edition

Guys I am really stuck up here with this Access DB. I made a php application for a company, the record exporting to MS access in the web application is giving me headache.
I installed Xampp 1.8.1x32 and MS office 2010 32bit professional in their Windows 2008 64 bit version server, everything is working fine! I enabled extension=php_pdo_odbc.dll in the php.ini and I tried to export data from mysql to accdb file using php PDO, but it's not inserting data into the accdb file.
I even tried adding a system DSN to the accdb file in both ODBC 64bit and ODBC 32bit by installing "Access Database Engine x64" and "Access Database Engine x32", but still out of luck. The same mysql to accdb data exporting is working fine in my win7 x64 and ms office 2010 x32 even without installing access database engine and without setting DSN!
Kindly let me know whether there is some other way out to insert data into accdb using PDO in Win 2008x64 server edition. Should I install any special access database edition in win 2008, or should I enable something to make it work?
Sorry for this lengthy and twisted post :p I didn't find solution anywhere else in the internet. Kindly help!
Update: There is no PDO or php errors displayed. just it's not working!
I experienced the same problems. I was able to read and display records but INSERT had no effect, no error was thrown either. The thing is, I kept trying to execute an SQL statement with the values already filled out. Once I tried the prepare and execute statements with actual parameters it did work. I have no idea why it behaves this way but it seems like you can't directly execute INSERT statements?
Btw I previously tried 'prepare - execute' with no arguments as well ( as the data was filled out in the query already ). Glad it only took me 3 hours of trial and error! :(

Cannot find php_sqlsrv extension - 5.3, threadsafe

I've followed the answer to this question to the letter:
Connection between MSSQL and PHP 5.3.5 on IIS is not working
I'm using XAMPP with threadsafe 5.3. I've copied the files to the extension directory (while leaving them in the /php folder) and I've added the extension lines:
extension=php_sqlsrv_53_ts.dll
extension=php_pdo_sqlsrv_53_ts.dll
When I do this, Apache fails to start, giving me errors in eventvwr like:
Application popup: Warning : PHP Startup: Unable to load dynamic library
'C:\xampp\php\ext\php_sqlsrv_53_ts.dll'
- The specified module could not be found.
Except, obviously, that that file DOES exist in that spot, and php.ini is pointed at that extension directory.
What's the problem?
Windows reports this when a shared lib dependency of what you're loading is missing. Use depends.exe to view the dependencies of php_sqlsrv_53_ts.dll and make sure it's either previously loaded or in the shared library search path.
http://www.dependencywalker.com/
See below url
php_sqlsrv.dll: gives error when checking PHP version but extension works
Read it:-
Since PHP 5.3, Microsoft has a new driver for windows :
http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx
Maybe you can try this version, which seems quite recent (06/2011)
Hope that helps !
Sadly, none of the answers addressed the issue or were avenues I had already explored.
I have decided to use the ODBC drivers with a SQL Server connection string, which seems to work fine, minus the fact I can't use MSSQL and SQLSRV native functions.
I have written a page that might help when installing the SQLSRV driver:
http://robsphp.blogspot.co.uk/2012/09/how-to-install-microsofts-sql-server.html
Unfortunately the instructions got complicated when MSFT removed the download for the old XP/2003 driver (version 2.0), so read the whole page before starting.
Wrong technology, but I was having problems getting WAMP to connect to MSSQL, with the same types of errors.
I fixed the problem by installing the 32-bit version of WAMP (instead of 64, even though we were on a 64-bit system).
Even if that's not applicable to the OP, I hope someone finds this helpful!
I was getting the same error messages when I started the Drupal 7 stack after installation. I am using VM Ware with Win 7 x64 and acquia-drupal-win-7.31.36-6159.54300.
I went to the PHP site http://php.net/manual/en/sqlsrv.requirements.php and installed the x64 Package.
steps
1) Stop Drupal Stack
2) run the file: sqlncli.msi
3) restart Drupal, and no error messages.

Categories