OpenVBX icon indicating copy to clipboard operation
OpenVBX copied to clipboard

MySQL not detected

Open kenanchristian opened this issue 8 years ago • 16 comments

I just downloaded the installer, then access the installation page. Fixed all unmet requirement, but can't seem to figure out this one.

MySQL is installed just fine on my DigitalOcean droplets, I can access it using phpmyadmin and cli, but the installation page always shows this image

kenanchristian avatar Jan 26 '17 11:01 kenanchristian

Hey,

Have you got php-mysql installed?

darkmarsuk avatar Feb 01 '17 23:02 darkmarsuk

@darkmarsuk Yes it's already installed :) btw, i think this problem only happen on Ubuntu machine. I tried to install it on centos 6 and it detects mysql without any problems

kenanchristian avatar Feb 02 '17 06:02 kenanchristian

It seems you are running over PHP 5.4. If you downgrade it to PHP 5.5, this issue will disappear.

zero-master avatar Feb 06 '17 19:02 zero-master

Be nice if this could be upgraded to work with PHP7.

svpn avatar Feb 21 '17 02:02 svpn

PHP 5.4 and PHP 5.5 have both been end of life for some time. That means totally unsupported, so downgrading below PHP 5.6 is not an option.

Digging around, the mysql check uses function_exists() to check for a deprecated function (mysql_connect()) that is only used once in the codebase outside of the check itself:

$ /var/www/example.com$ grep -R mysql_connect .
./system/database/drivers/mysql/mysql_driver.php:		return @mysql_connect($this->hostname, $this->username, $this->password, TRUE);
./OpenVBX/controllers/install.php:		$this->add_test(function_exists('mysql_connect'),
./OpenVBX/controllers/install.php:			if(!($dbh = @mysql_connect($database['default']['hostname'],
./OpenVBX/controllers/install.php:			if(!($dbh = @mysql_connect($database['default']['hostname'],

However, if you look in system/database, you see there are drivers for multiple types of databases:

$ ls -hal system/database/drivers
total 40K
drwxrwxr-x 9 ctorgalson ctorgalson 4.0K Mar  5 19:43 .
drwxrwxr-x 3 ctorgalson ctorgalson 4.0K Mar  5 15:47 ..
-rw-rw-r-- 1 ctorgalson ctorgalson  114 Mar  5 15:47 index.html
drwxrwxr-x 2 ctorgalson ctorgalson 4.0K Mar  5 15:47 mssql
drwxrwxr-x 2 ctorgalson ctorgalson 4.0K Mar  5 15:47 mysql
drwxrwxr-x 2 ctorgalson ctorgalson 4.0K Mar  5 15:47 mysqli
drwxrwxr-x 2 ctorgalson ctorgalson 4.0K Mar  5 15:47 oci8
drwxrwxr-x 2 ctorgalson ctorgalson 4.0K Mar  5 15:47 odbc
drwxrwxr-x 2 ctorgalson ctorgalson 4.0K Mar  5 15:47 postgre
drwxrwxr-x 2 ctorgalson ctorgalson 4.0K Mar  5 15:47 sqlite

So it looks like if you're willing to do a manual installation, the currently supported mysqli and postgre drivers should work.

ctorgalson avatar Mar 05 '17 19:03 ctorgalson

@ctorgalson I have the same issue - how do I manually install?

brandonsmits avatar Mar 22 '17 09:03 brandonsmits

@brandonsmits What you want to do is manually add two configuration files database.php and openvbx.php under OpenVBX/config, and populate the database with openvbx.sql from the root folder.

There are two sample files database-sample.php and openvbx-sample.php under OpenVBX/config, which you may use as the template when filling out the information.

As @ctorgalson pointed out, make sure you use mysqli driver instead of the default mysql driver.

michael2h4ng avatar Apr 13 '17 01:04 michael2h4ng

This was a great help! Couldn't quite figure out how to do the manual install (I'm a windows guy) but I was able to install php 5.6 using https://lornajane.net/posts/2016/php-7-0-and-5-6-on-ubuntu

As per post, once I did that and added back the 5.6 versions of the extensions everything went green! From what I can tell 5.6 is still supported so that should avoid you security concerns.

Dagger55555 avatar Jul 30 '17 19:07 Dagger55555

Use this fabric python script to set openVBX. Note use Debian 7 https://gist.github.com/ibrmora/cdaa8e9cd4db661b00ff311c2dd023d7

ibrmora avatar Aug 02 '17 14:08 ibrmora

Thank you @zero-master

I was having this same error, and all I did was CHANGE My PHP Version on my Shared Hosting on Hostgator (which was on 7.0), to the latest stable version: 5.6, following this vide instructions, and it immediately solved the problem/error message of "MySQL not detected"! --> https://www.youtube.com/watch?v=ayUEHjmUSvs

cardened avatar Aug 25 '17 02:08 cardened

A manual install doesn't completely work. openvbx.php (copied from openvbx_sample.php) also needs the key 'salt' added, otherwise an endless loop results.

You'll need to manually insert additional data, I haven't quite figured out what yet. After a user began working, there was then an endless loop wanting to update the db. I'm moving toward just fixing the installer.

ntemple avatar Mar 08 '18 05:03 ntemple

Here's my solution, open to discussion. The appropriate solution is to move from mysql to mysqli across the board. However, bar that work I created a "adapter" to put the mysql functions back into PHP7.

https://gist.github.com/anonymous/06e2c1fe2d3ab6ece4c453539f8c77fb

  1. Place this file in OpenVBX/controllers/ (or wherever is convenient)
  2. in OpenVBX/controllers/install.php add an include to the top of the file

require('mysql_adapter.php');

At this point, you can get through the install.

Tasks:

  1. refactor the install system to use mysqli (or preferably bootstrap the database system)
  2. create database dump with necessary artifacts. This may be a little difficult because it looks like the installer is calling out to Twilio to get an application_sid and storing that into the settings. Maybe a command line installer?

ntemple avatar Mar 08 '18 07:03 ntemple

I support this idea.

Should there be a new Github Organization and commit approval practices for secure and proper tests?

On Mar 8, 2018, at 07:16, Nick Temple [email protected] wrote:

Here's my solution, open to discussion. The appropriate solution is to move from mysql to mysqli across the board. However, bar that work I created a "adapter" to put the mysql functions back into PHP7.

https://gist.github.com/anonymous/06e2c1fe2d3ab6ece4c453539f8c77fb

Place this file in OpenVBX/controllers/ (or wherever is convenient) in OpenVBX/controllers/install.php add an include to the top of the file require('mysql_adapter.php');

At this point, you can get through the install.

Tasks:

refactor the install system to use mysqli (or preferably bootstrap the database system) create database dump with necessary artifacts. This may be a little difficult because it looks like the installer is calling out to Twilio to get an application_sid and storing that into the settings. Maybe a command line installer? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

gegere avatar Mar 08 '18 07:03 gegere

Hi,

This might be little late to post a comment but i know that there are folks trying to use OpenVBX and cannot get help when trying to fix issues. I have had MySQL issues more than a couple of occasions and couldn't find any help online. So, I decided to write a simple tutorial that anyone can follow. Give it a read if you need to Install OpenVBX on Cloud.

Cheers!

sj0x0101 avatar Aug 12 '18 20:08 sj0x0101

Here's my solution, open to discussion. The appropriate solution is to move from mysql to mysqli across the board. However, bar that work I created a "adapter" to put the mysql functions back into PHP7.

https://gist.github.com/anonymous/06e2c1fe2d3ab6ece4c453539f8c77fb

  1. Place this file in OpenVBX/controllers/ (or wherever is convenient)
  2. in OpenVBX/controllers/install.php add an include to the top of the file

require('mysql_adapter.php');

At this point, you can get through the install.

Tasks:

  1. refactor the install system to use mysqli (or preferably bootstrap the database system)
  2. create database dump with necessary artifacts. This may be a little difficult because it looks like the installer is calling out to Twilio to get an application_sid and storing that into the settings. Maybe a command line installer?

Has this been proven to work? Or is there another solution floating around that I'm not seeing.

onairmarc avatar Dec 17 '19 19:12 onairmarc

Normal web server are using Cpanel and Cpanel use MariaDB on the server. The MariaDB is highly compatible with MySQL. The applications OpenVbx which require MySQL, not MariaDB. If you want to use it then go on cloud and install manually Apache, MySQL.

For more information on how to install OpenVbx on cloud check out this link:- Install OpenVbx

navinkr91556 avatar May 07 '20 21:05 navinkr91556