I feel like I must be missing something very obvious, because I've never had this happen before!
I'm running a local PHP server running the following command:
php -S localhost:8888 index.php
When I go to the URL, the HTML and all the php code run just fine.
However, whenever I add a script tag to add JS in the header, I recieve the following error:
Uncaught SyntaxError: Unexcepted token <
And when I attempt to add a CSS file I get this error:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8888/assets/style.css".
No matter whether I try and include the header by using PHP include:
<?php include("../includes/layouts/header.php"); ?>
Or directly adding a header and these imports in index.php, I always receive these errors.
My hunch was it was an issue with the directory tree. But I've even placed the CSS and JS files in the same directory as index.php and have added the header code to index.php, yet I still get these errors.
Header code
<!DOCTYPE html Public "HTML TEMPLATE">
<html lang="en">
<head>
<title>Title</title>
<link rel="stylesheet" href="style.css" media="all" title="no title" type="text/css" charset="utf-8">
<script src="script.js"></script>
</head>
<body>
<div id="header">
<h1>Header</h1>
</div>
script.js:
$( document ).ready(function() {
console.log( "ready!" );
});
Console log of errors:
Adding an image of my current project structure:


/in front of the URL:href="/path-from-doc-root/style.css"andsrc="/path-from-doc-root/script.js"etc. That way, all links and references will work no matter what URL they are under. If that doesn't work, show us your file/folder structure.script.js:3