Xampp not reading a folder

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Xampp not reading a folder

Postby shajiuddin » 03. November 2016 12:02

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
shajiuddin
 
Posts: 1
Joined: 03. November 2016 11:49
XAMPP version: 1.8.2-6
Operating System: Ubuntu 14.04LTS

Re: Xampp not reading a folder

Postby Nobbie » 03. November 2016 18:44

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.
Nobbie
 
Posts: 9509
Joined: 09. March 2008 13:04

Re: Xampp not reading a folder

Postby tm01 » 04. November 2016 12:09

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.
tm01
 
Posts: 35
Joined: 03. November 2016 16:20
XAMPP version: 3.2.2
Operating System: Win7

Re: Xampp not reading a folder

Postby Nobbie » 04. November 2016 12:40

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
Nobbie
 
Posts: 9509
Joined: 09. March 2008 13:04


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 1 guest