Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm not positive if this is a programming question or a server question, but I'm leaning towards server. I've been in the process of moving a webpage (basic php backed by a MySQL database) from an Ubuntu server to an OSX server. I've enabled the php module in the apache configuration (httpd.conf) and created an php.ini file in /etc and php seems to be working - just not with the old webpage.

Basically I set up the web page on the local subnet for testing purposes (it's hosted at 10.x.x.x) and pointed the web server to a directory where I copied all the files from the other server. When I direct Safari to the address 10.x.x.x it correctly finds and displays index.php, BUT it doesn't execute the script it just dumps the contents to the browser.

At that point I thought I had incorrectly setup php, so I created the clasic info.php just containing

<?
   phpinfo();
?>

and to my surprise it ran correctly (from 10.x.x.x/info.php).

Which made me think there must be a problem with the code itself. Since the code currently works on the Ubuntu server and there haven't any changes I check the versions of php. The old server is using 5.2 and the OSX server is running 5.3. It's possible that's the problem, but it doesn't make much sense because I don't think that much has changed, and the php for this website is VERY basic. Further evidence that it's a code issue is that I get the same behavior from the command line when I directly execute index.php and info.php via php index.php and info.php.

However, I'm still leaning towards the idea that the problem is on the OSX server and not in the programming, because if it were a problem with the php (due to versions or some syntax error) wouldn't I get an error message when trying to execute the script instead of the file just being treated as text?

What do you think is going on? Have I just lost my mind :). Any help on getting these php files executing is greatly appreciated. Thanks!!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

IIRC short open tags are disabled by default on OS X. While your info.php test seems to indicate they're enabled on your setup, I'd still suggest editing at least one of your files to use long tags (i.e. <? ?> -> <?php ?>) and see if that makes any difference.

share|improve this answer
    
THANK YOU!!! I just did a sed replace and everything is working normally. Silly me. –  Evan Feb 19 '11 at 17:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.