In Xampp how to check what my $dbHost, $dbUser, $dbPass) are

Problems with the Windows version of XAMPP, questions, comments, and anything related.

In Xampp how to check what my $dbHost, $dbUser, $dbPass) are

Postby Cocori » 12. July 2017 21:54

Hi.
I am having a problem opening my website in Xampp. I need to access my website offline, so I installed Xampp but when I try to open my website via indes.php, I get this error...
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\Xampp\htdocs\wafukusite\library\database.php:4 Stack trace: #0 C:\Xampp\htdocs\wafukusite\library\config.php(65): require_once() #1 C:\Xampp\htdocs\wafukusite\index.php(2): require_once('C:\\Xampp\\htdocs...') #2 {main} thrown in C:\Xampp\htdocs\wafukusite\library\database.php on line 4

This is line 4 of database.php
Code: Select all
$dbConn = mysql_connect ($dbHost, $dbUser, $dbPass) or die ('MySQL connect failed. ' . mysql_error());


I was sure I had the host $dbHost (which is localhost), user $dbUser and password $dbPass correct in the config.php file but I now wonder if I haven't.
I am way, way out of my depth here, I don't know php, sql or much else but I have to do this by myself, so I have to muddle through. What I would like to know is how to check in Xampp what my host, user and password are ($dbHost, $dbUser, $dbPass), to be sure I have that correct in the config.php file. Where and how in Xampp do I check that? Please remember I am a total novice, so explanations have to be very clear and full, please don't presume I have any knowledge in this matter, because I am afraid I don't.

I would be so grateful for some help with this.

Thank you.

C
User avatar
Cocori
 
Posts: 4
Joined: 22. September 2012 02:03
Operating System: Windows Vista Home Premium

Re: In Xampp how to check what my $dbHost, $dbUser, $dbPass)

Postby Nobbie » 12. July 2017 23:31

Read the error message carefully again. The problem is not the host, nor the user, nor the password. Instead the problem is the function mysql_connect(), this function does not exist (anymore). The Mysql API is deprecated and has been removed from PHP7. Either use Mysqli API instead or the PDO layer, or do not use PHP7, instead use PHP 5.x (i.e. Xampp 5.x).
Nobbie
 
Posts: 9697
Joined: 09. March 2008 13:04

Re: In Xampp how to check what my $dbHost, $dbUser, $dbPass)

Postby Cocori » 13. July 2017 16:52

Ah, thank you.
Reading the error message carefully would not make a difference, what the error message says means nothing to me. I also have no idea what "Either use Mysqli API instead or the PDO layer" means, since I know nothing about php or mysql at all, so I will try to find Xampp5 and install that instead, which I dread since it took me 6 hours to install the one I have now.
Thank you for that suggestion. Fingers crossed.

C.
User avatar
Cocori
 
Posts: 4
Joined: 22. September 2012 02:03
Operating System: Windows Vista Home Premium

Re: In Xampp how to check what my $dbHost, $dbUser, $dbPass)

Postby Nobbie » 13. July 2017 18:09

Cocori wrote:so I will try to find Xampp5


Thats quite difficult to overlook as Xampp7 and Xampp5 are available on the same download site, one link directly above the other. See https://www.apachefriends.org/download.html
Nobbie
 
Posts: 9697
Joined: 09. March 2008 13:04

Re: In Xampp how to check what my $dbHost, $dbUser, $dbPass)

Postby Cocori » 13. July 2017 23:29

Thank you so much for
help.
I now have it working fine. Phew.
User avatar
Cocori
 
Posts: 4
Joined: 22. September 2012 02:03
Operating System: Windows Vista Home Premium

Re: In Xampp how to check what my $dbHost, $dbUser, $dbPass)

Postby Nobbie » 14. July 2017 10:52

Fine.

The main problem is that PHP7 is quite new and many products (i dont know which product you are speaking about) arent yet tested on PHP7. In PHP7 for example the interface between PHP and MySQL has been changed (what results in your current problem). The developer of that product has to adapt his scripts in future, if they should run with PHP7. PHP7 is also not very common at providers and Online servers, most providers are still working with PHP 5.x. (What is about PHP6? PHP6 was kind of "experimental" release and has never reached productivity level, therefore PHP7 is the official follower to PHP5).
Nobbie
 
Posts: 9697
Joined: 09. March 2008 13:04

Re: In Xampp how to check what my $dbHost, $dbUser, $dbPass)

Postby Altrea » 14. July 2017 11:45

PHP7 was released 19 months ago. If the current version of a webapplication does not support PHP 7 i would not use it anymore.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8947
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 43 guests