Unexpected error connecting vtiger with mysql - php

I am currently getting this error in vtiger installation wizard (step 4).
MySQL Server should be configured with:
sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
I am using shared PHP 7.2 MySQL 5.7 hosting and adminer says that sql_mode is set to
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Here comes the question
Is this behaviour really related to sql_mode setting? Do I have to contact my hosting provider or there is there an override?

Connecting to a new mariadb 10 database solved the problem.
Changing MySQL version to <5.7 as stated in comments should therefore work as well.

For Ubuntu - Run command:
sudo nano /etc/mysql/my.cnf
Add the following part to the bottom:
[mysqld]
sql_mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Run command to restart MySQL Service:
sudo service mysql restart
You will also need to change Database Collation to utf8_general_ci in phpmyadmin.
Done !

I think you should pay attention to the port Mysql is using, if you are using Wampserver, By default the new versions install MariaDB first, and MySQL second so MariaDB get the port 3306 and Mysql get the an other one (most of the time 3307).
Vtiger will always try to connect to a database to the port 3306 (unless you change it in the code). So you can change the sql-mode in "/bin/mysqlx.x.x/my.cfg" as you want, and see it changed in the MySQL console, but Vtiger won't be trying to connect to it, but to 3306.
I spent way more time on this issue than it deserved, mostly because I felt that changing the "sql-mode" in the .cfg file to change an "sql_mode" variable was weird and was the issues, idk why MySQL made it like that but that's not user friendly at all.

Related

WAMPServer Install - Error on phpMyAdmin login - Error #1193

I'm trying to set up WAMPServer for the first time on my personal computer to do some WordPress work. When I try to log into phpadmin with the root login, I get an error screen. The Error reads as such:
SQL query: Edit
SET lc_messages = 'en_US';
MySQL said:
1193 - Unknown system variable 'lc_messages'
I've tried running PHP version 7.0.10 and 5.6.25 but the errors occurred on both.
I'm running MySQL version 5.7.14
I've tried looking at a StackOverflow forum with the same issue, linked here, but none of the suggested fixes worked for me there, since I'm running a pretty updated version of phpMyAdmin.
The correct name for that parameter is lc-messages note a hyphen and not an underscore.
Have you amended anything in the 'my.ini'?
RE: Your Comment
Then potentially you have another MySQL runing or maybe just a rouge my.ini file on your system.
Search for my.ini and if you find it anywhere other then inside the \wamp\ or \wamp64\ folders, remove or rename it. There should not be one outside the wamp folder structure.
Worked for me
On my system there was another SQL SERVER was running, that was the problem.
Simply go to WAMPMANAGER-> MySQL-> Use a port other than 3306
(In my case, Wamp Manager automatically selected port 3308)
click ok and restart the wamp server.

Wordpress installation - php and mysql are not talking to each other to access database?

I'm trying to get a wordpress local install working on my Mac.
I've recently set up a database, username and password using the MySQL client as per the instructions in the wordpress codex. That part is ok.
When I go to the local site on my computer I'm prompted by wordpress to set up the wp-config.php file. Putting in the same details that definitely work with the MySQL client returns an error.
Manually updating these details in the 'wp-config-sample.php' file and renaming it as 'wp-config.php' also doesn't work - I'm now greeted with a big bold message: "Error establishing a database connection".
From what I can gather, php and mysql are not communicating with each other properly.
I've changed the apache 2 configuration file found in 'etc/apache2/httpd.conf' and uncommented the line which loads the php5 module: LoadModule php5_module libexec/apache2/libphp5.so
and restarted the apache server. This has still not fixed my problem. I'm stuck on what to do next... help appreciated please!
It's been fixed now.
php was looking in the wrong place for the mysql.sock file, and couldn't communicate with the mysql database, meaning wordpress couldn't be set up.
On the command line I typed
ps aux | grep mysql
to bring up as much info about mysql that I could. From this I saw that the mysql socket on my computer is being used at /tmp/mysql.sock
Meanwhile, in the "wp-config.php" file, I changed the line define('WP_DEBUG', false); to define('WP_DEBUG', true); and refreshed my web browser that was showing my localhost setup. This now said a lot more info than "Error establishing a database connection" - infact I could see that the mysql.sock was not configured correctly at all.
Creating a 'phpinfo.php' file with just the single line of code <?php phpinfo(); ?> was the pivotal turning point for me.
Putting that 'phpinfo.php' file in my localhost directory and then viewing it from my web browser not only definitely confirmed that the mysql.sock file was not configured properly, but it also showed where the configurations were being loaded from on my machine: '/private/etc/php.ini'
The next thing I did was open up the 'php.ini' file in a text editor and doing a quick find and replace to update the correct location of mysql.sock.
Finally, a restart of the local apache server needed to be done to fully update all the new settings that I'd been fiddling about with.
sudo apachectl restart
Now everything works fine!
The Error-Message "Error establishing a database connection" indicates clearly, that the php-script can not establish the connection. This can have one of the following reasons:
Your host in the wp-config.php is not correct.
The mysql-server does not listen on that host
The user you set up in the mysql has no privileges to connect the way you are trying
The firewall blocks the access of the php-script to your mysql-host
Try to connect the database with the same settings of your wordpress using Sequel Pro (or any other GUI to connect a mysql database). If the connection works, the problem 2. and 3. isn't your problem.
Look in your firewall-log to make sure 4. is also not your problem.
If all problems are excluded (even 1. after a final check), try to run something like phpMyAdmin to connect your database, to make sure your php-installation has the needed drivers.

phpmyadmin problem

can anyone solve this problem as per new to php
i have jsut installed wampsever 2.1 i am getting this error
my opertating system is windows 7 64 bit
phpmyadmin #2002 - the server is not responding (or the local mysql server's socket is not correctly configured)
The error message is pretty much self-explanatory: your MySQL configuration doesn't match that of php and/or phpmyadmin, or mysql isn't running.
You should do the following:
Make sure MySQL is running
Check phpinfo() for parameters of mysql extension
Check that config.inc.php in phpmyadmin has proper configuration directives

Having troubles configuring PHP to work with mySQL

I'm venturing out of the world of .NET and into the world of open-source. However, I've hit a few roadblocks while trying to get my development environment set up. And I'm kind of stuck on the most recent one.
I have installed: Apache 2.2, php 5.3.2, and mySQL 5.1.48
everything is working pretty much; apache is serving up PHP pages, and I'm able to create databases and tables in mySQL, however, I can't seem to get php to communicate correctly with mySQL. My php.ini has these lines un-commented:
extension=php_mysql.dll
extension=php_mysqli.dll
However, I keep getting this error message:
Warning: mysqli_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mysql_test.php on line 15
any help would be greatly appreciated.
(btw, the php code runs properly when I put it on my web host)
This is most likely a configuration problem with the MySql server. It sounds like it either isn't listening on the correct port or something else is going on with the connection. You have the extensions loaded correctly because PHP is able to find the mysql functions. I would make sure you don't have a firewall blocking any of the requisite ports (actually, just try turning off your firewall and see what happens...just don't forget to turn it back on ;-) ). Also make sure if you are following a tutorial you didn't deviate from the MySQL setup instructions at all. If those don't work, post an update and we can try again.
This looks like bug #45150 : MySQL functions cannot be used with 5.3.x on Vista when using "localhost" -- I've had this problem once, and it took me some time to figure out what was causing it...
If you are working with Windows Vista (and possibly seven ?), and trying to connect to MySQL using "localhost" as host, try to replace that by the corresponding IP address : "127.0.0.1"
Or try to edit the hosts file, and to un-comment the line that corresponds to localhost in IPv4 :
127.0.0.1 localhost
(Remove the # at the beginning of the line)
Or to comment the line that corresponds to localhost in IPv6 :
#::1 localhost
(Add a # at the beginning of the line)
And here's an interesting article about that : PHP 5.3 and MySQL connectivity problem
Use XAMPP - it'll remove any headaches like this for local development.
XAMPP is a very easy to install Apache Distribution for Linux, Solaris, Windows and Mac OS X. The package includes the Apache web server, MySQL, PHP, Perl, a FTP server and phpMyAdmin.

phpmyadmin using mysqli connects, but my php using mysqli errors out

This is driving me nuts! I am getting the classic "Can't connect to local MySQL server through socket '/var/run/mysql4d/mysql4d.sock' (13)".
Everything I've dug up so far tells me my setup should be OK (eg, defining the sockets in php.ini and my.cnf, etc). Worse... phpmyadmin works with the same un/pw I am using in my own php. So obviously it's possible to connect, but I am screwing it up
I tried reverse-engineering the connection from phpmyadmin, but gave up it as too convoluted after a couple hours.
Can anyone offer some advice?
My configuration: Ubuntu 9.10 (Karmic), Apache 2.2, PHP 5.2.6, MySQL 4.1.22 (for legacy app reasons).
my.cnf (/var/lib/mysql4/my.cnf):
[client]
port = 3306
socket = /var/run/mysql4d/mysql4d.sock
[mysqld]
port = 3306
socket = /var/run/mysql4d/mysql4d.sock
php.ini (/etc/php5/apache2/php.ini):
[MySQL]
mysql.default_socket = /var/run/mysql4d/mysql4d.sock
[MySQLi]
mysql.default_socket = /var/run/mysql4d/mysql4d.sock
Same problem using mysql instead of mysqli, btw.
EDIT:
I should mention that I have installed mysql4 alongside the ubuntu default install of php & mysql for use with a legacy application and it is this installation that I am having trouble connecting with. I tried this:
ini_set('mysql.default_socket', '/var/run/mysql4d/mysql4d.sock');
and now the connection goes thru, but all queries return empty sets. (cries in frustration)
This sounds like a permission problem in /var/run/mysql4d/mysql4d.sock. What user are you running this as? Are the permissions o.k. on file system level?
If you Google for the error messages, you'll find a lot of people who had this and it was always a permission issue, sometimes due to an activated SELinux. Check this thread for a few possible solutions.

Categories