Jump to content

php 5.3.2 gives *.php files as plain text


Recommended Posts

I've installed php (+php-fpm) 5.3.2 from ports at: centos.alt.ru.

I use nginx, and when enterd my site url got <?php ...... ?> in browser.

 

Then I logged on to ssh and tryed:

# php i.php
<?
echo phpinfo();
?>

 

Ok, I tried this:

# php -r 'phpinfo();'|grep USER
USER => root
_SERVER["USER"] => root

 

As I see php works, it just does not compile FILES!

 

The same system (php-fpm+nginx) works wonderfull on other server.

Does anybody know, what is the problem?

Thanks!

 

Just to mention:

short_open_tag=On

Server is x86_64

 

PS: sorry for my english :)

 

 

Link to comment
https://forums.phpfreaks.com/topic/196799-php-532-gives-php-files-as-plain-text/
Share on other sites

It's not PHP's problem. It is Apache's or IIS problem (whichever server you have).

 

You will need to add something like this to your apache httpd.conf file:

 

LoadModule php5_module /path/to/modules/libphp5.so
AddType application/x-httpd-php .php

 

(The loadModule may already be in there, if it is you just need the addtype. So yea.

I think it's not.

I'm using Nginx as http server.

When I look at the header of php-page in browser I see:

 

HTTP/1.1 200 OK
Server: nginx
Date: Sun, 28 Mar 2010 20:38:16 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.3.2

15
<?
echo phpinfo();
?>
0

As you see php is present.

 

And as I mentioned before:

php does not work from shell when parsing files.

 

I mean:

# /usr/local/bin/php i.php

 

gives:

<?
echo phpinfo();
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.