Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

159
Vistas
Why my .php cant find a bitmap using a .js path?

I have the next web site folder structure (in short):

  • Root_folder
    • PHP_folder
      • index.php
    • Javascript_folder
      • app.js
    • Assets_folder
      • my_texture.jpg

..."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?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda