Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda