Page 1 of 1

Xampp not reading a folder

PostPosted: 03. November 2016 12:02
by shajiuddin
Hi All,

I have Xampp 1.8.2-6 installed on Ubuntu 14.04LTS

In my php code one file is calling like require_once("./vendor/phpmailer/phpmailer/class.phpmailer.php") but if I got to folder the actual structure is like this... "./vendor/PHPMailer/phpmailer/class.phpmailer.php" you can see after /vendor/ the /phpmailer/ is exist as "/PHPMailer/" that's why xampp is not able to read this file and showing error that this file is not exist. I can change name of folder or change the code and issue will be resolve but I cannot change any thing because it is not upgrade safe of the application.

Is there any apache or else configuration setting need to be set for disabling this restriction?

Any help will be highly appreciable

Regards

Re: Xampp not reading a folder

PostPosted: 03. November 2016 18:44
by Nobbie
shajiuddin wrote:Is there any apache or else configuration setting need to be set for disabling this restriction?


Which restriction?

It is your appllcation and it is your require(.....) - there is no Xampp restriction. It is a restriction of your project.

Re: Xampp not reading a folder

PostPosted: 04. November 2016 12:09
by tm01
Since you are operating on a linux system, case sensitive matters for files and directorys, too.
On a windows maschine its not possible to create two folder with the same name but different uppercases - on linux it is (even if its not a good idea).

A workaround would be to check which directory exists, like:
Code: Select all
$phpmailer = (file_exists("./vendor/phpmailer/phpmailer/class.phpmailer.php")) ? "./vendor/phpmailer/phpmailer/class.phpmailer.php" : "./vendor/PHPMailer/phpmailer/class.phpmailer.php";
require_once($phpmailer);

or more detailed:
Code: Select all
if (file_exists("./vendor/phpmailer/phpmailer/class.phpmailer.php")) {
require_once("./vendor/phpmailer/phpmailer/class.phpmailer.php");
} elseif (file_exists("./vendor/PHPMailer/phpmailer/class.phpmailer.php")) {
require_once("./vendor/PHPMailer/phpmailer/class.phpmailer.php");
} else {
echo "error";
}

Just quick&dirty to show you what i mean.

Other idea is to create a link (man ln) from /phpmailer/ to /PHPMailer which would be accessible for php too.

edit: There is nothing wrong with xampp at this issue. Its the system environment and your code - you need to stay case sensitive.

Re: Xampp not reading a folder

PostPosted: 04. November 2016 12:40
by Nobbie
Two options are coming to mind:

a) either create links from PHPMailer to phpmailer on your filesystem

b) or use a case insensitive filesystem for your environment, for example put all your files on a partition formatted as VFAT