Welcome to WebmasterWorld Guest from 54.162.226.212

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP interpreter problem

apache server

     
4:39 pm on Mar 10, 2011 (gmt 0)



Hey I'm new to these forums.

I'm currently running an apache server. I installed PHP and the page index.php runs the html fine, but everything between the <?php ?> tags are ignored. they're not printed out on the webpage, and if you go to the file in vim they're highlighted (purple) correctly, but the php interpreter seems to be not working.

Also, when i uncomment the "addtype application/x-httpd-php .php" in the php.conf file the entire page goes completely blank.

thanks for all your help!
4:54 pm on Mar 10, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



If the page goes blank, it may be that your script has an error and error reporting is off (which is a good thing for security purposes.) Does this run?

<?php
echo "hello world";
?>

Be sure there's no newlines after the closing ?>
4:58 pm on Mar 10, 2011 (gmt 0)



hey rocknbil, thanks for the quick response!

unfortunately though, nope, absolutely nothing between php tags run with the addtype commented out, and with the addtype in the page is blank.
5:02 pm on Mar 10, 2011 (gmt 0)

10+ Year Member



I had a similar issue recently on a new install which turned out to be that Apache wasn't loading PHP at all.

Have you found the PHP manual pages on the different types of PHP and the entries and formats needed for the Apache config file?

Guessing it is a new install. Which operating system are you running?
5:02 pm on Mar 10, 2011 (gmt 0)



in case it helps, here's my php.conf file:

*********************************************************
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
# Use of the "ZTS" build with worker is experimental, and no shared
# modules are supported.
LoadModule php5_module modules/libphp5-zts.so
</IfModule>

#
# Cause the PHP interpreter to handle files with a .php extension.
#
#AddHandler php5-script .php
AddType text/html .php
#AddType application/x-httpd-php .php


#
# Add index.php to the list of files that will be served as directory
# indexes.
#
#DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
AddType application/x-httpd-php-source .phps
********************************************************

ive tried every combination of the 3 addtype/addhander statements. when the addtype application or the addhandler is uncommented, the page is blank. i can leave the addtype text/html on and it still runs fine.
5:03 pm on Mar 10, 2011 (gmt 0)



Oh, hi vordmeister, I'm running centos 5.0.
5:10 pm on Mar 10, 2011 (gmt 0)

10+ Year Member



Don't know about Centos - for me the solution was in the file paths that needed to be included in the Apache hpptd.conf file. If you've read that part of the PHP manual you'll be ahead of me.
5:27 pm on Mar 10, 2011 (gmt 0)



The problem is the interpreter, but I thought the "addtype" was the interpreter...and yet the addtype makes it go blank...
5:46 pm on Mar 10, 2011 (gmt 0)



Ah! I solved it! there was a type in the addtype >.<

thanks for you responses!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month