<p>We have an issue using the <code>PEAR</code> libraries on <code>Windows</code> from <code>PHP</code>.</p>

<p>Pear contains many classes, we are making use of a fair few, one of which is the Mail class found in <code>Mail.php</code>. We use PEAR on the path, rather than providing the full explicit path to individual PEAR files:</p>

<pre><code>require_once('Mail.php');
</code></pre>

<p>Rather than:</p>

<pre><code>require_once('/path/to/pear/Mail.php');
</code></pre>

<p>This causes issues in the administration module of the site, where there is a <code>mail.php</code> file (used to send mails to users). If we are in an administrative screen that sends an email (such as the user administration screen that can generate and email new random passwords to users when they are approved from the moderation queue) and we attempt to include <code>Mail.php</code> we "accidentally" include mail.php.</p>

<p>Without changing to prepend the full path to the PEAR install explicitly requiring the PEAR modules (non-standard, typically you install PEAR to your path...) is there a way to enforce PHP on Windows to require files case-sensitively?</p>

<p>We are adding the PEAR path to the include path ourselves, so have control over the path order. We also recognize that we should avoid using filenames that clash with PEAR names regardless of case, and in the future will do so. This page however (which is not an include file, but a controller), has been in the repository for some years, and plugins specifically generate URLS to provide links/redirects to this page in their processing.</p>

<blockquote>
  <p>(We support Apache, Microsoft IIS, LightHTTPD and Zeus, using PHP 4.3 or later (including PHP5))</p>
</blockquote>

[{'answer_id': 63627, 'author': 'ceejayoz', 'author_id': 1902010, 'author_profile': 'https://Stackoverflow.com/users/1902010', 'pm_score': 2, 'selected': False, 'text': "<p>As it's an OS level thing, I don't believe there's an easy way of doing this.</p>\n\n<p>You could try changing your include from <code>include('Mail.php');</code> to <code>include('./Mail.php');</code>, but I'm not certain if that'll work on a Windows box (not having one with PHP to test on).</p>\n"}, {'answer_id': 63652, 'author': 'Jan Hančič', 'author_id': 185527, 'author_profile': 'https://Stackoverflow.com/users/185527', 'pm_score': 0, 'selected': False, 'text': '<p>If you are using PHP 4, you can take advantage of <a href="http://bugs.php.net/bug.php?id=43821" rel="nofollow noreferrer">this</a> bug. Off course that is a messy solution...</p>\n\n<p>Or you could just rename your mail.php file to something else...</p>\n'}, {'answer_id': 65937, 'author': 'farzad', 'author_id': 9394, 'author_profile': 'https://Stackoverflow.com/users/9394', 'pm_score': 2, 'selected': True, 'text': "<p>having 2 files with the same name in the include path is not a good idea, rename your files so the files that you wrote have different names from third party libraries. anyway for your current situation I think by changing the order of paths in your include path, you can fix this.\nPHP searches for the files in the include paths, one by one. when the required file is found in the include path, PHP will stop searching for the file. so in the administration section of your application, if you want to include the PEAR Mail file, instead of the mail.php that you wrote, change your include path so the PEAR path is before the current directory.\ndo something like this:</p>\n\n<pre><code>&lt;?php\n  $path_to_pear = '/usr/share/php/pear';\n  set_include_path( $path_to_pear . PATH_SEPARATOR . get_include_path() );\n?&gt;\n</code></pre>\n"}, {'answer_id': 82131, 'author': 'MSalters', 'author_id': 15416, 'author_profile': 'https://Stackoverflow.com/users/15416', 'pm_score': 0, 'selected': False, 'text': "<p>I'm fairly certain this problem is caused by the NTFS code in the Win32 subsystem. If you use an Ext2 Installable File System (IFS), you should get case sensitivity on that drive.</p>\n"}]
['https://Stackoverflow.com/questions/63599', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7106/']