LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   PHP5 and Apache2 parsing code but no output (https://www.linuxquestions.org/questions/linux-server-73/php5-and-apache2-parsing-code-but-no-output-805555/)

The_Nerd 05-02-2010 06:51 PM

PHP5 and Apache2 parsing code but no output
 
I have apache 2.2.3 installed with php5 and libapache2-mod-php5. The server displays web-pages fine, but when I try to load a .php file, nothing shows up. There aren't any errors, not in the browser and not in the Apache2 error logs... just nothing shows up. When I look at the page source on the browser, all the HTML code is there, but all the PHP code is gone, as though it was parsed. I can't get any output to show up though, echo and print both do nothing.

What could be the problem?

Example:
Code:

<html>
<body>
<?php
    echo 'Test!';
?>
</body>
</html>

Will output to the browser:
Code:

<html>
<body>
</body>
</html>

See, the PHP code is gone, but nothing is displayed on the browser.

smoker 05-02-2010 07:04 PM

Is the php module loaded in httpd.conf ?
does the standard test with phpinfo(); work ?

The_Nerd 05-02-2010 07:59 PM

Yes the module is loaded and phpinfo(); doesn't display anything just like "echo" and "print"... it just gets discarded from the document source... bye bye.

michaelk 05-02-2010 08:14 PM

Check the httpd logs for errors.
Make sure the permissions for your php pages are 644.

The_Nerd 05-02-2010 08:30 PM

Thanks for your help smoker and michaelk. I figured it out. Everything was configured properly... you wouldn't believe it, but my FTP Client was transfering in ASCII Mode and mangled the file... It is working great now in binary mode.

Thanks for your replies!

Wyatt

smoker 05-03-2010 05:15 AM

but html and php are ascii ?!?

thePiet 05-03-2010 04:37 PM

Damn FTP :)

Just SCP / rSync the stuff to your server next time :)

The_Nerd 05-03-2010 08:32 PM

Hah... I know. I am not sure if it was notepad or wordpad or the FTP. I Hate windows and hate both (notepad and wordpad)... ick... but I am stuck with MS for now as I am on my dads computer. *sigh*

Thanks for your help anyways guys. :D


All times are GMT -5. The time now is 04:40 AM.