I am currently trying to write a PHP script to connect to an Oracle database. The reason I am using PHP is because I need to connect the Oracle database with my current CRM system, written in PHP/MySQL.
The PHP is hosted on 1&1 hosting, which is an external server. I read that I need to enable the extension php_oci8.dll to connect using oci_connect(), but I cannot do so since I do not have root privileges. Did a search, and couldn't find the DLL either.
Is there any other way around this? Any help greatly appreciated, please let me know if you need more information. Thanks!
1) 1&1 will have Linux, so you will have to use linux names for extensions. In this case name of extension will be php_oci8.so
2) create the php.ini in root directory and put the following line
extension=php_oci8.so
3) create a simple php script with one line to test if it works:
<?php phpinfo(); ?>
Please note -- 1&1 may physically not have that file available on their server (or some additional libraries that may be required by that extension). If the problem just with absence of .so file, then you can provide your own version of it (upload it and put the correct full path to the extension in php.ini)
Useful links: 1) http://faq.1and1.com/scripting_languages_supported/php/6.html 2) http://faq.1and1.com/scripting_languages_supported/php/8.html
According to your problem. first thing is that linux doesn't support .dll file.
You have to install OCI8 extension module in your Apache server.
Follow this link to get easy solution.
http://coffeewithcode.com/2012/09/how-to-install-oracle-libraries-for-php5-on-ubuntu-server/
Please check that there are no blank spaces.
1. put the php.ini and the php_oci8.so in the same folder as where you are going to run the php program that is going to access the database.
2. php.ini contents should look like:
extesion=./php_oci8.so
Related
I seem to have a strange problem with PHP.
I've migrated a bunch of software from one server to another. On the server some scripts make a connection to Oracle, so to be able to make a connection the oracle client is installed and a tnsnames file is in place. Connection from sql*plus works.
Some of the scripts use PDO, so for that I've enabled extension=php_pdo_oci.dll in php.ini. These scripts work like a charm.
Some other scripts use functions like oci_connect, and these need a extension like php_oci8.dll. With xammp (that I use as apache/php/mysql bundle) php_oci8_12c.dll is delivered, so I thought that extension would be adequate.
When starting the server, I see these errors in the php errorlog:
Unable to load dynamic library 'C:\xampp\php\ext\php_oci8_12c.dll' - The specified procedure could not be found.
The file is in located in C:\xampp\php\ext\, so that shouldn't be a problem. Other extensions that are in the same dir are picked up without any problems. I've also tried to load php_oci8.dll, wich I picked up from the old server, but got exactly the same problem.
Some answers I found to similar problems I tried without success:
- copying the dll to c:\windows\system
- adding the php ext dir to the system PATH variable
- adding the oracle client to the system PATH variable (was already in there)
The software versions I'm using:
OS: Windows 2012 R2 x64
PHP: 5.6.3
Oracle database: 11.2.0.4.0
Any ideas?
Seems like I figured it out and can answer my own question. It looks like XAMPP is delivering a non-suitable ddl with their distribution.
The right and most recent oci8 dll's are downloadable here in all possible flavors: http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/. Once I got the right one, it worked like a charm.
XAMPP comes with PHP compilled with ThreadSafe, so you have to download the file from this directory:
http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/ …
Before you paste the 3 DLLs to C:\xampp\php\ext*, append ".old*" to each file. Be sure you have enabled the good DLL according to your version of your Oracle database in the file php.ini. Finally, Restart Apache.
I am attempting to get a drupal site to work with SQL Server. I have followed the instructions outlined here to get PHP working. Then I downloaded the drivers here and unpacked them to my PHP/ext folder. I then wrote an awesome php test page consisting of the following piece of code.
<?php phpinfo(); ?>
opened up a web browser and pointed to the file localhost/phpinfo.php. All works wonderfully.
I then opened upt the installed .chm file that came with the php drivers for sql server and made the appropriate changes.
Based on the following from my PHPInfo page:
PHP Extension Build API20090626,TS,VC9
I added the following lines of code to my php.ini file
[PHP_PDO_SQLSRV_53_NTS_VC9]
extension=php_pdo_sqlsrv_53_ts_vc9.dll
[PHP_SQLSRV_53_NTS_VC9]
extension=php_sqlsrv_53_ts_vc9.dll
I then restart IIS and point back to my awesome phpinfo.php file and get the following:
HTTP Error 500.0 - Internal Server Error
C:\Program Files (x86)\PHP\php-cgi.exe - The FastCGI process exited unexpectedly
with some lightweight recommended information on suggested things to look at for resolution. e.g. file access, folder access.
There is no rights issue IIS_IUSRS has execute rights on the PHP/ext folder.
Anyone with ideas on how to resolve this? Am I missing something somewhere to make this work?
You write that you add non thread safe libraries, but instead of php_sqlsrv_53_nts_vc9.dll you add php_sqlsrv_53_ts_vc9.dll. For IIS you should use nts libraries
Most possibly MSVCP100.dll is missing
Download and install:
Microsoft® SQL Server® code name ‘Denali’ Native Client CTP 3
from http://www.microsoft.com/download/en/details.aspx?id=26726
Where is the correct location to put the odbc.ini file which holds the DSNs when using OpenBSD 4.9 with their chrooted httpd? I'm trying to use the DSN through php but I keep getting this error:
[iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded, SQLSTATE=IM002
Here's what I know:
This is iodbc (www.iodbc.org) and not unixODBC.
I have python and pyodbc installed and I can use the currently defined DSNs in /etc/iodbc/odbc.ini with a little python test script to hit tables in my sql server database so I know iodbc itself is configured and working.
I have successfully tested the defined DSNs using the iodbcadm-gtk graphical client and the iodbctest utility.
php is working because I can get phpinfo() to show in a browser and the usual config and build info renders properly.
Usually when you use the chrooted stuff on OpenBSD you need to create versions of the normal files like /etc/hosts and put copies of them in /var/www/etc/ to make things work normally. I've tried to put a copy of the odbc.ini there and no such luck. I've tried pretty much everyplace else I could think of including setting ODBCINI as an environmental variable to point to it w/o success.
There is also /var/www/conf/php5/odbc.ini which contains no DSN information and appears to be a php configuration file. I tried replacing this with /etc/iodbc/odbc.ini and this did not work.
Everything seems to point to the chrooted setup needing a properly placed odbc.ini but I'm at a loss for where it goes or what I'm missing.
Anyone happen to get php and iodbc working properly in a chrooted default OpenBSD 4.9 setup? I'd be grateful for any info on where the odbc.ini goes or a push in the right direction for what to try next.
Try setting an environment variable ODBCINI and set this variable to the path where the odbc.ini file resides.
My purpose is to setup a forum in php just locally on my Windows 7 machine to test how it works.
I have installed Apache HTTP Server and PHP v5 successfully. Then I downloaded and extracted the phpbb-forum software and put it in my root folder. Then I realized that I needed some kind of database so I downloaded and installed MySQL. To configure my database I also downloaded and extracted phpMyAdmin but I can't get it to work. When I open my browser and navigate to my phpMyAdmin-folder I simply get this:
Screenshot: http://img836.imageshack.us/img836/5139/captureqb.png
I use my Apache server to preview my website where I'm using some php include functions so I know that I've a "working" PHP installation. The MySQL service is also running on my computer.
However, do you need to configure PHP and/or Apache in order to get phpMyAdmin to work properly? I'm a complete noob on this so I suppose it may be multiple shortcomings.
Thank you.. //Realiserad
The simpler way is to install WAMP server : it bundle Apache, PHP, MySQL and PHPMyAdmin preconficurated for work together.
You need to enable the MySQL extension to use MySQL from PHP.
The MySQL extension may or may not be bundled with your PHP distribution. (look for php_mysql.dll in the ext folder)
Assuming it's installed you can enable it by adding or uncommenting this line in your php.ini:
extension=php_mysql.dll
As other people have said it may be simpler to install WAMP Server
Have a look at: http://www.ricocheting.com/how-to-install-on-windows/mysql - Specifically, the 3rd step. It involves downloading the mySQL PHP Extention (which is a dll), and un-commenting a line of php.ini so that PHP Load's the extension.
While is may be simpler to install XAMPP or WAMP, I think that it's good to know how to fix your own problems - Scientia potentia est :D
not very familiar with windows, but it seems like you miss the php-mysql extension, which you can download from here (i think):
http://mysql2.mirrors-r-us.net/downloads/connector/php/index.html
would be alot easier for you to use a preconfigured wamp install like this one (available for win/mac/etc). google "xampp", i'm not allowed to post more than one link due to stackoverflows spam protection.
Configure PHP to Access MySQL
Open the c:\php\php.ini file with your favorite text editor.
Uncomment the following lines by removing the semicolon:
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
save and exit editor
After extracting the archive into phpmyadmin folder, you will have to configure phpmyadmin before you can connect to sql server.
you should create a configuration file. This file can be created manually (simply use a text editor),
During your first session you will see an error message.
To solve this problem you should create folder (C:\project\wwwroot\phpmyadmin\config). After that give full rights for IIS_IUSRS group and IUSR user.granting permission/image
Return to the config window. Visit localhost/phpmyadmin/setup/
To configure the connection settings click on the “New Server” button.
Enter the verbose name of the SQL server, and then the server hostname. If necessary, you can specify other settings.[setting up/image][2]
Save the settings and then the server will redirect us to the previous page. Choose:
the default language – English
the default server – 127.0.0.1
end of the line – Windows (\ r \ n)
Click Save, and then download. The received file (config.inc.php) you should save to the root directory (C:\project\wwwroot\phpmyadmin).
Open the authorization window (//localhost/phpmyadmin/) and login under root account. If you see a starting phpMyAdmin window, you can delete config folder.
For the correct work phpMyAdmin requires a database with the information. The script for creating database is already installed.
I just installed Apache 2.2.15/PHP 5.3.2/MySQL 5.1.44 on Windows Vista. Apache is working fine, PHP is functional, and MySQL works on the CLI. However, when I try to access MySQL via PHP, I get an error (Fatal error: Call to undefined function mysql_connect()). extension=php_mysql.dll and extension=php_mbstring.dll are uncommented in the php.ini file, and PHP is in the system path. There is no libmysql.dll in either the top level PHP directory or the ext directory. There's a libmySQL.dll file in the MySQL bin directory (which is also in the system path); I tried renaming it, but that doesn't do anything
Also, in case anyone wants to know, I originally installed PHP using the MSI installer, but it was missing some DLLs, so I installed from the zip file.
I think I've exhausted all my options. Any help on this problem would be very appreciated.
Thanks in advance.
IIRC the msi installer sets some registry values that influence the php configuration, see http://docs.php.net/configuration.changes#configuration.changes.windows. That might change the location of the php.ini that is used. You might want to delete those registry keys. Anyway, you did edit the file that is shown in the output of phpinfo()?
Which build of php do you use? The one you can download from http://windows.php.net/download/? Then you probably have the new mysqlnd transport driver built into the php core dll and don't need libmysql.dll. The mysqlnd driver should show up in the output of phpinfo(). Does it?
It sounds like you do not have the MySQL mod for PHP properly installed or configured. I recommend using AMP on Linux, so sorry for not having any specific instructions for Windows.