Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!