Accessing database from the Desktop

If you put a simple file in your localhost only, not live

<?php
phpinfo();
?>

you should see something like this if the mysqli extention is set-up correctly.

May I add that using “root” on the localhost may make the project run locally but problems will arise when uploaded to the server because of different login details.

Creating a global constant can circumvent this problem.

<?php

define("LOCALHOST", "localhost" === $_SERVER['SERVER_NAME'] );

// usage
$uName = LOCALHOST ? "root" : "serverUserName" ;
$pWord  = LOCALHOST ? "123" : "serverPassword" ;
1 Like

Hi

very sorry, everybody. I was out most of the afternoon/evening yesterday.

Now, I tried to get the php.info

I can see it if I use it live, directly from my site’s url. What should I look for?

If there is nothing very secret about it (passwords, etc) I can post the url

If I try http://localhost/Sqli.php to access the htdocs I get a message “This site can’t be reached”

EDIT

Once again, I was trying without launchinc Xampp…

Now iI got the phpinfo. It appears to be the same I got directly from the server,

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.