Database connection error (1): The MySQL adapter 'mysql' is not available - php

I Have a vps server with PHP 5.3.3 installed ,I added a new version 5.3.28 and switch my hosting to use FastCGI with PHP-5.3.28 now i get this "Database connection error (1): The MySQL adapter 'mysql' is not available.".I beleive i miss some configuration when installing the new PHP version.any help is appreciated

It sounds like you've also change the available adpator to mysqli from mysql — the message is saying the adapter mysql is not availble.
Did you remember to change your Joomla configuration.php file to use mysqli?
Open the Joomla (2.5 or 3.x) configuration.php file and look for the line:
public $dbtype = 'mysql'
and change it to:
public $dbtype = 'mysqli'
If it isn't already…

It simply means what it says. To fix the issue, you will need to enable the MySQLi adapter by opening your php.ini file and uncommenting extension=php_mysqli.dll. Once done, restart Apache for the changes to take effect.
There may be an option on your VPS control panel, not sure but I would suggest looking there first.
If you do not have this option, or do not have access to the php.ini file then you will need to contact your hosting provider

Open the Joomla (2.5 or 3.x) configuration.php file and look for the line:
public $dbtype = 'mysql'
and change it to:
public $dbtype = 'mysqli'

I have same problem.. and solve using this link.. the problem is mysql lib not installed. and you should install before run again (remember reload apache)
https://help.ubuntu.com/community/ApacheMySQLPHP
I hope the question solved by this link..

You may have many php.ini files, the know the right file, you can run
php --ini
The uncomment extension=php_mysqli.dll
Then restart apache
sudo service apache2 restart

Related

Cakephp cannot connect to sqlserver

I got this error :
CakePHP is NOT able to connect to the database.
Database connection "Sqlserver" is missing, or could not be created.
Details :
CakePHP 2.5.4
Wamp server 32-bit
Dreamweaver CS6
SQL Server 2014
On my details.php
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Sqlserver',
'persistent' => false,
'host' => 'localhost\MSSQLSERVER',
'database' => 'testing'
);
I have load both the extension on both ext folder (apache & php) and on php.ini
extension=php_sqlsrv_55_ts.dll
extension=php_pdo_sqlsrv_55_ts.dll
Searched everywhere but still cannot connect to sqlserver.
note : I can connect to MySQL but not SQLServer
Maybe bacause you're not running sqlserver? Wamp is configured with apache/MySQL... hence the WAMP acronym...
In which case your config file should be similar to the one given in this example...
http://book.cakephp.org/2.0/en/development/configuration.html
Try to edit another php.ini in C:\wamp\bin\apache\Apache2.x.x\bin\ then restart apache.
Also the SQL Server Native Client must be installed for the extension to work.
In the end, i've found the solution. It's the problem of WAMPP server. Tho i have it installed on other machine and it works, it's not the same with the machine i'm currently using. So what i do is:
Uninstall WAMPP
Install XAMPP
Configure php.ini on apache and php
Load extensions in the ext folder of php
Note : I did the same configuration with WAMPP earlier
Then everything works like a charm.

Call to undefined function openssl_random_pseudo_bytes() XAMPP [duplicate]

I spent three hours but I did not find anything; I'm unable to connect to a SSL enabled server. I want to list what i did:
First checked my PHP extensions directory was in order; extension wasn't there, php_openssl.dll
Then I opened my php.ini file but I could not see any extension=php_openssl.dll line to uncomment.
Also, I searched on Google and saw people with the same problem.
http://www.apachefriends.org/f/viewtopic.php?p=162623
However, I also have
OPENSSL_CONF C:/xampp/apache/bin/openssl.cnf
...
openssl
OpenSSL support enabled
OpenSSL Library Version OpenSSL 0.9.8l 5 Nov 2009
OpenSSL Header Version OpenSSL 0.9.8l 5 Nov 2009
no lines . What should I do? Please share your suggestions.
Yes, you must open php.ini and remove the semicolon to:
;extension=php_openssl.dll
If you don't have that line, check that you have the file (In my PC is on D:\xampp\php\ext) and add this to php.ini in the "Dynamic Extensions" section:
extension=php_openssl.dll
[PHP_OPENSSL]
extension=php_openssl.dll
This is the answer.
Things have changed for PHP > 7. This is what i had to do for PHP 7.2.
Step: 1: Uncomment extension=openssl
Step: 2: Uncomment extension_dir = "ext"
Step: 3: Restart xampp.
Done.
Explanation: ( From php.ini )
If you wish to have an extension loaded automatically, use the following syntax:
extension=modulename
Note : The syntax used in previous PHP versions (extension=<ext>.so and extension='php_<ext>.dll) is supported for legacy reasons and may be deprecated in a future PHP major version. So, when it is possible, please move to the new (extension=<ext>) syntax.
Special Note: Be sure to appropriately set the extension_dir directive.
So, what did we do to make openssl_pkey_new() and all the other openssl_ functions in PHP work...
Enabled the extension php_openssl.dll in the (right/active) php.ini. Checked.
Checked that there exists a openssl.cnf in xampp\apache\conf\ (and also in two other directories within XAMPP). Checked.
Added the environment variable OPENSSL_CONF in the Windows system settings with the full path to the above openssl.cnf. Checked.
Restarted Apache (and after that did not work restarted the computer several times...). Checked.
Still does not work, and throwing errors such as
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:02001002:system library:fopen:No such file or directory
error:2006D080:BIO routines:BIO_new_file:no such file
Okay, here are another two more things to check.
1. Trouble with the environment
Run phpinfo() from a PHP script, and go to the "Apache Environment" section. Check the value of OPENSSL_CONF.
Surprise. This is not what we have set in the windows system settings.
The solution is simple. Set the environment variable in the PHP script.
putenv('OPENSSL_CONF=C:\xampp\apache\conf\openssl.cnf');
2. Trouble with relative filenames
Now, openssl_pkey_new() will work, but openssl_pkey_export_to_file() does still not work and returns false without any further explanation?
Check the filename that you have specified as output filename. It will not work in Windows as long as you do not specify the full path.
$folder = realpath('../keyring');
$outfile = $folder.'/private.pem';
openssl_pkey_export_to_file($key, $outfile);
I use xampp. Beforehand I tried the example file "test_smtp_gmail_basic.php" in phpMailer (you can download phpMailer here: https://github.com/Synchro/PHPMailer), but I got the following error:
Mailer Error: The following From address failed: xxx#gmail.com
After I commented out ; extension=php_openssl.dll in php.ini, it is working now.
In xampp, if "extension=php_openssl.dll" is not present in your php.ini file then add it in the "Windows Extensions" section of your php.ini file
and restart your apache.
It works for me..
You will need to edit your php.ini. It's 4 easy steps.
Find your php.ini file.
$inipath = php_ini_loaded_file();
Enable openssl in the file:
extension=php_openssl.dll
Turn allow_url_fopen on
allow_url_fopen = On
Restart apache and you are done!
STEP 1: On your php.ini comment out ;extension=php_openssl.dll
STEP 2: Copy libeay32.dll and ssleay32.dll from your PHP root folder and paste it your Apache/bin folder
STEP 3: Restart Apache
I am assuming that this question is for those using a windows based system.
After making sure that the extension extension=php_openssl.dll in your php.ini file does not have a semicolon.
Then make sure that you have added C:/xampp/apache/bin into your environment path in order to use openssl without having move the command prompt to that directory C:/xampp/apache/bin
Although not related to this question but as the WP migrate Pro docs link to this question I though I would post an answer here.
If your having problems with DB Migrate Pro activating instead of enabling SSL you can just add a line of code to your wp-config
define( 'WPMDB_LICENCE', 'XXXXXXXXXXx' );

Error using WAMP with LDAP

I'm using WAMP and trying to run something like the following:
<?php
$ldap = ldap_connect("ldap.example.com");
$user = "exampleUser";
$pass = "examplePass";
if($bind = ldap_bind($ldap, $user, $pass)) {
// logged in
} else {
// error message
}
?>
Before doing this though, I tried running phpinfo() to see if ldap was installed, and it doesn't appear anywhere.
I've tried the following:
Uncommented the following line in php.ini: extension=php_ldap.dll
Copied these files into the same directory as php.ini: ssleay32.dll
and libeay32.dll
Added the following to my environment variables: C:\wamp\bin\php
Restarted after doing any of these.
I don't really know what I'm doing, but these were the suggestions I found online. Any help would be appreciated!
This answer may be useful for others who come across this question as it's over a year since the OP posted this question.
I'm running
WAMP Version: 2.4
Apache Version: 2.4.4
PHP Version: 5.4.16
I tried most suggested solutions that a Google search will bring you to and nothing seemed to work. A forum recommended looking at the PHP pages
A user by the name of Frank in the above link recommended to copy libsasl.dll to [apache folder]\bin despite this only being recommended for earlier versions of php, this file is in the php folder.
copy "C:\wamp\bin\php\php5.4.16\libsasl.dll" "C:\wamp\bin\apache\apache2.4.4\bin\libsasl.dll"
This is what worked for me and LDAP is now showing up when I use phpinfo(), although I haven't properly tested it yet besides running the ldap_connect() function, but I'm assuming that means it is working and I should be able to use it in my application.
Besides adding libsasl.dll to the Apache bin I added C:\wamp\bin\apache\Apache2.4.4\bin and C:\wamp\bin\php\php5.4.16 to my PATH (i.e. the Windows environment variables -> system variables -> path) and I added ssleay32.dll and libeay32.dll to the both the Apache and php bin, not sure if required but it's working now.
What errors do you get? function does not exist?
Also you should add the following lines after your ldap_connect function:
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ldap, LDAP_OPT_DEBUG_LEVEL, 7);
if(!$ldap){
echo "LDAP Failed To Connect: ".ldap_error($ldap);
}
The options set ldap to protocol version 3, which is needed for active directory and alike on server 2k3 and alike and enabled debugging on the ldap connection.
Update
Also, run phpinfo() and look for the extensions directory. Navigate to that directory and make sure that php_ldap.dll exists in there.
I simply copied 'libsasl.dll' from the php directory to the apache directory and obviously restarted httpd. This solved my problem.
This was not a WAMP installation, I installed apache and php separately. Perhaps in case of WAMP or LAMP some more files can be needed.
I resolved the same problem by adding the php folder in the following Windows system path:
at command prompt
SET PATH=C:\wamp\bin\php\php5.3.13;%PATH%
it's very too late, but i had the problem and i wanted to add that you must uncomment extension=php_ldap.dll in both php and apache's php.ini.

Install ingres extension for php on my WAMP server

I've a development computer, which runs under windows.
For a project, I've to make a php website which has to connect to an Ingres database server.
So I installed wamp, I installed ingres(server and client, on my local machine).
I added the library that I found on their site(php_ingres.dll) in the C:\wamp\bin\php\php5.3.5\ext folder, and I added a line "extension=php_ingres.dll" in the configuration file.
I shutdown wamp and restarted it, and I restarted the server, I see now a check mark in the wamp menu, indicating that php_ingres is now activated. But when I go to the welcome page of the server, I don't see this extension as loaded. If I go on the php info page, I don't see any Ingres entry in the Configure Command.
I just can't found any post/tutorial/... which indicating how to do this operation, so any help would be appreciated!
Thank you!
Edit: I made a small test to see if I can connect to an Ingres database:
<?php
$link = ingres_connect("localhost", "demodbtest", "demodbtest") or die("Connexion impossible");
echo "Connexion réussie";
$result = ingres_query($link,"select * from airline");
while ($row = ingres_fetch_array($result)) {
echo $row["al_iatacode"]; // utilisation du tableau associatif
echo $row["al_name"];
echo $row["al_ccode"]; // utilisation du tableau à indices numériques
echo "</br>";
}
ingres_close($link);
?>
And I get this error:
( ! ) Fatal error: Call to undefined function ingres_connect() in
C:\wamp\www\tests\index.php on line 2
Some information on my installation:
I've a windows 7 pro 32bits
Wampserver 2.1 ( http://sourceforge.net/projects/wampserver/files/WampServer%202/WampServer%202.1/WampServer2.1e-x32.exe/download )
Apache 2.2.17
PHP 5.3.5
Ingres 10.1.0 Community edition( downloaded here: http://esd.ingres.com/product/Community_Projects/Ingres_Database/Windows_32-Bit/Ingres_10.1_Build_121/ingres-10.1.0-121-gpl-win-x86-NoDoc.zip/http )
PHP drivers downloaded here: http://esd.ingres.com/product/drivers/PHP/Windows_32-Bit/PHP_Driver
To practically test if the extension was loaded you can as well call one of it's functions. If the extension was loaded, you should not get a fatal error for a missing function. That's perhaps one of the quickest checks.
Another check is to make use of extension_loaded *PHP Manual** which will give you a list of all loaded extensions. See the PHP Manual link above for more info.
The configure line
The configure line will not show the ingres extension because it has not been compiled in. That's perfectly alright because you load it as an extension (.dll) so it's not part of php.exe. This is why you don't see it in the configure line.
Locating ingres on the phpinfo() page.
On the phpinfo()-page use the search function inside your browser (often CTRL+F) and try to locate the word ingres. You should locate a section that displays the extensions default settings if it has been loaded.
The following is an example screenshot for the xdebug extension. This might look similar for ingres:
Image from: Launching xdebug in Eclipse stuck at 57% - How to trouble-shoot?
Double check your extension_dir setting as well as the actual php.ini file being used. Calling php.exe -i from the command line might not give the same output if executing phpinfo() in a script via Apache (or IIS). In fact http://www.wampserver.com/en/faq.php says there are 3 potential php.ini scripts.
The problem is that I wasn't having the ingres client installed locally, so it appears that this lib cannot works without it

How do I install MySQL modules within PHP?

I've updated php.ini and moved php_mysql.dll as explained in steps 6 and 8 here.
I get this error…
Fatal error: Call to undefined function mysql_connect() in C:\inetpub...
MySQL doesn't show up in my phpinfo; report.
I've updated the c:\Windows\php.ini file from
; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"
to
; Directory in which the loadable extensions (modules) reside.
extension_dir = ".;c:\Windows\System32"
Result: no change.
I changed the php.ini value of extension_dir thusly:
extension_dir = "C:\Windows\System32"
Result: much more in the phpinfo; report, but MySQL still isn't working.
I copied the file libmysql.dll from folder C:\php to folders C:\Windows\System32 and C:\Windows
Result: no change.
I stopped and restarted IIS.
Result: new, different errors instead!
Warning: mysql_connect() [function.mysql-connect]: Access denied for
user '...'#'localhost' (using password: YES) in C:\inetpub\...
error in query.
Fatal error: Call to a member function RecordCount() on a non-object
in C:\inetpub\...
I found several .php files in the website where I had to set variables:
$db_user
$db_pass
Result: The site works!
As the others say these two values in php.ini are crucial.
I have the following in my php.ini: note the trailing slash - not sure if it is needed - but it does work.
extension_dir = "H:\apps\php\ext\"
extension=php_mysql.dll
Also it is worth ensuring that you only have one copy of php.ini on your machine - I've had problems with this where I've been editting a php.ini file which php isn't using and getting very frustrated until I realised.
Also if php is running as a module within apache you will need to restart the apache server to pickup the changes. Wise to do this in anycase if you're not sure.
a "php -m" from the cmd prompt will show you the modules that are loaded from the ini file.
In the php.ini file, check if the extention path configuration is valid.
You will need to enable the extension=php_mysql.dll option in the php.ini as well. Also, make sure that the file is in the extension_dir you set.
You can read more about it at:
http://us3.php.net/manual/en/install.windows.extensions.php
On a completely different note, might I suggest WampServer? It should get you up and running with a Apache/PHP/MySQL install in no time.
You could even compare the WampServer config files with your own to see where you originally went wrong.

Categories