Note that there are some explanatory texts on larger screens.

plurals
  1. POchange the web root directory in apache (xampp)
    primarykey
    data
    text
    <p>When I echo "PHP_SELF" in localhost running on xampp, I get the project folder as the echoed text e.g.</p> <pre><code>// index.php &lt;?php echo $_SERVER["PHP_SELF"]; ?&gt; </code></pre> <p>The answer is </p> <blockquote> <p>/a3-ver-9.0/index.php</p> </blockquote> <p>but if I was on a server with a domain, that line would just return <code>"/index.php"</code></p> <p>Is there any way I can temporarily changes the default root in xampp to reflect this?</p> <p>The reason is because I use absolute paths from root to include resources e.g. images. however these absolute paths will not work if the root is not set correctly!</p> <p>Cheers</p> <p><b>EDIT</b></p> <p>To make things more clear...</p> <p>I have a website with php files that return parts of the page e.g. header.php and footer.php etc.</p> <p>I have an installation of wordpress and in the wordpress template, I include these files. and because im including these files from different directories, the paths inside the included files must be absolute.</p> <p>however the files in the header.php are included like:</p> <pre><code>&lt;img src="/images/image1.jpg" /&gt; </code></pre> <p>now this include is correct, and when I've finished the project and upload it to my server it will correctly retrieve the image.</p> <p>but when working with localhost, the root folder "/" is the folder where ALL my local projects are kept.</p> <p>So i need a way to temporarily change the localhost root for each project, so i dont have to mess about changing a load of paths when the project is ready for upload!</p> <p>Hope this made more sense</p> <p>However when working on local host</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload