Google Answers Logo
View Question
 
Q: PHP syntax problems on Mac OS X Server vs Mac OS X Client ( No Answer,   4 Comments )
Question  
Subject: PHP syntax problems on Mac OS X Server vs Mac OS X Client
Category: Computers > Programming
Asked by: benjamieson-ga
List Price: $100.00
Posted: 03 Feb 2005 15:26 PST
Expires: 05 Mar 2005 15:26 PST
Question ID: 468338
I have two computers:

1)  Apple Powerbook, running Mac OS X Panther Client
Default apache Install.
PHP 4.3.10 installed from Marc Liyanges (www.entropy.ch) package

2) Apple XServe running Mac OS X Panther server
Default apache Install.
PHP 4.3.10 installed from Marc Liyanges (www.entropy.ch) package

On the laptop, I can use PHP Markdown
(http://www.michelf.com/projects/php-markdown/) without problem.

I can also use the PHP 'heredoc' syntax without problem.

Both PHP markdown and using the standard php heredoc syntaxt fail on
the Xserve, even throgh it has PHP installed from the exact same
binary as the laptop.

Markdown fails with around 20 :

'Warning: Compilation Failed' errors


While even the most basic use of the PHP heredoc syntax:

<?php

echo <<<TEST
This is my test to see if heredoc style syntax works
This is another line
TEST;

?>
(there are no whitespace or syntax errors in this)

gives the error:

Parse Error: unexpeted $ in [path/to/file.php] on line 4

I need to know what is going on but have exhausted all options.

I am happy to make my httpd.conf and php.ini files available from both
machines if necessary to resolve this issue

Clarification of Question by benjamieson-ga on 03 Feb 2005 18:35 PST
[updated information]

Since posting the question, I have 

1) completely un-installed PHP and reinstalled. Same problem
2) Installed PHP 5.0.3, Same Problem
3) reverted to 4.3.10
4) manually compared php.ini files on my laptop (working) and the
XServe (not working) and made sure all settings are the same. Still
not working
5) Made sure my httpd.conf files matched. Still not working
6) tried Mac linefeeds, UNIX linefeeds, and, just for fun, Windows
linefeeds. Same problem

Am lost. Completely lost!
Answer  
There is no answer at this time.

Comments  
Subject: Re: PHP syntax problems on Mac OS X Server vs Mac OS X Client
From: vladimir-ga on 03 Feb 2005 17:27 PST
 
Check your end-of-line characters. I think the heredoc syntax requires
that they are a single linefeed (hex character 0x0A, in many contexts
referred to as a "\n"). A single linefeed as end-of-line is a
convention in Unix, MS Windows uses carriage return, linefeed (0x0D,
0x0A or "\r\n"). I'm not sure what the MacOS X convention is, but it
could be a single carriage return (0x0D), as that is what was used in
MacOS classic, if I remember correctly.

Anyway, check for that.

Vladimir
Subject: Re: PHP syntax problems on Mac OS X Server vs Mac OS X Client
From: benjamieson-ga on 03 Feb 2005 18:18 PST
 
This was one of my first checks. 

I have a simple test at:

http://www.benjamieson.com/stage/test1.php

also symlinked to the source at:

http://www.benjamieson.com/stage/test1.phps

All linefeeds are Unix, no extraneous whitespace.

The first link will show you the very very bizarre error I am
receiving - it makes no sense at all!
Subject: Re: PHP syntax problems on Mac OS X Server vs Mac OS X Client
From: ngawangt-ga on 17 Feb 2005 02:05 PST
 
Had the exact same problem myself. As Vladimir points out, the type of
end-of-line character is crucial and it is not easy to find out which
one has been used. Since Dreamweaver is the tool used for my webpages,
it was quite simple to change the linefeed to Unix style instead of
Macintosh style (done in the preferences dialog). This completely
solved the problem. If you do this, remember to apply the change to
your php script, as the change in the preferences only affects new
documents and changes made to existing documents.

Hope this helps,
Ngawang
Subject: Re: PHP syntax problems on Mac OS X Server vs Mac OS X Client
From: benjamieson-ga on 17 Feb 2005 05:15 PST
 
Nope,

I tried to make this clear in my original post.

It is *NOT* a linefeed/character encoding issue.

1) I use BBEdit exclusively for coding, and with this have tried Unix
linefeeds, Dos Linefeeds and Mac Lineffeds.

2) On standard installs of thirdparty packages, i.e. Markdown and
WordPress, the *EXACT* same install, from the same untouched files,
works on my laptop and fails on my Server.

I repeat, it is *NOT* a file problem.

Thanks

Ben

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy