problems with pear using HTML_Template_IT

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

problems with pear using HTML_Template_IT

Postby billgriffiths » 10. May 2007 05:42

The following php code fails:

require_once "/HTML/TEMPLATE/IT.php";

The error messages are:

Warning: main(/HTML/TEMPLATE/IT.php) [function.main]: failed to open stream: No such file or directory in /Applications/xampp/xamppfiles/htdocs/fsa/checkrecenttests.php on line 3

Fatal error: main() [function.require]: Failed opening required '/HTML/TEMPLATE/IT.php' (include_path='.:/Applications/xampp/xamppfiles/lib/php') in /Applications/xampp/xamppfiles/htdocs/fsa/checkrecenttests.php on line 3

The default line in php.ini is

;***** Added by go-pear
include_path=".:/Applications/xampp/xamppfiles/lib/php"
;*****

The file IT.php exists at the path:

/Applications/xampp/xamppfiles/lib/php/pear/HTML/TEMPLATE/IT.php

The permissions are read only.

This code works in other installations. I've tried editing the include path to
include_path=".:/Applications/xampp/xamppfiles/lib/php/pear"
without any effect (except on the error message).

Suggestions?
billgriffiths
 
Posts: 9
Joined: 10. May 2007 05:27

Postby Wiedmann » 10. May 2007 11:06

require_once "/HTML/TEMPLATE/IT.php";

This is wrong. It must be:
Code: Select all
require_once 'HTML/Template/IT.php';
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby billgriffiths » 10. May 2007 18:20

That works. Vielen dank! I should have looked at the path more carefully. I'm surprised this code works on other Mac systems since UNIX is case sensitive.

I went and looked at the code on another Mac and it was working correctly in spite of the all caps.

Sorry to trouble you with this trivial matter but sometimes I overlook the obvious detail when expecting a more complicated problem.

Bill
billgriffiths
 
Posts: 9
Joined: 10. May 2007 05:27

Postby Wiedmann » 10. May 2007 19:20

I'm surprised this code works on other Mac systems since UNIX is case sensitive.

"case sensitive" depends on your current filesystem and not on your OS.

I went and looked at the code on another Mac

Next time better look into the documentation for the class ;-)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby billgriffiths » 10. May 2007 23:52

You are right, natürlich, but it is still interesting that the code with all caps works on MAMP but not xampp. Both are running on my MacBook Pro so it seems to me that either pear is installed differently on the two systems or xampp is more strict about enforcing case sensitive file names.

Bill
billgriffiths
 
Posts: 9
Joined: 10. May 2007 05:27

Postby Wiedmann » 11. May 2007 02:54

And this MAMP (or better the PEAR which MAMP uses) ist installed on the same filesystem as "XAMPP for Mac OS X"?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby billgriffiths » 11. May 2007 03:57

The same file system. Also, the original code is installed on Mac OS X Server (Tiger) which also uses the same file system but uses the built-in Apache server, MySql etc. that comes with Mac OS X Server. All of them use the native Mac OS X file system.

For the MAMP server I copied the Template folder from the HTML folder in xampp to the HTML folder in MAMP in order to get the template files to work with PHP. So the require_once "HTML/TEMPLATE/IT.php"; doesn't match the case of the folder name Template but still works.

The path for IT.php in MAMP is /Applications/MAMP/bin/php4/lib/HTML/Template/IT.php
billgriffiths
 
Posts: 9
Joined: 10. May 2007 05:27

Postby Wiedmann » 11. May 2007 06:03

All of them use the native Mac OS X file system.

On Mac OS X you have two native file systems:
HFS+ = case-insensitive
HFSX = case-sensitive (but can also be case-insensitive)

Some facts:
- The (only) correct filename for this class is (and must be) "HTML/Template/IT.php".

- With exact this name you can access this file regardless of the filesystem.

- If you can access this file with "HTML/TEMPLATE/IT.php", and the filename on disc is "HTML/Template/IT.php", you have a case-insensitive filesystem.

- If you can access this file only with "HTML/Template/IT.php", you have a case-sensitive filesystem.

- You can have both filesystems (and cases) on the same box (harddisk).
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby billgriffiths » 11. May 2007 06:24

I see that Mac OS X supports many file systems.

The default file system is HFS+ (case insensitive). I've never set up any other so I assume xampp and pear are installed under that system. In which case it would seem xampp would recognize TEMPLATE as well as Template. But that is not the case so I assume xampp is using case sensitive code to check the file location. Whereas mamp must be using the file system to locate the file.
billgriffiths
 
Posts: 9
Joined: 10. May 2007 05:27

Postby Wiedmann » 11. May 2007 06:43

xampp would recognize TEMPLATE as well as Template.

Then XAMPP is installed on a case-insensitive filesystem.

so I assume xampp is using case sensitive code to check the file location.

There is no such code. PHP uses normal c file functions to open the includes. And the behavior of this functions depends on the current local filesystem.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby billgriffiths » 11. May 2007 06:45

As I have not installed any other file system than the default how can xampp be installed on a case sensitive file system?
billgriffiths
 
Posts: 9
Joined: 10. May 2007 05:27

Postby billgriffiths » 11. May 2007 07:52

I compared the php.ini files for mamp and xampp. The mamp file contains the following lines which the xampp file does not. Could that be the difference in how mamp and xampp read from the file system?

[Sockets]
; Use the system read() function instead of the php_read() wrapper.
sockets.use_system_read = On
billgriffiths
 
Posts: 9
Joined: 10. May 2007 05:27

Postby Wiedmann » 11. May 2007 08:26

I don't think so. The socket extension has nothing to do with includes (or filesystem access).

(BTW: Can't find this ini setting in the current php source code...)
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby billgriffiths » 11. May 2007 09:08

Well, I seem to have screwed this up. Now session_start(); doesn't work and the earlier errors have reoccurred even though the Template code is correct.

require_once "HTML/Template/IT.php";

I'll try reinstalling tomorrow. Thanks for all your help. At least the code executes correctly under mamp now. I'll let you know how it turns out. You don't have to spend any more time on this. Wiedershauen
billgriffiths
 
Posts: 9
Joined: 10. May 2007 05:27

Postby billgriffiths » 12. May 2007 08:39

I have finally gotten everything working correctly. It turns out that the original problem with accessing the pear Template files is fixed by adding "/pear" to the php.ini file include_path

;***** Added by go-pear
include_path=".:/Applications/xampp/xamppfiles/lib/php"
;*****

so it becomes

;***** Added by go-pear
include_path=".:/Applications/xampp/xamppfiles/lib/php/pear"
;*****

When this is done the access is not case sensitive so TEMPLATE works as well as Template.

I had tried that before but with an undisciplined approach so that not everything had been set back to start.

It was the obvious approach since the file IT.php was located at
/Applications/xampp/xamppfiles/lib/php/pear/HTML/Template/IT.php
But my carelessness defeated the obvious.

Turning buffering on took care of the header and session problems.

So, in the end, a simple fix.

Thanks for your patience.
billgriffiths
 
Posts: 9
Joined: 10. May 2007 05:27


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 4 guests