Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > PHP problem

PHP problem
Thread Tools
1c3
Forum Regular
Join Date: May 2003
Location: J�mtland - Sweden
Status: Offline
Reply With Quote
Apr 20, 2004, 02:27 PM
 
Hi there!

I have a problem with displaying my PHP-pages.. The phpInfo() works fine but it won't parse anything like echo, include or.. well anything else.. I have tried to re-install the php package (the one found at entropy.com) but it wont start. I've restarted apache many times as well as try a reboot to see if the problem was that the php-modul wasn't correctly loaded or something. but that don't seem to be the problem. I think it happened after I installed Panther. But I am not sure since it was quite a time since I sat down to write some nice php-code.

I think that is kinda weird that it parses the phpInfo function but not simple things as echo...

Anyone who has any idea of what the problem could be?
Mighty3k @ #MacNN
     
skalie
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Apr 20, 2004, 03:06 PM
 
Are you getting error messages or unparsed code?
     
1c3  (op)
Forum Regular
Join Date: May 2003
Location: J�mtland - Sweden
Status: Offline
Reply With Quote
Apr 21, 2004, 04:38 PM
 
Nope. Nothing.
It seems like it is just skipping the php-tags.
Mighty3k @ #MacNN
     
redJag
Senior User
Join Date: Dec 2002
Status: Offline
Reply With Quote
Apr 21, 2004, 05:02 PM
 
it sounds like you haven't added the type to your apache conf file.

in httpd.conf add the line:

AddType application/x-httpd-php .php
Travis Sanderson
     
registered_user
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status: Offline
Reply With Quote
Apr 21, 2004, 05:03 PM
 
can you post a sample of your source that doesn't work? It may make it easier to troubleshoot.

And just because I have to ask: you are using <?php tags ?> right? Or at least <? these tags ?> to surround your code, aren't you?
     
1c3  (op)
Forum Regular
Join Date: May 2003
Location: J�mtland - Sweden
Status: Offline
Reply With Quote
Apr 23, 2004, 02:11 PM
 
Yes!!

This works: <?php phpInfo(); ?>
This does not work: <?php include('_inc/file.php'); ?>
Nor does this: <?php echo "hello world" ?>

Yesterday apache wouldn't even start, but now after reboot i does however..

I think I need to reinstall panther and do a format or something. I am going nuts.
Mighty3k @ #MacNN
     
skalie
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Apr 23, 2004, 03:03 PM
 
Originally posted by 1c3:

Nor does this: <?php echo "hello world" ?>
// missing a semi-colon

<?php
echo "hello world";
?>
     
bwahahax
Forum Regular
Join Date: Apr 2003
Location: Toronto, Canada
Status: Offline
Reply With Quote
Apr 23, 2004, 07:35 PM
 
I'm having a similar problem.
I also installed the latest Entropy PHP package.

This PHP snippet works: <?php phpInfo(); ?>

As does the random image rotator I download from A List Apart: http://www.alistapart.com/articles/randomizer/

However, I can't get phptunest (http://www.maczsoftware.com/phptunest/) or the blogkomm (http://www.blogkomm.com/index.php) PHP based commenting system to work.

I have followed their instructions to the letter, but all I get are blank pages. Does anyone have any idea what could be wrong?
     
Simon Mundy
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Apr 23, 2004, 07:52 PM
 
Originally posted by bwahahax:
I'm having a similar problem.
I also installed the latest Entropy PHP package.

This PHP snippet works: <?php phpInfo(); ?>

As does the random image rotator I download from A List Apart: http://www.alistapart.com/articles/randomizer/

However, I can't get phptunest (http://www.maczsoftware.com/phptunest/) or the blogkomm (http://www.blogkomm.com/index.php) PHP based commenting system to work.

I have followed their instructions to the letter, but all I get are blank pages. Does anyone have any idea what could be wrong?
Check to see that PHP is enclosed by <?php ?> and not <? ?> - sometimes default installations have short tags turned off.
Computer thez nohhh...
     
1c3  (op)
Forum Regular
Join Date: May 2003
Location: J�mtland - Sweden
Status: Offline
Reply With Quote
Apr 23, 2004, 08:59 PM
 
Originally posted by skalie:
// missing a semi-colon

<?php
echo "hello world";
?>
It should still work since ?> closes the last instance written. the semi-colon is not required if in this example echo is right before the closing-tag.


And I have checked, I am using <?php ?> and not <? ?>.

there must be something wrong with the module. Maybe I should ask the guy over at entropy's instead. Thanks anyways.
Mighty3k @ #MacNN
     
bwahahax
Forum Regular
Join Date: Apr 2003
Location: Toronto, Canada
Status: Offline
Reply With Quote
Apr 23, 2004, 10:00 PM
 
I tried what you suggested and added 'php' to all instances of '<?' I came across. However, it still does not work. Hopefully if 1c3 learns something over in the Entropy forums he will share it with us!
     
fc_
Fresh-Faced Recruit
Join Date: Apr 2004
Status: Offline
Reply With Quote
Apr 23, 2004, 11:27 PM
 
I believe the latest php package has display_errors = Off as default. Check your php.ini file (which should be located at usr/local/php/lib/php.ini) and see if its off. Toggle it to On, and you should be able to see what errors are occurring (which is the most likely suspect, given what you've described)

hth,
fc
     
bwahahax
Forum Regular
Join Date: Apr 2003
Location: Toronto, Canada
Status: Offline
Reply With Quote
Apr 24, 2004, 09:25 AM
 
Okay. I have done that. What should I look for?
     
bwahahax
Forum Regular
Join Date: Apr 2003
Location: Toronto, Canada
Status: Offline
Reply With Quote
Apr 24, 2004, 10:52 PM
 
Okay. Well, having fooled around a bit, I think I've discovered the problem. My permissions weren't set correctly. The PHP was working fine, but my server wouldn't let others see the PHP pages.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:38 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,