Answer the question
In order to leave comments, you need to log in
How to deal with relative paths in the PHP Embedded Web Server?
I'm sorry for the idiotic question. Such situation. PHP, as you know, has a built-in web server, activated on Windows with a simple command like: php -S localhost:666 -t C:\projects\www
Everything works fine, but there is one nonsense that torments me - this is a problem with relative paths. PHP scripts transferred from a Linux web server to Windows simply stop working, since they contain relative paths of inserts and connected cascading tables, for example:
<link rel="stylesheet" type="text/css" href="style.css">
include 'action.php';
<link rel="stylesheet" type="text/css" href="C:\projects\www\style.css">
include 'C:\projects\www\action.php';
Answer the question
In order to leave comments, you need to log in
I asked the question myself, and I will answer it myself. The whole snag was in the nuance of path processing - on the local machine, I tried to open in the browser like this:
And it should have been like this:
Those. forward slash at the end. Apache redirects this automatically, but PHP apparently forgot about it ;) Well, I didn't know either - such pitfalls are not mentioned in prominent places.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question