I have the next web site folder structure (in short):
..."index.php" calls "app.js" with the line:
<?php include '../Javascript_folder/app.js'; ?>
...and "app.js" calls "my_texture.jpg" with the line:
var texture = new THREE.TextureLoader().load("../Assets_folder/my_texture.jpg");
... but "my_texture.jpg" is not found.
If I put "my_texture.jpg" in the same folder of "index.php" and change the javascript path to:
var texture = new THREE.TextureLoader().load("./my_texture.jpg");
... the bitmap is found, but obviously I prefer to keep the assets in their own folder.
How could I find the bitmap respecting my current folder structure?
0K I resolved this issue opening the Ubuntu terminal (bash/Ubuntu) within the root folder of my site:
Root_folder$ php -S localhost:4000/PHP_folder/index.php
My local server cant find the sub-folder "Assets_folder" files when I execute the server within the sub-folder "Assets_folder/PHP_folder/" with this order:
Root_folder/PHP_folder$ php -S localhost:4000/index.php
In short, using bash terminal/php local server must be initied from the root folder of the site.
Also, I want to warning that some remote servers (like the one that Im paying) doesn't have the .htaccess file.
I have to create and write the .htaccess:
DirectoryIndex PHP_folder/index.php
I am a Spanish speaking self-taught programmer and I hope I did not use incorrect terms