1

I have a project that includes a bootstrap file. It should be included once. This works for most developers, but now on one machine, the file gets included twice, because the paths are slightly different.

Notice the capital letters:

/Users/johndoe/desktop/projects/project_name/bootstrap.php

vs

/Users/johndoe/Desktop/Projects/project_name/bootstrap.php

Without going through the whole project the simplest I can describe it is this:

The root file is build.php:

// build.php
...
dump(__DIR__);
include "includes/content.html";
...

// top of includes/content.php
dump(__DIR__);
...

//Outputs
/Users/johndoe/Desktop/Projects
/Users/johndoe/desktop/projects/includes

I've done quite some years in php, I've never come across this before!

Environment:

  • mac + brew
  • php 8.1
Jeroen de Lau
  • 640
  • 4
  • 13
  • 1
    https://stackoverflow.com/questions/7699412/case-inconsistency-of-php-file-paths-on-mac-mamp, https://stackoverflow.com/questions/17167066/mac-os-x-php-cannot-redeclare-class-testing – Sergey Ligus Apr 20 '23 at 19:11
  • 1
    Thanks, I had not seen these! Originally it seemed like different issues, but this answer actually solved it! https://stackoverflow.com/a/25372742/1268526 – Jeroen de Lau Apr 21 '23 at 12:13

0 Answers0