File Path issue when moving project from cpanel to xampp

Hi folks,

i am new to xampp. i just moved a small php project from cpanel to xampp for some updates. Now this way of referring files are no longer working in xampp. Please help me to find a fix without having to edit this in many many places.

cpanel

require_once(“/includes/pdo_connection.php”);

xampp

require_once(“includes/pdo_connection.php”);

now i have to fix like this in many of the places. i have no idea how do i manage it manually. please help an easy way.

I assume when you talk about cpanel you are referring to your live site?

Will your live site not work using require_once(“includes/pdo_connection.php”);?

Hi gandalf458

nop, i am now talking about xampp site.
this does not work in xampp

require_once(“/includes/pdo_connection.php”);

so now i have forced to change the php paths on entire projects?

I don’t see any option but to change all occurrences.

1 Like

You should be using relative links whenever possible anyway.

2 Likes

Yeah, that was what I was suggesting really.

1 Like

Fortunately there is a way to make the local site work like the live site does:

Check out XAMPP’s configuration and edit the virtual domain and the host file.

1 Like

Thank you all,

i ll look in to both options. and i also just found for the first time that there is search and replace local files option too in notepad ++ which might help if i were to adjust the links.

also ill check the option for modifying the configuraiton file as stated in the last reply.

2 Likes

Hi all,

after some reading on relative paths, i am now just doing a seach and replace of all
paths to relative paths using notepad ++ search and replace in files option.

Thank you.

css/datepicker.css is relative.

/css/datepicker.css is absolute - it’s saying look for the css directory in the root directory.

2 Likes

thanks

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