M'Baku
M'Baku

Reputation: 320

Requiring previous dir in php throws 500 error

I have a PHP file in my local machine where I require some files in previous folders like this

"require_once("/../function_collection/pagination_functions.php")"

it works perfectly on my local machine using WAMPP, but when i put this exact same line on my codes on the live server it throws a 500 error. What could I be doing wrong? and I have uploaded all neccessary files and folders.

Upvotes: 1

Views: 37

Answers (1)

Matthew Knight
Matthew Knight

Reputation: 631

  1. You don't need quotes around the require line.

require_once("/../function_collection/pagination_functions.php");

  1. You're trying to use an absolute and relative path - ie. /../ won't work. Either use:

if its one directory up:

require('../function_collection/pagination_functions.php');

or use the full path, i.e.

require('/path/to/function_collection/pagination_functions.php');

Hope that helps!

Upvotes: 1

Related Questions