PHP wont work

I have searched the forum for a solution to my PHP problem…

I have installed a fresh opensuse 11.1 system with apache mysql and php5 selected during the installation. However although apache is working and verified by putting http://localhost in my web browser and receibving IT WORKS! msg… I cannot seem to process php scripts.

I have tried placing a phptest.htm file containing the following code in the htdocs folder

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo “This is a PHP line”;
phpinfo();
?>
</body></html>

and although I get the html line I cannot get the php line.

Does anyone know how I need to adjust or setup php after a fresh install???

Thanks!:stuck_out_tongue:

PHP scripts must end in .php even if they are mostly HTML. There is a way to make Apache process .htm or other extensions as PHP, but for now this is the simplest approach.

Thanks for your reply… sorry I should have said that when I do change the extension to .php I get an internal error page with Konquerer and a blank page with firefox with it saying beagle is indexing…

Did you tried to restart apache in terminal?

/etc/init.d/apache2 restart

OR, the maybe mod php for apache is not installed.

Hi

Thanks… yes have restarts ./apache2 restart

Then ./apache2 status just to be sure and it is running…

No difference…

have also checked apache2-mod_php5 is installed and reinstalled it just to be sure. restarted apache… no difference.

Is there any configuration that needs to be done? I would have thought it would be configured upon installing using yast?

Check that php5 is loaded:

/usr/sbin/httpd2 -M

Output should have php5_module in it.

Also look in /var/log/apache2/error_log for clues as to what went wrong.

Thanks seems php5 wasnt loaded… have googled and managed to resolve it. Thanks for all your help.

There is some good information at

PHP: Installation on Unix systems - Manual

You can get a lot of information about the php installation by using a text editor to enter:

<?php phpinfo(); ?>

and saving it as phpinfo.php in the root directory of your web server. Then use your browser to access it at the URL

http://localhost/phpinfo.php

I was surprised at the bewildeing array of information that comes up. I am a newcomer so I don’t understand most of it but maybe I will in time.

I am trying to set up website content management software (Joomla!) on localhost and this was in the book I am following. I am not an expert and don’t understand much of what I am doing so I can’t answer any followup questions you might have.