twilio / OpenVBX

OpenVBX is a web-based open source phone system for business.
http://openvbx.org
Other
700 stars 341 forks source link

MySQL not detected #390

Open kenanchristian opened 7 years ago

kenanchristian commented 7 years ago

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

darkmarsuk commented 7 years ago

Hey,

Have you got php-mysql installed?

kenanchristian commented 7 years ago

@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

zero-master commented 7 years ago

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

svpn commented 7 years ago

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

ctorgalson commented 7 years ago

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.

brandonsmits commented 7 years ago

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

michael2h4ng commented 7 years ago

@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.

Dagger55555 commented 6 years ago

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.

ibrmora commented 6 years ago

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

cardened commented 6 years ago

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

ntemple commented 6 years ago

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 commented 6 years ago

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?
gegere commented 6 years ago

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 notifications@github.com 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.

sj0x0101 commented 5 years ago

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!

onairmarc commented 4 years ago

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.

navinkr91556 commented 4 years ago

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