Firstly I should let you know that I have no idea what I am doing, so will need explanations in very simple terms.
About 7 years ago I created a website, with database, using XAMPP on my PC while I worked on it. I then had the site online for years but hosted by someone else, so I uninstalled XAMPP, but now need to make changes to the site and database while it is offline and on my computer.
I have completely forgotten how I got the site and database to run using XAMPP and I know almost nothing about php or SQL, so I need an idiot's guide (I'm sure you are shaking your head in despair by now). I know it can be done because I did it years ago when I worked on this same site.
I have Vista Home Premium and I installed XAMPP 1.8.0, then I put all my site's html and php files (e.g. index.php, library and include folders of files etc., exactly as they were when on my web hosts server) in XAMPP's htdocs folder but if I open the site and go to the index page, all I see in the browser is the php code on that file, it does not seem to extract information from the database and build the page as it did when hosted online. That is, when I go to file:///C:/xampp/htdocs/index.php all it displays in the browser is the php code that is on the index.php file.
I also tried installing XAMPP 1.5.1, as it was probably that one I used first time, but I uninstalled it and put in 1.8.0 instead, however it seems to make no difference which one I use.
I don't know where I should put my database's .sql file (mine is called shopbase.sql) or how to get the site's php files to display the pages properly using data from the database, as it did online. I have currently got that .sql file in C:/xampp/htdocs/mysql/data. I also tried it in C:/xampp/htdocs/mysql - neither place seems to work
I know the site files are fine, as the site displays and behaves as it should when uploaded to my web host and online, I just don't know how to do the same thing with them on my own PC using XMAPP. I don't know if the .sql file is in the wrong place, if I'm overlooking something or if I need to alter code or configurations somewhere to get them to work while in XAMPP's htdocs folder. I probably have to change password and user for the database but I don't think I have even got this working far enough to have even hit that problem yet.
My index.php page begins with...
<?php
require_once 'library/config.php';
require_once 'library/category-functions.php';
require_once 'library/product-functions.php';
require_once 'library/cart-functions.php';
$_SESSION['shop_return_url'] = $_SERVER['REQUEST_URI'];
$catId = (isset($_GET['c']) && $_GET['c'] != '1') ? $_GET['c'] : 0;
function valid_pdId($get)
- <?php
- require_once 'library/config.php';
- require_once 'library/category-functions.php';
- require_once 'library/product-functions.php';
- require_once 'library/cart-functions.php';
- $_SESSION['shop_return_url'] = $_SERVER['REQUEST_URI'];
- $catId = (isset($_GET['c']) && $_GET['c'] != '1') ? $_GET['c'] : 0;
- function valid_pdId($get)
My config.php file (as seen above in the line with require_once 'library/config.php') begins with...
<?php
ini_set('display_errors', 'On');
//ob_start("ob_gzhandler");
error_reporting(E_ALL);
// start the session
session_start();
$dbHost = 'localhost';
$dbUser = 'esite';
$dbPass = 'xintox';
$dbName = 'esite';
// setting up the web root and server root for
// this application
$thisFile = str_replace('\\', '/', __FILE__);
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$webRoot = str_replace(array($docRoot, 'library/config.php'), '', $thisFile);
$srvRoot = str_replace('library/config.php', '', $thisFile);
define('WEB_ROOT', $webRoot);
define('SRV_ROOT', $srvRoot);
- <?php
- ini_set('display_errors', 'On');
- //ob_start("ob_gzhandler");
- error_reporting(E_ALL);
- // start the session
- session_start();
- $dbHost = 'localhost';
- $dbUser = 'esite';
- $dbPass = 'xintox';
- $dbName = 'esite';
- // setting up the web root and server root for
- // this application
- $thisFile = str_replace('\\', '/', __FILE__);
- $docRoot = $_SERVER['DOCUMENT_ROOT'];
- $webRoot = str_replace(array($docRoot, 'library/config.php'), '', $thisFile);
- $srvRoot = str_replace('library/config.php', '', $thisFile);
- define('WEB_ROOT', $webRoot);
- define('SRV_ROOT', $srvRoot);
I also tried a very simple test file which isn't displaying properly...
<html>
<head>
<title>PHP Test 1</title>
</head>
<body>
<p>This is an html line</p>
<?php echo "this is a php line"; phpinfo();
?>
</body></html>
- <html>
- <head>
- <title>PHP Test 1</title>
- </head>
- <body>
- <p>This is an html line</p>
- <?php echo "this is a php line"; phpinfo();
- ?>
- </body></html>
When I open it in the browser, all it shows is the line 'This is an html line'.
It does
not show the line saying 'This is a PHP line'.
Is there something I should have done to make XAMPP display php?
Please bear in mind that I have virtually no knowledge of mysql or php. I didn't originally write the php or create the database, I only added to the database using the ready made files with XAMPP on my PC. The person who helped me then is no longer available to help again. I need the site to display offline exactly as it did when it was online and to have access to the database so that I can add and remove things while it is offline.
Grateful for any help that can be provided.
Regards,
Cerio