mysql is not enabled in phpinfo() of php 5.3.1 - php

I am having apache 2.2.14, php 5.3.1 and mysql 5.1.43 installed on vista. I am trying since 2 days to configure php to have mysql enable on phpinfo().
I modified php.ini to have extension_dir = "c:\php\ext"
modified the extension as extension="php_mysql.dll"
added "c:\php" to the "PATH" environment variable and restarted the vista.
after trying many combinations of putting php.ini, php_mysql.dll and libmysql.dll in c drive and/or c:/windows and/or c:/windows/system32 now I am with no options!!
I do restart the apache after each modification. I used libmysql.dll present in mysql installation and that of older php version as php 5.3.1 has no libmysql.dll...
Any help will be appreciated.
Thanks in advance.

You have to edit php.ini and add/uncomment a line to import the php_mysql.dll extention. Search for ;extention=php_mysql.dll and remove the ;. If you find this line without the ; in front of it, you have another problem. If you don't find this line, add it without the ;.
You can also try to put a \ after the extention path: extension_dir="c:\php\ext\"

put php_mysql.dll in the "c:\php\ext" directory (and keep the extension="php_mysql.dll" uncommented [without the leading ;])

Make sure you've edited the right php.ini. In case of doubt
<?php echo 'ini= "', get_cfg_var('cfg_file_path'), '"';
will tell you which one is used by your php installation.
Maybe php tried to load the php-mysql extension and failed because of additional dependencies. That would cause a startup error entry in the error.log.
Which php-build do you use? The php-mysql extension can either use libmysql.dll as transport layer or the new mysqlnd (MySQL native driver) module. You've added c:\php to PATH. That's usually done in order to let windows find libmysql.dll (though it's not necessary, there are other methods which I prefer). If php-mysql depends on libmysql.dll and windows can't find it loading php_mysql.dll will fail.
But if you're using the php.net build of php 5.3.1 the mysql module uses mysqlnd:
Installation on Windows
In the official PHP distributions from 5.3 onwards, MySQL Native Driver is enabled by defaultThis module is built-in in the php.net build. You can test that by calling php -m in a command shell. It prints all built-in modules.

Thanks a lot to the user who said that we have to move the file php.ini to the folder /bin of the Apache server. it resolves me the same problem after more than one week of trying failed methods.
Of course we must uncomment in the file the two lines;
;extension=php_mysql.dll
;extensin_dir="ext"
by removing the semi-colon (;) and by specifying the full path for the extension library php_mysql.dll rather than ext as follows
extension=php_mysql.dll
extensin_dir="c:\Apache22\php53\ext"
For me I installed Apache in the folder c:\Apache22 and PHP in the folder c:\Apache22\php53, you must use your own values.
NOTE: Because mysql_ functions like mysql_connect() become deprecated in PHP 5.5 and above, it is recommended to enable also the library php_mysqli.dll to use functions like mysqli_ (improved version of mysql_ functions). To do that it is simple, you just have to uncomment the line:
;extension=php_mysqli.dll
in the file PHP.ini as follows:
extension=php_mysqli.dll

Update April 7, 2013. Installed Windows 8 on an i7 Quad, HT 8, 3.62GHz, 12GBRAM.. Installed the latest version of MySQL, got it functioning properly. Installed the latest version of Apache Web Server, got it functioning properly. Installed the latest version of PHP, got it functioning properly. MySQL could not connect to the database. The error message was "mysql_connect function undefined". I copied the modified php.ini file into the "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin", and restarted Apache web server... then it all magically started working.!!! I hope this helps somebody with setting up their own Windows MySQL / PHP web server.

Related

Win10/Apache/PHP8: PHP cannot load pgql library [duplicate]

I'm installing PHP, Apache and PostgreSQL Manually
PHP and Apache now is connected, but PostgreSQL is not connected to PHP.
i test by using phpinfo();
i also configure in php.ini like this :
extension=php_pgsql.dll
extension=php_pdo_pgsql.dll
But why it's not work.
Thanks
This tutorial worked for me:
The PHP extension will look for libpq.dll which is found of your
PostgreSQL installation. The simple fix is to add the path than
contains that file to your environment PATH.
I had the same issue with PHP7 and Apache 2.4 on Windows 10. For me the solution was to add the following line to httpd.conf;
LoadFile "C:/php7/libpq.dll"
This also means that it's not required to have PostgreSQL installed if you just want to connect a PostgreSQL database that's not running on your machine.
1) Installing PostgreSQL for Windows
2) add to your enviroment variable "PATH" the bin folder of PostgreSQL installation:
C:\Program Files\PostgreSQL\9.2\bin; (for example)
Assuming you have installed PostgreSQL and your WAMP installation is on c:\wamp, you will need to copy
c:\wamp\bin\php\php5.3.9\libpq.dll to c:\wamp\bin\apache\Apache2.2.11\bin
Make sure you also have the following files
C:\wamp\bin\php\php5.3.9\ext\php_pdo_pgsql.dll and
C:\wamp\bin\php\php5.3.9\ext\php_pgsql.dll
Also, make sure you have enabled the above 2 files as extensions, either via the WAMP menu (click on WAMP icon on taskbar, PHP, PHPExtensions, find the above 2 and 'check' them)
Please note that php5.3.9 and Apache2.2.11 refer to my specific PHP and Apache versions.
Adjust those to suit your installation.
That's it!
This worked for me on Windows:
Found php.ini in php folder.
Found this line and removed “;”.
;extension=php_pgsql.dll
in my case there are 2 php.ini, I had to uncomment extension pdo_pgsql in both php.ini
in php folder
in apache folder
both inside in wamp folder
If you are using PHP in IIS, using PHP Manager, enable this extension:
php_pgsql.dll

PHP 8.0.12 upgrade to PHP 8.1 - multiple module errors

I've been making upgrades on my Dev workstation using XAMPP for a long time now, from the various version 7s up through 8.012.
I seem to have hit a wall upgrading to 8.1.
I've edited the apache config to use the new version of php. Taking the php.ini-development and renaming it to php.ini, then uncommenting the openssl extension has no effect after I restart apache:
extension=openssl
Openssl isn't enabled in the php info page:
And if I try and enable mongodb by moving my extension over from the previous installation, and uncomment the extension in php.ini and restarting apache again I get an error:
extension=php_mongodb.dll
Update: I now find that enabling ANY PHP module does not work under PHP 8.1.
I can roll back to the previous version of php-8.0.12 and have a fully functioning php again. When I roll back to the previous version enabling and disabling PHP modules still works. It does not work under PHP 8.1.
I'd like to stay up to date with the latest release if at all possible!
What am I doing wrong with this version of PHP? Why can't I enable anything?
I've had to set the FULL PATH to the extensions directory on Windows. Once I did that and restarted, I was able to enable / disable extensions. Look for this line in php.ini and adjust it to your needs:
; On windows:
extension_dir = "C:\xampp\php-8.1.0\ext\"
This setting only seems important on Windows. Set that line the way you want it, restart apache and you should be good to go!
You are copying an incompatible module compiled with the older version. If you are upgrading the PHP version, You'll need an extension DLL file compiled with that specific version of PHP and suitable for your server environment. You can download the compatible packages from here PECL. Download and put the .dll file in your extension directory. Then, you'll need to enable that extension.
Here is the guide for the windows system Installing a PHP extension on Windows.
For MongoDB, get it here https://pecl.php.net/package/mongodb

missing oci.dll and failed to load php_oci8.dll [duplicate]

I installed oracle 11g and I did create some tables and manipulate it using sql developer, and I am looking for a way to connect oracle with php on hosting site.
I tried but I get error after using this code:
$Conexion_ID =oci_connect($OracleUser, $OraclePassw, $OracleIP);
this is the error:
Call to undefined function oci_connect()
I've known that I should install and configure OCI8, so I downloaded this file:
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
but I don't know in which folder should I them to make the connection work well.
Download the PHP Extension from here(Confirm the PHP Version and download for the same, the thread safe[TS] version):
http://pecl.php.net/package/oci8/2.0.8/windows
You should be able to find three .dll's
php_oci8.dll, php_oci8_11g.dll and php_oci8_12c.dll
Place all dll's in extension directory, in WAMP it is generally wamp\bin\php\php5.*.*\ext
open the php configuration from the System try of wamp server and add the line:
; Enable only which is required
;extension=php_oci8.dll
extension=php_oci8_11g.dll
;extension=php_oci8_12c.dll
Restart the Apache server.
EDIT : Sorry I thought the other dll's are the libraries, but instead they are for different oracle versions. In your case enable 11g. Answer updated.
Update 2016-11-07: just wanted to say that latest package can be found here https://pecl.php.net/package/oci8. When I wrote this answer 2.0.8 was latest i guess.
if you are using wamp server on windows than you have to use the php_oci8.dll not the oci8.so. You need to download php_oci8.dll and copy it to ext directory under the PHP. If you don't have this extension in your PHP than install it and go to php.ini and add extension=php_oci8.dll.
Please make sure that wamp server have two php.ini files you have to change it on both the places. once everything is done than check with php info that oci 8 installed or not.

MySQLi installation PHP 5.5.8 Windows

When I use phpinfo(), I don't see a table starting with MySQLi. I do see a table for mysqlnd, but I'm not sure what that is. However, when I go to command line and type php -m mysqli is there. mysqli_connect() fails, so it appears that its not actually installed.
MySQL 5.6 is installed. My PHP version is 5.5.8 on Apache 2.4.7 for Windows.
PHP is installed in C:\php, extension_dir = "ext", enabled php_mysql.dll and php_mysqli.dll, so I'm not sure why this doesn't work. Have I missed a step somewhere?
I had the same problem. As I see, it doesn't load when the path is relative. Try with absolute path, e.g.
extension_dir="C:/php/ext"
It worked for me!
The absolute path is needed apache and php are installed in different drives! And also, you'll need to restart apache server after making changes to php.ini.

PHP not loading php_pgsql.dll on Windows

PHP 5.2.8 is refusing to load php_pgsql.dll, with the following error:
Warning: PHP Startup: Unable to load dynamic library 'D:\PHP\ext\php_pgsql.dll' - The specified module could not be found.
in Unknown on line 0
The .dll exists in PHP/ext/.
Has anyone else had this problem with PHP on Windows before?
Check out the info on the PHP PostgreSQL installation page: http://us.php.net/manual/en/pgsql.installation.php
On a Windows server, configured with Apache, adding the following line to httpd.conf to load libpq.dll can save you a lot of time :
LoadFile "C:/Program Files/PostgreSQL/8.4/bin/libpq.dll"
Note that you will have to change your folder accordingly to the installation path and version of PostgreSQL you have installed. Also note that having Apache and PostgreSQL on the same server for production environments is not recommended.
This fixed my setup instantly.
This happened to me also with PHP 5.4.1
Copying the offending DLL everywhere didn't work, and I don't have PostgreSQL installed in the server, but I also planned to use PHP against different Postgres versions, so the only solution I found that worked was to put in httpd.conf a line like this:
LoadFile "C:/Program Files/PostgreSQL/8.4/bin/libpq.dll"
And referring to the libpq.dll that comes bundled with PHP, like this:
LoadFile "C:/php/libpq.dll"
After that it worked fine to me.
For those willing to make their PHP install only capable to access PostGres servers, without actually installing PostGres, you need to:
enable php_pgsql.dll (and php_pdo_pgsql.dll, if using PDO) extension in PHP.INI,
make sure libpq.dll, libiconv-2.dll and libintl-8.dll are in the path. These are the php_pgsql.dll dependencies.
These 3 DLLs can be found in the PostGres install. I just copied them into apache\bin, that way I keep everything self contained. Doing that, apache can start the PHP engine just fine, with PostGres support.
The problem is with the related libraries used by php_pgsql.dll - like libpq.dll, the OpenSLL ones etc. You need to find them (from the zip distribution of Postgres, from an installed psqlODBC driver etc.) and put them in a folder which is in the PATH. As for the list of all DLLs - use MS Dependency Walker (depends.exe).
Another important bit - Apache (if you use Apache that is) has its own set of OpenSSL DLLs. Replace or just rename those so to not clash with those from the Postgres distribution.
You need to copy libpq.dll from wamp\bin\php\php5.3.5 to wamp\bin\apache\Apache2.2.17\bin. Again restart the Wamp Server. By now we are done with the php configuration. Next we will install phpPgAdmin and use it.
Just a thought -- make sure that the Postgres binaries are in the SYSTEM path, not your user-specific path. As it happens, that was the problem on my machine. :-)
Edit:
Come to think of it, that explains why Dependency Walker would report all A-OK but the problem would still persist -- you run DW under your own account, while Apache runs as SYSTEM, and hence won't have your personal PATH settings available.
Just to share what worked for me, without dealing with libpq.dll. I uncommented both extension=php_pdo_pgsql.dll and extension=php_pgsql.dll in php.ini. At first, apache refused to start.
I then add "C:\Program Files (x86)\PostgreSQL\9.4\bin\" (depending on your installation) into windows environment PATH, started apache successfully and works.
Specifically for WAMP server setups here, you need to copy the libpg.dll file into "C:\wamp\bin\apache\Apache2.2.21\bin\", or similar. Copying it to ..\php\ext\ and also adjusting the PATH env variable simply wasn't enough (if effective at all).
Original answer sourced here: http://www.wampserver.com/phorum/read.php?2,40270,57932
Specifically for XAMPP setups, I found that I only needed to copy the libpg.dll file into ..\php\ext\ directory.
As Ondřej Bouda mentioned: Setting up Windows environment variables is enough. No copies of dlls, no entries to http-conf. Just add the php-directory (C:\xampp\php) to PATH. Don't forget to restart XAMPP-Control-Panel if you use this, otherwise it won't know the changes. (And restart Apache of cause.)
For instance, on XAMPP, it was sufficient to put the PHP directory
(i.e., C:\xampp\php) to the system PATH variable. – Ondřej Bouda
This is an update to #Dayron Armas Peña 's answer. The php bundled pgsql 'dll' is found in the following location:
LoadFile "C:/wamp/bin/php/php5.4.12/libpq.dll"
Adding the above line to the httpd.conf file apart from uncommenting the required lines in the php.ini files has solved my problem.
The only time I've seen this error (and the file name and ext path were definitely correct) was when I tried using an incorrect version of the DLL ie. I used one that was compiled against a different version of PHP to the one I was running.
Make sure your version is definitely the one compiled against PHP 5.2.8.
Edit: or, the permissions on the file were set incorrectly.
LIBPQ.DLL problem with php on Vista...
Check to make sure you actually have postgres installed. If you install php on windows with postgres API, without postgres being installed, you may get this warning. It's too easy to just click everything on the Windows installer...
Comment out the relevant line in php.ini.
I got the solution:
1) If you want to load php_pdo_pgsql extension, please load php_pdo, too. (in php.ini)
2) php_pgsql.dll and php_pdo_pgsql.dll depend on libpq.dll and php5ts.dll. libpg.dll is the library from postgreSQL, but it has been bundled into PHP's binary package.
When configuring PHP to work as a module with Apache, it can't load the depending library correctly. And so you need to load it in Apache.
config in httpd.conf and the two lines should be before LoadModule php5_module
LoadFile "Full path to /php5gs.dll"
LoadFile "full path to libpg.dll"
Hope it be helpful.
You have to add the following lines to you httpd.conf file:
PHPIniDir "c:/PHP/"
Loadfile "C:\php\php5ts.dll"
Loadfile "C:\php\libpq.dll"
LoadModule php5_module "c:/PHP/php5apache2_2.dll"
Source: http://www.php.net/manual/en/pgsql.setup.php
I just did this and it worked just fine
in php folder inside php.ini I changed this line
extension=php_openssl.dll
to
extension=C:\php\ext\php_openssl.dll
the php_openssl.dll is inside ext folder which couldn't be found.
Copy file libpq.dll from location /bin/php/ to
location /bin/apache//bin. Restart the wamp server.
I found this to work for me:
After installation of PostgreSQL, you need to copy libpq.dll from wamp\bin\php\phpX.X.X to wamp\bin\apache\Apache2.2*\bin. And restart the Wampserver.

Categories