FATAL ERROR: Uncaught Error: Call to undefined function mysql_connect();

906 views
Skip to first unread message

Terry Gray

unread,
Aug 11, 2017, 11:56:22 PM8/11/17
to Xataface
I am using MySQL-5.7, PHP7.0, xataface-master (latest git) running on a vagrant Ubuntu 16.04 LAMP box.  When I run installer.php I get the following:

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /vagrant/xataface-master/xf/db/drivers/mysql.php:2 Stack trace: #0 /vagrant/xataface-master/installer.php(533): xf_db_connect('localhost', 'root', 'root') #1 /vagrant/xataface-master/installer.php(548): db() #2 {main} thrown in /vagrant/xataface-master/xf/db/drivers/mysql.php on line 2

Any solutions:

Steve Hannah

unread,
Aug 11, 2017, 11:58:10 PM8/11/17
to xata...@googlegroups.com
You'll need to use mysqli

The deprecated mysql extension is still the default so as not to break legacy apps, but it is easy to flip the switch.

Steve

--
You received this message because you are subscribed to the Google Groups "Xataface" group.
Visit this group at https://groups.google.com/group/xataface.
To view this discussion on the web visit https://groups.google.com/d/msgid/xataface/e3acfd56-87d2-4ebb-9e38-09a893799a97%40googlegroups.com.



--
Steve Hannah
Web Lite Solutions Corp.

Terry Gray

unread,
Aug 12, 2017, 11:10:02 AM8/12/17
to Xataface
I did as you suggested and ran the ant script.  It yielded:

Buildfile: /home/twgray/Vagrant_Boxes/Eun_Ubuntu1604Lamp/xataface/fix-deprecated-mysql-ant-task.xml

convert-mysqli:

BUILD SUCCESSFUL
Total time: 5 seconds

My browser still has a white screen but my error.log has the following:

[Sat Aug 12 14:14:20.157996 2017] [:error] [pid 1352] [client 10.0.2.2:45340] PHP
Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in
/vagrant/xataface/xf/db/drivers/mysql.php:2\nStack trace:\n#0
/vagrant/xataface/installer.php(533): xf_db_connect('localhost', 'root', 'root')\n#1
/vagrant/xataface/installer.php(548): db()\n#2 {main}\n  thrown in
/vagrant/xataface/xf/db/drivers/mysql.php on line 2

It doesn't seem that the script modified all the calls. 
I will go ahead and use manual configuration, but I would like to see the web install.  Any more ideas?

Steve Hannah

unread,
Aug 12, 2017, 11:17:17 AM8/12/17
to xata...@googlegroups.com
I see.  The installer works a bit differently.  Please try a manual install.  

Terry Gray

unread,
Aug 12, 2017, 2:05:57 PM8/12/17
to Xataface
OK, I have done a manual install, following the "4 lines of code " example.  When I run it I get this:


Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 262144 bytes) in /vagrant/dbParts/xataface/xf/db/drivers/mysql.php on line 2

I then copied a working application, based on older version of xataface, and get the same error. 

???

Steve Hannah

unread,
Aug 12, 2017, 2:13:35 PM8/12/17
to xata...@googlegroups.com
When you ran the ant script to convert mysql calls, did you run it on the xataface directory? If so, that could have screwed things up.

I recommend a fresh install of xataface.  Download from the github master

Terry Gray

unread,
Aug 12, 2017, 4:05:02 PM8/12/17
to Xataface
I didn't have this much trouble setting xataface up a couple years ago...

I did as you recommended and downloaded xataface-master and started all over again.  I used makesite this time around, using the drive=mysqli.  It successfully created an app.  I then ran the ant script against the app directory (xataface is in the same root as the app), with this response:

twgray@Rampage:~/Vagrant_Boxes/Eun_Ubuntu1604Lamp/dbParts$ ant -f fix-deprecated-mysql-ant-task.xmlBuildfile: /home/twgray/Vagrant_Boxes/Eun_Ubuntu1604Lamp/dbParts/fix-deprecated-mysql-ant-task.xml

convert-mysqli:

BUILD SUCCESSFUL
Total time: 0 seconds

Upon logging onto the site I was prompted in my browser to create a templates_c directory in my app directory.  After that my browser gave the following error:

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /vagrant/xataface/xf/db/drivers/mysql.php:2 Stack trace: #0 /vagrant/xataface/Dataface/Application.php(605): xf_db_connect('localhost', 'root', 'root') #1 /vagrant/xataface/Dataface/Application.php(1081): Dataface_Application->Dataface_Application(Array) #2 /vagrant/xataface/public-api.php(58): Dataface_Application::getInstance(NULL) #3 /vagrant/dbParts/index.php(11): df_init('/vagrant/dbPart...', '/dataface') #4 {main} thrown in /vagrant/xataface/xf/db/drivers/mysql.php on line 2

Where do we go from here?

Steve Hannah

unread,
Aug 12, 2017, 4:07:27 PM8/12/17
to xata...@googlegroups.com
Check your conf.ini file.  Sounds like it doesn't include the driver directive


If you're starting fresh you don't need to use the ant script at all 

Terry Gray

unread,
Aug 12, 2017, 4:31:12 PM8/12/17
to Xataface
That was it...missed the last detail in reading using-mysqli-in-xataface.html.

Thanks for the help!

Terry Gray

unread,
Aug 12, 2017, 5:20:38 PM8/12/17
to Xataface
Is there some guide for upgrading a site from an older version of xataface to the latest?  My old site doesn't work, at all!  The only thing that looks similar is the dynamic valuelists (they don't display, but the syntax in the file looks similar), and some of the fields.ini syntax...not all, but some. 

I've been a software and hardware devloper for a very long time and I remember a couple years ago when I created my inventory database with xataface that I spent many long hours relearning all this...I don't do web development very often. 

So, my original question...is there a conversion/upgrade guide?  And thanks for your very quick response to my original installation problem.

Steve Hannah

unread,
Aug 12, 2017, 6:18:03 PM8/12/17
to xata...@googlegroups.com
Just clear out your templates_c directory.  Replace the old xataface folder with your new one.

That's it.

Depending on how old your site was you may want to disable the g2 theme (disable_g2=1 in conf.ini)

If you get that far then it should mostly work.  Might need to set another couple of flags to revert to older behaviour- but those would be tweaks.

If not working at all then you need to go to your error logs to find out why.

Terry Gray

unread,
Aug 12, 2017, 11:37:56 PM8/12/17
to Xataface
Where did the nice tabbed view shown in all the tutorials go? What I am getting is a very stark view with no tabs or grids or headings. I even downloaded the FacultyOfWidgetry demo code and it is the same. This is why I thought my new installation wasn't using my old code.

Is the G2 theme no longer viable? Is there an alternative?

Again, thanks.

Reply all
Reply to author
Forward
0 new messages