php not working in LAMP (CentOS 5)

Hi,

I followed the procedure stated over here (http://library.linode.com/lamp-guides/centos-5/).

Now two things have happened.

1) php.ini file is not in etc/php5/apache2/ as mentioned in the link above, instead it is in etc/

2) i created a test file, named index.php in srv/www/mysite.com/public_html , but when i try http://74.207.246.56/index.php it pops up telling me to download the file. Before that, it was just displaying php file as text on screen after I wrote,

AddType application/x-httpd-php .php .foo

AddType application/x-httpd-php-source .phps .phtmls

DirectoryIndex index.php index.htm index.html

it is now displaying a pop-up to download index.php

Any help please.

Thanks in advance

Milan

–-----------------

Update:

I restored the original httpd.conf file for apache and removed virtualhosts too.

Hence, now i placed file test.php in var/www/html/

and this is what i get http://74.207.246.56/test.php

php is displayed as text.

6 Replies

The instructions are wrong. There is no package named php5. You need to do: yum install php

yes. i restarted apache quite a few times. but no luck.

I found out that command line php works. So i guess php just got installed in wrong path or i need to set path or change few settings in httpd.conf

Maybe i will try yum install php

@mikeindia:

yes. i restarted apache quite a few times. but no luck.

I found out that command line php works. So i guess php just got installed in wrong path or i need to set path or change few settings in httpd.conf

Maybe i will try yum install php

I tried yum remove php and then yum install php

still the same problem.

Please verify that there is a line like this in httpd.conf:

LoadModule php5_module /etc/httpd/modules/libphp5.so

@BarkerJr:

Please verify that there is a line like this in httpd.conf:

LoadModule php5_module /etc/httpd/modules/libphp5.so

Hi,

there is no such line in httpd.conf It seems php5 didnt get install correctly. But a day or two, the code now works. Seems like this one had problem with rebooting system.

So now php is working fine.

Thanks to all for help.

Milan

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct