How to connect PHP to Oracle9i server - php

I read some steps about this one but I can't really get it. I'm using wamp server for this with PHP 5.3.5. I tried to use the php_oci8.dll by checking the PHP>PHP extensions>php_oci8 but I get an error saying
PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.5/ext/php_oci8.dll - The specified module could not be found
When I go to the path the php_oci8.dll is there. How can I fix this? Can anybody give me a steps on how can I configure it so that I can connect to a remote server?

Try to download the latest version of the dll here php_oci8-1.4.1-5.2-vc6-x86.zip

I already figured it out! Here's my solution:
Install Oracle XE in your PC this will give you the latest oci.dll (not php_oci8.dll)
Create a link between your user and the user you will need in connecting to your database.
Restart your PC then try running your code if it's not working copy the oci.dll of your
Oracle XE (C:\Oracle\OUIHome\bin\oci.dll) then paste it in 9i replacing the old one (make sure to have a backup). then restart your PC.
Works fine on me. Thanks for those who help me in solving this one.

Related

Unable to connect to Oracle instant client 19 with PHP

I am just trying to set up a Oracle instant client 19 database connection using PHP and XAMPP.
I have followed several Youtube videos, other stack posts and it still does not show the oci8 module on phpinfo.php. I also recieve the error Call to undefined function oci_connect()
What I have done:
Installed XAMPP with PHP enabled.
Downloaded Version 19.9.0.0.0 Basic x64 from - https://www.oracle.com/uk/database/technologies/instant-client/winx64-64-downloads.html and extracted to C:\ named instantclient_19_9
Set up my environment path = C:\instantclient_19_9
Restarted PC
Downloaded oci.dll from - http://pecl.php.net/package/oci8/2.0.8/windows
Selected 5.5 Safe thread x64
Extracted into C:/xampp/php/ext
Went into php.ini and removed semi-colon from extension=oci8_19
Restarted Apache
Looking in XAMPP/php/ext, there is php_oci8.dll and php_oci8_19.dll extensions there.
Went onto phpinfo.php and nothing is displaying for oci8
Not sure what else I need to do, at this point, all walkthroughs show their phpinfo pages and they all show the oci extension. I tried uninstalling XAMPP and removing all files then trying again but each time it doesn't work so I must be missing something. I have done this for SQLITE and MYSQL and they worked just fine, just oracle.
For extra measures, I have also tried an answer someone suggested in a post and it also hasn't worked:
Add oci.dll, oraociei19.dll, and oraons.dll from C:\instantclient_19_9 to xampp/apache/bin folder. Replace the existing ones.
Restart the Apache

'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!

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 SQL Anywhere by TCP/IP

I'm new in sql anywhere, currently I'm trying to connect using PHP.
This is what I've got so far:
$conn = sqlanywhere_connect ( "UID=usr;PWD=pass;ENG=serv;DBN=bd_name;COMMLINKS=TCPIP{HOST=10.1.1.189:2638}" );
SQL Anywhere is installed on another machine, where I can't run apache, website is running on localhost (xampp). This is only for test, when website would be ready I will connect to correct db.
This is error I've got:
Warning: sqlanywhere_connect(): The SQLAnywhere client libraries could not be loaded. Please ensure that dbcapi.dll can be found in your PATH environment variable. in C:\xampp\htdocs\core\cache\includes\elements\modsnippet\25.include.cache.php on line 21
I haven't got dbcapi.dll file, but I'm not sure I should have it.
In documentation I couldnt find this file (SQL Anywhere 10 which I've got), but for SQL Anywhere 11 I could find pages where was info about this file.
To use sqlanywhere_connect I've download SQL Anywhere module for curren ver. of PHP onto my machine and I've add it to php.ini file.
What should I do? Should I download missing file? Would it be enough or I could get more errors asking for other files?
I had a similar problem and the solution proposed here:
https://groups.google.com/forum/#!msg/sql-anywhere-web-development/zK9Tf-X3cYk/GAoqK2DnB9EJ
worked for me.
Specifically, my xampp + php needed the 32 bit dbcapi.dll but when I installed SQL Anywhere 12 I neglected to check the box to install the 32 bit version as well. Re-installing, chossing "modify" and installing the 32 bit SQL Anywhere 12 got "php test.php" working.
I would down load the missing file and go from there you are using xamp which is pre-built to talk to mySQl I doubt there is any extra .dll in the Instillation to connect with SQLAnywhere

wamp cannot load mysqli extension

WAMP installed fine, no problems, BUT...
When going to phpMyAdmin, I get the error from phpMyAdmin as follows:
Cannot load mysqli extension. Please check your PHP configuration
Also, phpMyAdmin documentation explains this error message as follows:
To connect to a MySQL server, PHP needs a set of MySQL functions
called "MySQL extension". This extension may be part of the PHP
distribution (compiled-in), otherwise it needs to be loaded
dynamically. Its name is probably mysql.so or php_mysql.dll.
phpMyAdmin tried to load the extension but failed. Usually, the
problem is solved by installing a software package called "PHP-MySQL"
or something similar.
Finally, the apache_error.log file has the following PHP warnings (see the mySQL warning):
PHP Warning: Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
PHP Warning: Zend Platform does not support this version of PHP - please upgrade to the latest version of Zend Platform in Unknown on line 0
PHP Warning: Zend Debug Server does not support this version of PHP - please upgrade to the latest version of Zend Debug Server in Unknown on line 0
PHP Warning: gd wrapper does not support this version of PHP - please upgrade to the latest version of gd wrapper in Unknown on line 0
PHP Warning: java wrapper does not support this version of PHP - please upgrade to the latest version of java wrapper in Unknown on line 0
PHP Warning: mysql wrapper does not support this version of PHP - please upgrade to the latest version of mysql wrapper in Unknown on line 0
So, for some reason PHP is not recognizing the mysql extension.
Anyone know why? Any solution or workaround?
I deleted the PHP in program files ad everything started working , the problem that there two installations of pHp
I tried many solutions, and none worked for me. I tried the following solutions:
Restart wampserver
Reinstall wampserver
restart machine
and all other solutions mentioned in this question.
However, none of these worked. Then I found that my PHPMyAdmin was not working in chrome and was working in firefox. So I tried clearing cache, restarting browser etc, but still it would not work.
Then I deleted all the files from C:\wamp\tmp and then tried again, and it works. I am not sure why it works, but here is what I think. The session was cached and not getting cleared. So as soon as I deleted all files in this directory all the sessions were deleted and hence it worked fine.
First, make sure that the php.ini file is loading the mysqli extension.
If you are using WAMPServer, click on the icon in the system tray, go to PHP -> PHP Extensions and make sure it is checked. If not, go into the php.ini file and make sure that the line: extension=php_mysqli.dll is uncommented (eg, remove the ; if it exists). If that line does not exist, add it.
If this still does not work, double check that the right php.ini file is being loaded.
To do so, view your phpinfo() (Here for WAMPServer). Scroll down to the Loaded Configuration File row and see which php.ini is being loaded.Make sure it is the right file. If you're using WAMPServer, it should be(WAMP INSTALL FOLDER)\bin\apache\Apache2.2.11\bin\php.ini. By default, it isC:\wamp\bin\apache\Apache2.2.11\bin\php.ini`.
If a different php.ini file is being loaded, just rename it to something else so that PHP will try and find the file somewhere else. There should be a way to specify which on eyou want to use, but I forget exactly how to do that...
If this still doesn't work... Try messing around with phpMyAdmin's settings, or using another answer, but I'm afraid I can't help beyond this.
I was running WAMP with two PHP versions 1) 5.2.9 and 2) 5.2.13.
As per site requirement i needed to change PHP version to 5.2.9 from 5.2.13. after swapping PHP version, error was "mysqli extension is missing". after debugging long time i get to know it was due to wrong "extension_dir" path in php.ini file.
So i changed its value:
Old: "extension_dir" c:/wamp/bin/php/php5.2.13/ext/
New: "extension_dir" c:/wamp/bin/php/php5.2.9/ext/
Restarted All services in wamp server, then it's fixed.
I had the same problem. I had WAMP server installed. All was working fine. Then one day I restarted my computer and it just stopped working! I tried desperately going through all help posts and doing them but nothing worked.
What they usually suggest you do is, first go to your php.ini file and make sure your 'extension_dir' is properly set. Then to make sure these two lines are not commented (remove the ; infront):
extension=php_mysql.dll
extension=php_mysqli.dll
Then some suggested that I download fresh copies of these two files but none worked. I also tried uninstalling everything (php/mysql/apache) and reinstalled fresh copies of WAMP server several times but with no luck.
Finally I managed to find an alternative solution. I switched to 'easyphp' (http://www.easyphp.org/). This is something very similar to WAMP. First I made backups of my sql databases so I can reload them on the new installation.
Then I installed 'easyphp' and everything seems to work fine. I reloaded my sql databases from my backup and now things are back to normal.
I hope someone suffering from a similar prob. will find this useful. If someone has really found a fix to make WAMP server work. Pls do be kind enough to post it here so many will benefit.
in wampserver go to php.ini. open the file and uncomment extension=msql.dll by removing semicolon(;) for respective operating sytem.
Just add in your php.ini:
[PHP_MCRYPT]
extension=php_mcrypt.dll
[PHP_MYSQL]
extension=php_mysql.dll
[PHP_MYSQLI]
extension=php_mysqli.dll
Also setup the mysql password:
SET PASSWORD FOR root#localhost=PASSWORD('your_password');
And the phpmyadmin mysql password in config.inc.php:
$cfg['Servers'][$i]['password'] = 'your_password';
Had the same problem, with wamp. Try to exchange your current version of php.ini with a backup. There is one in: wamp\bin\php\php5.3.0phpForApache.txt. Worked for me.
Just wanted to chime in on this one. Using Wamp Server 2.0, and using Zend Studio with Zend debugger for development.
I wasn't able as of yet (will get back to it at some point) to get the zend debugger working with php 5.3. So in wamp I loaded an earlier php version, 5.2.11. I was getting the same error when acessing php my admin.
What I had to do was change the php.ini file value for "extension_dir" to c:/wamp/bin/php/php5.2.11/ext/ to match the version of php I was using. After that it was all good.
I had this problem and spent 2 hours trying all the solutions online, none worked.
Tried this, and it woked:
Change
mysql.default_host =
to
mysql.default_host = localhost
and restart WAMP. pay attention if you are using mysqli or not.
I had the same error. When I increased the script memory size and enabled E_ALL then restarted the server, I got that error in phpmyadmin. All I had to do to fix it was restart my computer!
I got this problem for a long time. Tried all I've read on forums and this finally worked for me:
Open your php.ini (I assume you've got the good one that is loaded...) and find this line
mysqli.default_port = 3306
change for
mysqli.default_port = 80
Restart all services
Go to localhost/phpmyadmin -> won't work
Reopen the php.ini file and retype this
mysqli.default_port = 3306
Restart all services
Worked for me.
For me worked this, after searching all logs/internet/every non-normal things.
You have to register dl by:
Through application:
WAMP -> PHP settings -> enable dl
or
# php.ini #
; 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
I have just installed WampServer, and faced same problem. I have found solution, that works for me, it is ridiculously simple.
Disable PHP extension php_mysqli.
Restart WampServer, visit local phpmyadmin.
Enable php_mysqli back.
Repeat step 2.
After few page refreshes, remaining errors plates (about MySQL and sqli) had gone.
i tried hard by
installing the wamp again and again,
by checking the php.ini file,
by restarting the machine,
by replacing the index.php file,
but none works.
then i go to the wamp/temp and deleted all files and it works fine now.
I had path variable in windows set to some random version of php.
The fix was to update it and set it to the folder within my wampserver installation:
C:\wamp64\bin\php\php5.6.38
Then I realized this is wrong also for my specific case, and I should actually be running the script from within vagrant. Live and learn.
I had this issue because of a different reason:
Check the PHP Error Log(Get from the Wamp Tray -> PHP -> PHP Error Log.
I had a syntax error in the php.ini file while I was editing the file.
Check the log and clear the error. This will open your PhpMyAdmin properly.
Check your phpForApache.ini file's extensions. This file should be same as your php.ini file.

Categories