Jump to content

Problem using config.php


foxclone

Recommended Posts

I'm trying to convert existing website php code to use config.php on my local server but keep getting the following http 500 error before anything shows on the screen:

"This page isn’t working

foxtest is currently unable to handle this request."

My config directory is within my project directory until I get this working. Here's the contents of config.php:

<?php

$app_root = DIRNAME(__DIR__);

$php_path = $app_root.'config/';

include_once $php_path.'PDO_Connection_Select.php';

include_once $php_path.'GetUserIpAddr.php';

Here's my index.php

<?php 

require_once('config/config.php');


$ip = $php_path.'GetUserIpAddr()';
if (!$pdo = $php_path.'PDOConnect("foxclone_data")')   {	
    exit;
    }
   
$stmt = $pdo->prepare("INSERT INTO access (address) values (?)");
$stmt->execute([$ip]) ;      	

require_once("header.php"); 
?>

<header class="header">
    <div class="header-content">
      <div class="text-container">
	    <div class="header__top" style="text-align:center;">FoxClone</div>
	      <p class="p-small">FoxClone is a image backup, restore, and clone tool for Windows and Linux systems, using a simple point-and-click interface. Being Linux-based, it boots to its own system exclusive of anything on the hard disk drive (HDD) or solid disk drive (SSD), where it takes images of the partitions and stores them for later restoration. The resulting image files can optionally be compressed to save space.
.</p>
        
      </div>                 
    </div>
 </header> 

<body>  
  <nav class="navbar" style="background:transparent;">
    <div class="navbar-links">
	    <ul>
		    <li><a href="index.php">Home</a></li>
		    <li><a href="features.php">Features</a></li>
		    <li><a href="legal.php">Legal</a></li>
		    <li><a href="contact.php">Contact</a></li>
		    <li><a href="download.php">Downloads</a></li>
	    </ul>
    </div>
  </nav>

 
  <header class="header">
    <div class="header-content">
      <div class="text-container">
	    <div class="header__top" style="text-align:center;">FoxClone</div>
	      <p class="p-small">FoxClone is a image backup, restore, and clone tool for Windows and Linux systems, using a simple point-and-click interface. Being Linux-based, it boots to its own system exclusive of anything on the hard disk drive (HDD) or solid disk drive (SSD), where it takes images of the partitions and stores them for later restoration. The resulting image files can optionally be compressed to save space.
.</p>
        
      </div>                 
    </div>
 </header> 

 <?PHP require_once("footer.php"); 

I know I must be looking past the problem after looking at the code for several hours, but I'm stumped. I'd appreciate some help on this.

Link to comment
Share on other sites

And what are you trying to tell us???

Your earlier post was creating a path variable to point to a config folder.  Why is that?  What you want is to point to the config FILE so that you can open it and GET all the paths you need to have.

Link to comment
Share on other sites

If this is the code you have, I will reiterate that it is invalid:

 

$ip = $php_path.'GetUserIpAddr()';

You can't refer to a function in a file like this.  The function is in your 'GetUserIpAddr.php' script if I recall, so you have already included that code in your config.php.  All you need do is use the function -- it is available globally.

$ip = GetUserIpAddr();

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.