Access Sybase database from PHP - php

I have an application based on Sybase database. The application is running on a Windows Server 2003. I tried to fetch the database from the php and it is showing a number of dll files are missing including the php sybase extension. I checked the php extension dir and found that the file exists on the path where it is showing the errors.
Here i would like to mention that i installed xampp 1.8.0 on the windows server and enabled the sybase extension form the php.ini.
I used the following code to connect as mentioned on the php doc
<?php
$link = sybase_connect('SYBASE', '', '')
or die("Could not connect !");
echo "Connected successfully";
sybase_close($link);
?>
== Update ==
It was showing that the following dll files were missing and i downloaded and added them manually.
libcs.dll
libintl.dll
iconv.dll
Now i am getting the following error,
The procedure entry point iconv_open could not be located in the dynamic link library iconv.dll
This error is present from the beginning of enabling the Sybase PHP extension.
PHP Startup: unable to load dynamic library 'C:\xampp\php\ext\php_sybase_ct.dll' - the specified procedure could not be found

When I've seen unable to load dynamic library 'C:\xampp\php\ext\php_sybase_ct.dll' the issue has come down to a) having an old/outdated set of libs or b) using an application that references the 'old' Sybase lib names (with ASE 15, Sybase changed the names of their libs and some apps haven't picked up on this).
For the first issue the obvious (?) resolution would be to download the appropriate set of Sybase libs (which is going to depend on your application code/version as well as the ASE version). [Not enough info in your post to know if this explains your scenario.]
For the second issue there's a relatively easy solution (the following is based on a PHP app that has a Sybase-specific sub-directory containing the Sybase client-side libs):
in a Windows cmd window ..
source the *.bat file for your application [load your app's env]
cd to the Sybase sub-directory named ...\OCS*\scripts
run copylibs.bat
try starting your PHP app again and ...
if the issue is fixed then the php_sybase_ct.dll error message should go away

Related

SQL server error: Unable to connect to your database server using the provided settings

Again I am here with an error, i have connected my PHP with SQL server from an IP Address and it works properly in my local PC. but when i transfer my source codes to my client PC it gives below error:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: C:/xampp/htdocs/SAT_POS/system/database/DB_driver.php
Line Number: 436
but actualy i have included the extension also and set in php.ini, see below:
extension=php_sqlsrv_56_ts.dll
extension=php_sqlsrv_54_ts.dll
the above two lines are included in the php.ini file and the extension directory is also the default one, see below:
extension_dir="C:\xampp\php\ext"
and in CI database code I configured like below :
You have to pick ONE SQL Server database extension ONLY.
You have also loaded one extension that is compiled for PHP 5.4
php_sqlsrv_54_ts.dll
AND one that is compiled for PHP 5.6
php_sqlsrv_56_ts.dll
Pick the ONE extension that matches your currently runnning PHP version
Also did you load the SQLServer client software on your clients PC.
At last with the help of the stack genius who commented on this I have done the work!
Just installed ODBC DRIVER for SQL SERVER on the windows!

'c:/wamp64/bin/php/php7.0.10/ext/php_oci8_12c.dll' - %1 is not a valid win32 application

In order to access an remote Oracle database from php, I had to activate the extension php_oci8_12c. But when I do, it does not appear in the phpinfo().
On the other hand, I get in the php logs the error message:
[13-Jan-2017 08:39:48 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp64/bin/php/php7.0.10/ext/php_oci8_12c.dll' - %1 is not a Valid win32 application
I use php 5.6.25 and wampserver 3.0.6 (64 bit). How can I resolve this?
Well, I faced this error too and managed to fix it.
Before downloading every kind Oracle Client Version just take a look at your http://localhost/?phpinfo settings at Configure Command section.
This will tell, which version of Oracle was used to build your WAMP server.
The image above show this two lines:
"--with-pdo-oci=c:\php-sdk\oracle\x64\instantclient_12_1\sdk,shared"
"--with-oci8-12c=c:\php-sdk\oracle\x64\instantclient_12_1\sdk,shared"
Obviously tell us that InstantClient used is 64 bits.
There are two versions of InstantClient 12.1 x64: 12.1.0.2.0 and 12.1.0.1.0
I tested with 12.1.0.2.0 version and failed.
After that, I tested with old one, 12.1.0.1.0 version and worked.
Download from Instant Client for Microsoft Windows (x64) and extract the files below to "c:\oracle":
instantclient-basic-windows.x64-12.1.0.2.0.zip
instantclient-sqlplus-windows.x64-12.1.0.2.0.zip
instantclient-sdk-windows.x64-12.1.0.2.0.zip
This will create the following folder "C:\Oracle\instantclient_12_1".
Using "Windows Command Prompt" (WIN+R CMD) go to folder above and execute SQLPLUS:
sqlplus [user]/[pass]#[host]:[port]/[service]
You must be able to connect.
Finally, add the "C:\Oracle\instantclient_12_1" folder to the PATH enviroment variable, placing it on the leftmost place.
Close your WAMP server.
Yes close it, because the Enviroment Variable is only read at launch time.
So restarting the services may fail, leading you to a wrong result.
After restart, your PHPINFO would show the OCI8 and PDO_OCI loaded.
I hope it helps!

oracle 11 connection with php 5.5

I am trying to make a connection from PHP Version 5.5.27 to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
Downloaded instant client version 11.2.0.3.0 and linked it in system's PATH variable
Also I have enabled extension=php_oci8.dll in my php.ini
but still not working, I get this error:
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries in C:\xampp\htdocs\test.php on line 3
Here is the step-by-step procedure that helped me connecting Oracle with PHP:
First install Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production. Make sure its working.
Download msvcp110.dll and msvcr110.dll (download dll's only. Don't download them from microsoft.com. Download them from some other source instead).
Copy both files directly into Windows/System32 folder.
Restart Computer.
Install WAMP server.
Make sure both Oracle and WAMP Server are installed in same drives. I have them in C:
Check if WAMP is working. (the W logo turns green).
Once its Green, click on it, go on PHP, then to PHP Extensions.
Now check php_oci8.
WAMP will restart its services.
Now from same menu, check php_oci8_11g
WAMP will restart again now.
Restart your computer.
Download 'instantclient-basic-win-x86-64-11.2.0.1.0'
Extract it in C:.
Go to Control Panel > Environment Variable (Search for Environment Variables in control panel)
Under 'Advanced' tab, click Environment Variables.
In System Variables (section below), Click 'New...'
Fill the form; Variable Name: PATH, Variable Value: C:\instantclient_11_2.
Apply Changes.
Restart Computer.
Oracle and PHP are connected.
Make new database in oracle. Notedown the username, password and service name while creating database.
write your SQL script.
Make php file in wamp/www folder
write php script to fetch data from same database you created in oracle.
in php script, write oci_connect('username', 'password', 'localhost/service name').
save php file and run in in browser you specifed while installing WAMP.

How to connect to remote MSSQL database using php 5.5.19

I have had a problem trying to establish a connection to a MSSQL database I created in Microsoft SQL Server Manager 2008 R2 using php 5.5.19 in XAMPP.
In the php.ino configuration file under extensions, there is commented out a ';extension=php_mssql.dll'. I removed the comment and ran apache in the xampp control panel.
Naturally an error occurred stating ''PHP Startup: Unable to load dynamic library '..\ext\php_mssql.dll cannot be found'. I looked in the ext directory and sure enough it wasn't there. I added the mssql.dll file from
www.dll-files.com/dllindex/dll-files.shtml?php_mssql
,but then I got an Entry Point not found error stating 'The procedure entry point php_body_write could not be located in the dll php5ts.dll'.
After further research, I discovered that mssql_connect was not working since PHP version 5.3: http://php.net/manual/en/intro.mssql.php
I instead tried to use the 'sqlsrv_connect'' function, but I had to install the new drivers from https://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx
After reading the readme, I saw that I needed the libraries php_sqlsrv_55_ts.dll and php_pdo_sqlsrv_55_ts.dll to work with xampp's php5ts.dll in the php folder.
I added the libraries in the php\ext folder and added corresponding extensions to the new dll's and restarted Apache.
I then got an system error 'The program can't start because MCVCP110.dll is missing from your computer. Try reinstalling the program to fix this problem.' Obviously reinstalling isn't an option as I will lose my new dll's so I verified that MCVCP110.dll is in the php folder, which it was.
Please help, I really need to find a way to load the libraries with the 'sqlsrv_connect' function properly so I can connect to a MSSQL database.

connect to mysql database with php issue

I'm going to expand my local project (that used mysql database and php ) to web.
i upload all file and changed all addresses to my server.
but my app wont work and i get the error like this in server Error log:
[10-Feb-2014 04:06:38 America/New_York] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/magickwand.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/magickwand.so: cannot open shared object file: No such file or directory in Unknown on line 0
my app is load some list of goods. then it can be shown detail and edit.
there is no image.
what is this problem and how I can solve it?
You don't have ImageMagick installed at your server.
In order to use the MagickWand For PHP module's functions, you need to install ImageMagick version 6.3.5, or greater, and the MagickWand for PHP extension source code / DLL. For more detail please see here http://www.magickwand.org/

Categories