PHP, IIS, Oracle (OCI) not working - php

We are migrating from a Windows SBS 2011 to Windows Server 2012 R2.
We have an internal website that connects to our Oracle database using PHP.
I am trying to migrate this to the new server and so far I have:
Installed IIS Server Role
Installed PHP
Downloaded Oracle Instant Client to C:\instantclient
Added C:\instantclient to PATH System Variable
Added php_oci8.dll to php.ini and checked that PHP is actually using this php.ini
Restarted server
I am still getting error messages like oci_ commands not being recognised etc.
I'm lost. I've searched online and the instructions match what I have done from memory.
I haven't found a single thing online that I haven't done.

Depending on the version of InstantClient you have installed you might need to include the bin folder in the path, like so:
C:\instantclient\bin
To check if the DLL files are available in the path enter where oci*.dll in a command prompt. It should return a list of matching files.
Also, remember that just because your account can see the DLL files doesn't mean IIS/PHP can. That runs under a different account that might not have permission to access the files. Check your IIS error log and PHP php_errors.log file for any specific error messages.
Edit
After a rather lengthy chat, the problem was resolved by:
Updating the InstantClient from 10.1.0.5 to 10.2.0.5 (as mentioned in the module requirements: On Windows, the php_oci8 DLL needs Oracle client libraries from version 10gR2 or greater.)
Adding a copy of msvcr71.dll to the InstantClient folder.
Downloading and manually configuring PHP from php.net instead of using PHP Manager for IIS.
Ensuring the Path environment variable correctly pointed to the InstantClient and PHP folders.

try this:
extension=php_oci8_12c.dll
(instead of php_oci8.dll) - that is what I am using and you probably downloaded the same instant client as I did.

Related

Unable to load dynamic library 'php_oci8_19.dll'

Hy! I'm trying to use oci on windows, I found some linked issues, but I don't have any xampp, or apache, or anything, I'm only using the php built-in server. I enabled the oci extension in the php.ini file, but it does not work. I was looking for answer. I don't need any oracle database, there is a database, I only want to connect it with my app. I have the error above every time, when I'm trying to run any php command. So it does not work. The missing dll file is there, so I don't understand, why is it missing. I installed pear, and pecl, but pecl installations need openssl, openssl needs visualC++ and some other things... is there any other solution? Even though why does it not find that dll, if it's there... I downloaded Oracle Instant client and Oracle SDK, I unzipped it, set the environmental variables, but nothing changed... Please, help!
You need to download the correct oci8_19.dll if not already there and placed it under your_xampp_directory\php\ext folder.
Enable/add this extension in your php.ini file.
Add environment variable path for PHP.
Then, you also need Oracle Instant client to load/run this properly. Download it from here. Be mindful about x86 or x64 architecture of your windows machine and download the one that matches your machine specs.
Add this Oracle instant client path too in your environment variable.
Restart command prompt and type php -v. Voila! It runs smoothly and shows you just the PHP version, which means your oci extension loaded properly.

How to setup a PHP server?

I'm trying to set up a PHP server. We have an old server that runs a bunch of in house forms over an intranet that is coded in ASP, and I'm trying to rebuild that into a better system using PHP.
I'm starting fresh, as have been given a Win 2012 r2 server.
I first tried installing IIS 8. I installed downloaded the files for php (version 7). I was successful in being able to access index.html and any other files placed in the c/inetpub/wwwroot folder from a different PC via a browser (http://servername/file.php). However, I installed MariaDB and phpmyadmin. phpmyadmin gave the the message the mysqli extension is missing.
I ultimately uninstalled IIS, and PHP, and the MariaDB. I wanted to start from scratch, and tried with Apache
I was able to get Apache and PHP to work together, but I could not access files in the htdocs folder from a different PC (going to http://<servername>/file.php). I could only access it via localhost.
I had the same problems with phpmyadmin and mysqli.
I also noticed there was no php.ini file... rather I saw a php-ini-production and php-ini-development files.
How to I fix the phpmyadmin problem? Any advice for configuring apache so that I can access files place in the htdocs folder from a device other than the server itself (non-localhost)?
I recommend using XAMPP, then you'll have MySQL, and may be you could configure to use MariaDB as well.
If you use XAMPP, phpmyadmin is not available other than localhost, but that is configurable. If you want i can help you find a good video for that.
take the php-ini-production file and rename it to php.ini and find the line
;extension=php_mysqli.dll
and just remove the leading semicolon (;), save and restart apache.
Also you need to open the firewall on your machine to allow port 80 to accept all connections.

upgraded mysql to 5.5 on windows / php doesn't connect to mysql API

i was upgraded mysql to 5.5
but i don't know why php does not connect to mysql API
in info file written
Client API version mysqlnd 5.0.11-dev
my server is windows server / using IIS
Installation
First thing to do after you download and extract phpMyAdmin is place the extracted files in the appropriate directory inside your IIS web root so that IIS is able to access it. You may wish to create a separate website for your phpMyAdmin installation, or simply add it as a sub directory or virtual directory under an existing website. Either way you'll need to make sure that the user account used by IIS to access your files has at least NTFS read permissions to all of your files once they are in place.
In this guide we'll place the phpMyAdmin files in a directory called "pma" under the root directory of a website "example.com". Because phpMyAdmin enables you to directly manipulate, and even delete entire databases and users, it is highly recommended that you secure your phpMyAdmin installation using SSL. This can be done by purchasing a certificate from a 3rd party vendor which will cost money, or by creating self signed certificate for IIS yourself at no cost. With all this in mind, then to access the phpMyAdmin installation used in this guide you would type the following into the address bar of your favourite web browser;
PHP Settings
phpMyAdmin uses several PHP extensions to perform its various functions. The extensions you'll need for phpMyAdmin are;
MySQL (to connect to the MySQL server on web hosting)
MCrypt (highly recommended for performance when using the cookie authentication method, and actually required for 64-bit environments)
MBString (used for multi-byte character support)
GD2 (image creation and manipulation library)
To enable these extensions open you php.ini file and navigate to the list of extensions and find these extension names;
;extension=php_gd2.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mysql.dll
Simply remove the semi-colon (;) from that start, save the file and restart IIS to reload your PHP environment. These extensions should now be loaded into your PHP environment, and can be verified using the phpinfo function as described in the PHP installation guide.
And I found lot of possible answers in google
you can go through this links.
Install and Configure MySQL for PHP Applications on IIS 7
Use the Database Manager
Configuring PHP with MySQL for Apache 2 or IIS in Windows
Install and configure phpMyAdmin on IIS

Reset Apache PATH environment variable in Windows

I recently upgraded Apache and PHP due to security, and I also use PHP to communicate with Oracle databases. The new PHP version only has php_oci8_12c.dll module, so I also installed Oracle 12c client.
After I enable the oci8 module, I noticed the module doesn't show up in Apache when I run phpinfo(), but if I run php -m, I find the oci8 module there. Further checking revealed that the PATH environment variable has not been updated since the upgrade, and that the new path only get appended at the end of the PATH variable.
I paste below the (stripped-down) PATH data from Apache:
C:\oracle\client11gR2_32\bin;C:\www\Apache24\bin;C:\www\php548;C:\database\mysql5528\bin;C:\oracle12c\client12c_32\bin;C:\www\php562;C:\www\php562\ext
Compared with system PATH variable:
C:\oracle12c\client12c_32\bin;C:\oracle\client11gR2_32\bin;C:\www\Apache24\bin;C:\www\php562;C:\www\php562\ext;C:\database\mysql5528\bin
I tried restarting the Apache service, and also uninstall/reinstall, but none works. It seems that the data somehow get 'cached' in a separate location, but I can't tell where. If I renamed the Oracle client 11g HOME folder, then the oci8 module is detected and loaded in Apache.
I've searched all around the internet for 'resetting' the Apache PATH variable, but to no avail, therefore I post it here. Please help.
There are two possible reasons I can think of:
The path to the 12c client is a user variable, not a system variable (but then I would expect it to be at the end of the path list)
The 12c client installer has directly modified the registry to add the path, and therefore the system environment has not recognised the change yet. (If you are running Apache as a service then just because your account can see the path change doesn't mean the SYSTEM account can see the change.)
Assuming the latter case, a server reboot would fix the problem. If you can't reboot the server then you can try stopping Apache, opening the Environment Variables dialog, and simply pressing OK (on this and all parent dialogs) to 'reinitialise' the system environment. Start Apache again and it should pick up the new setting.
On a related note: You should really replace the bundled OCI driver (1.4.10) with the most recent build from PECL (currently 2.0.8). As stated in the PECL description:
Use the older PHP OCI8 1.4.10 when using PHP 4.3.9
through to PHP 5.1.x, or when only Oracle Database 9.2 client
libraries are available.
The Windows download contains php_oci8.dll, php_oci8_11g.dll, and php_oci8_12c.dll. So you wouldn't have needed to try changing the Oracle client installation.

Apache/PHP fails to start on WinXP when activating MySQL extension

I've been incrementally setting up a web server for research and testing purposes. The "server" is running Windows XP and I initially installed Apache Server 2.2 and PHP 5.3. That's been working great for a while. I am now needing to setup MySQL which I downloaded and installed MySQL v5.5. I am able to interact with MySQL via the command-line interface. In the process of setting up phpMyAdmin, I have encountered difficulties getting PHP and Apache to play nice with MySQL. Here's what I've discovered and tried:
In the php.ini file, when I attempt to uncomment either the php_mysql.dll or the php_mysqli.dll extension and restart the Apache server, the server crashes when it starts. The Windows event viewer says Apache failed to start due to "faulting module php5ts.dll".
The extension_dir parameter is set to ".\ext" and the php_mysql.dll and php_mysqli.dll files are in that directory.
I have also tried copying the libmysql.dll file from the lib folder of the MySQL directory to the Windows\System32 directory (with no change in behavior).
I'm at a bit of a loss to figure out what the next step is. Any suggestions?
The extension it's looking for is an extension output by php at compile time based on your configured build options. It is not looking for the header files from mysql itself.
Also, ".\ext" is a relative path that may or may not be valid in your installation. You may need to re-compile php to include mysql and mysqli (you should also compile PDO support) into your php build (Or whatever the windows equivalent of re-compiling is).
Also, you should make extension_dir an absolute path not relative.

Categories