foxclone Posted March 4, 2022 Share Posted March 4, 2022 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. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 4, 2022 Share Posted March 4, 2022 One click look tells me that you have a misunderstaning. php path is not going to be app_root.config It is (probably) going to be app_root/../php Quote Link to comment Share on other sites More sharing options...
foxclone Posted March 4, 2022 Author Share Posted March 4, 2022 The config directory is under the public_html directory as shown in this screenshot. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 4, 2022 Share Posted March 4, 2022 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. Quote Link to comment Share on other sites More sharing options...
gizmola Posted March 6, 2022 Share Posted March 6, 2022 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(); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.