Search code examples
phpvagrantcase-sensitive

Because my case sensitive does not work on Linux (Ubuntu 14.04) on vagrant


I have a virtual machine mounted from the vagrant with Official Ubuntu Server 14.04 LTS (Trusty Tahr) builds, I set up an environment with PHP 5.6, Mysql and apache 2 in this virtual machine, however I did some tests with PHP, and I noticed that the case sensitive does not work, I already had some Problems in file calls in the production environment because of case sensitive, it would help me a lot to be able to identify this in the development, does anyone know what could be happening?

index.php

include_once "Filecamelcase.php";

$teste = new teste();

echo $teste->teste();

FileCamelCase.php

class Teste {

    function Teste(){
        return "teste";
    }

}

Solution

  • As commented. A Linux filepath is case sensitive.

    On the other hand, PHP code interpretation is independent of operating system. PHP has his own rules for that behavior even if these rules are a bit annoying or mysterious. Basically:

    Case insensitive

    functions, class constructors, class methods, keywords and constructs (if, else, null, foreach, echo etc.)

    As you can see in the link below: https://stackoverflow.com/a/33273959/1628790