Connecting to phpmyadmin xampp mysql server over ssl - php

I was setting up a local server on my mac using xampp, however i ran into a problem when i needed to set up ssl for my site. I set up the php side to enable ssl that works fine, I can visit 'https://localhost/' fine it loads up the xampp welcome page. Now when it comes to mysql and setting it up to use ssl i cant get it to use ssl. When i go into phpmyadmin and check the variables it says that ssl isn't on and that there is no cipher specified.
I tried going into the config.inc.php and adding the following lines:
$cfg['Servers'][$i]['ssl'] = true;
$cfg['ForceSSL'] = TRUE;
I then restarted apache and mysql servers through xampp and that changed nothing. I then generated my own certificates put them in a folder and added the following to the same config.inc.php file:
$cfg['Servers'][$i]['ca'] = '/Applications/XAMPP/xamppfiles/etc/ssl/ca-cert.pem';
$cfg['Servers'][$i]['cert'] = '/Applications/XAMPP/xamppfiles/etc/ssl/client-cert.pem';
$cfg['Servers'][$i]['key'] = '/Applications/XAMPP/xamppfiles/etc/ssl/client-key.pem';
That also did nothing to change mysql's ssl settings. I was just looking to connect to mysql in php using ssl. My php code looks like this below:
error_reporting(E_ALL);
ini_set("display_errors", "1");
$link = mysqli_init();
mysqli_ssl_set($link,'/Applications/XAMPP/xamppfiles/etc/ssl/server-key.pem','/Applications/XAMPP/xamppfiles/etc/ssl/server-cert.pem','/Applications/XAMPP/xamppfiles/etc/ssl/ca-cert.pem',null, null);
mysqli_real_connect($link,$dbhost, $dbuser, $dbpass, $dbname);
I can't connect with the code above it gives me a ssl error. Is there anyone that can help me set this up so that i can use ssl please?

The MySQL in XAMPP is actually a MardiaDB binary version. That version does not support SSL (TSL).
Try this: How can I change MariaDB to MySQL in XAMPP?

Related

Problem with the phpMyAdmin ssl configuration

I have a little problem with my PhpMyAdmin (i use NGINX & PHP 7.2). I wanted to configure the SSL connection between MySQL (MariaDB 10.2.27) and PhpMyAdmin by adding its information to the config.inc.php file:
$cfg['Servers'][$i]['ssl'] = true;
$cfg['Servers'][$i]['ssl_key'] = '/etc/mysql/ssl/server-key.pem';
$cfg['Servers'][$i]['ssl_cert'] = '/etc/mysql/ssl/server-cert.pem';
$cfg['Servers'][$i]['ssl_ca'] = '/etc/mysql/ssl/ca-cert.pem';
$cfg['Servers'][$i]['ssl_ca_path'] = '/etc/mysql/ssl';
But now when I want to connect to PhpMyAdmin I get the error:
mysqli_real_connect(): (HY000/2006): MySQL server has gone away
Do you know why I have this error? Thank you in advance for your help.
You might be misunderstanding the ssl options in the pma config.
This does not encrypt traffic between your web browser and phpmyadmin, but rather the connection between phpmyadmin and your mysql server and it has to be set up on your mysql server.
AND you don't set an SSL certificate for phpMyAdmin for HTTPS - it is a web app - not a web server. Nginx stores the certificates and terminates/unwraps the SSL.
The HTTPS session you are using is between your PC and Nginx - it is nothing to do with phpMyAdmin. Your phpMyAdmin vhost is using whatever certificate you defined in Nginx.
HTTPS != SSL insofar as phpMyAdmin's configuration is concerned.
The setting you referred to is specifically for an SSL connection between phpMyAdmin and MySQL - which if is on localhost, isn't all too relevant anyway.
After all this question should goto : https://serverfault.com you are in wrong place.
See more : https://serverfault.com/questions/403006/phpmyadmin-with-ssl-https-and-mysql-client-on-nginx

phppgAdmin has more than 1 Error - also Error Loading servers.php

I am trying to learn PostgreSQL and so installed it and phppgAdmin on my laptop.
I went to localhost/phppgadmin, logged in and I get all these errors on the front page:
I tried going troubleshooting on Google, but unfortunately there are not enough answers to this question.
Also, config.inc.php file looks like this after I altered it according to the Tutorial I followed to connect the Database to PHP:
$conf['servers'][0]['desc'] = 'PostgreSQL';
// Hostname or IP address for server. Use '' for UNIX domain socket.
// use 'localhost' for TCP/IP connection on this computer
$conf['servers'][0]['host'] = 'localhost';
// Database port on server (5432 is the PostgreSQL default)
$conf['servers'][0]['port'] = 5432;
// Database SSL mode
// Possible options: disable, allow, prefer, require
// To require SSL on older servers use option: legacy
// To ignore the SSL mode, use option: unspecified
$conf['servers'][0]['sslmode'] = 'allow';
// Change the default database only if you cannot connect to template1.
// For a PostgreSQL 8.1+ server, you can set this to 'postgres'.
$conf['servers'][0]['defaultdb'] = 'template1';
// Specify the path to the database dump utilities for this server.
// You can set these to '' if no dumper is available.
$conf['servers'][0]['pg_dump_path'] = '/usr/bin/pg_dump';
$conf['servers'][0]['pg_dumpall_path'] = 'C:\\xampp\\pgSql\\11.2\\pg_dumpall.exe';
Thank you in advance
EDIT: Is it possible to just user the original pgadmin?!
This error is because the version of phpPgAdmin you are running does not support php7. You can either downgrade your PHP version or run the code from git master, available at https://github.com/phppgadmin/phppgadmin.

Can't connect LDAP over SSL [duplicate]

I'm having issues using Windows to connect to a secure LDAP server, and I see the same thing everywhere online with no solution thats worked so far.
I have tried using both IIS and WAMPSERVER. I have put libeay32.dll and ssleay32.dll in my SYSTEM32 directory and enabled the LDAP extension.
Here is my code:
putenv('LDAPTLS_REQCERT=never');
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
$resource = ldap_connect("ldaps://{redacted}/", 636) or die ("Could not connect.");
ldap_set_option($resource, LDAP_OPT_PROTOCOL_VERSION, 3)
$bound = ldap_bind($resource, "{redacted}\ldap", "****");
echo ldap_error($resource);
I get Can't contact LDAP server from ldap_error and the PHP warning Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server in C:\wamp\www\ldapTest.php
The server I am attempting to connect to is running Active Directory and I have confirmed that I can connect by using other LDAP tools. I know this server has an issue with it's certificate - the LDAP tool I am using says The server you are trying to connect to is using a certificate which could not be verified! - Issuer certificate not found
My suspicion is that the bad certificate is causing the bind issue which is why I've tried the LDAPTLS_REQCERT=never.
I can't recall where I found this one article; however I found out that by default even if you specify the TLS_REQCERT never it is ignored.
What I found out / then forgot about and found out again is you need to do the following (for windows machines)
Create the following directory structure on your drive c in the root
c:\OpenLDAP\sysconf (create the two folders)
Inside the sysconf folder create a text file called "ldap.conf"
In the text file you created put the following on the first line and then save
"TLS_REQCERT never" (Without the quotes)
Restart Apache and it should work now.
Give it a try. and good luck!
You can try changing the following line:
$resource = ldap_connect("ldaps://{redacted}/", 636)
To use your port number directly in the URI instead
$resource = ldap_connect("ldaps://{redacted}:636")
This has been known to work when the other will not.

Connect to Mlab in Host

I tryed connect to Mlab with php by following code:
$connection = new MongoClient('mongodb://user:pass#ds051605.mlab.com:51605/db');
This code worked correctly in my system but didn't work in host and reterned Error 500 (my host doesn't support from mongo). What is the problem? Is there need to supporting mongo in host?
Additionaly, var_dump($connection) command doesn't show error.

PHP on IIS - unable to bind to Active Directory over LDAPS

I'm working on a small password reset script for our users, using PHP5 on an IIS7.5 server. I have LDAP over SSL enabled on our Active Directory controllers, and tested that it is working properly using ldp.exe
Here's the code to connect to the server:
$ldap_server = "ldaps://AD02.district.local";
$ldap_port = "636";
$ldap_user = "service_lookup#district.local";
$ldap_pass = "(goes here)";
$ds = ldap_connect($ldap_server,$ldap_port);
ldap_bind($ds,$ldap_user,$ldap_pass);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
However, when I execute the script, I get the following error:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Can't contact LDAP server in D:\Sites\Lookup\search.php on line 11
If I set $ldap_server to use ldap:// instead of ldaps://, it'll connect (even with the port set to 636), but the actual reset function does not work ("server is unwilling to perform").
Is there a way to troubleshoot this further? Or does anyone know what may be wrong?dd
I know this is an old question. But today I encountered the same problem.
I had to apply the following solution to make it work:
Create a folder: C:\OpenLDAP\sysconf
Create a file 'ldap.conf' in C:\OpenLDAP\sysconf.
Make the content of the file: 'TLS_REQCERT never' (no quotes).
Save.
It should work now. According to the manual, “TLS_REQCERT never” prevents the server from requesting and/or checking any server certificate.

Categories