LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 07-30-2006, 01:21 PM   #1
RAFAL
Member
 
Registered: Feb 2006
Location: Warsaw, Poland
Distribution: Archlinux, Debian
Posts: 139

Rep: Reputation: 16
Unhappy PHP does not work on SUSE 10.1


Hello,
I have installed Suse 10.1 and have problem with PHP.
First problem was that every time I have tried to open php file located in /stv/www/htdocs, browser asked to download the file.
This means that Suse installed Apache with PHP in the wrong way.
I have added to /etc/apache2/loadmodule.conf following entry:

LoadModule php5_module /usr/lib/apache2/mod_php5.so

Additionally I have added this entry:

AddType application/x-httpd-php .php

to /etc/apache2/mod_mime-defaults.conf

I restarted Apache Server.
Now, when try to open this php file in my browser:

<php?
print("PHP works fine");
?>

in the status bar I see information DONE, but screen is empty.
What Can be wrong?
Why Suse has not installed everything correctly? With Fedora I hadn't this problem. Everything installed worked fine.

Could anybody give me some ideas what can be wrong or what to do?

regards
Rafal
 
Old 07-31-2006, 06:44 AM   #2
Spudley
Member
 
Registered: Mar 2003
Location: Berkshire, England.
Distribution: SuSE 10.0
Posts: 299

Rep: Reputation: 32
The question that came to my mind straight away was "have you double-checked that PHP is actually installed?"

In particular what caught my eye was the config stuff you did -- if PHP was installed using Suse's installer, it should have configured the module etc itself, so you shouldn't have needed to do that. That implies to me that PHP isn't installed.

I haven't tried 10.1 yet, but in other recent versions of Suse, PHP wasn't always included as part of the default installation, so check what's installed using Yast. Then it should be a simple matter of ticking the appropriate packages, and you should be all set.


If it isn't that, then I'm afraid I don't know. But I hope that helps.

All the best.
 
Old 07-31-2006, 08:33 AM   #3
Lytse Flap
LQ Newbie
 
Registered: Mar 2006
Location: Odense V (DK)
Distribution: SuSE
Posts: 9

Rep: Reputation: 0
Why are you changing the Apache configuration outside of YaST?
Keep it easy and secure and change in YaST with Network Services -> http-server -> modules and just enable PHP4 or PHP5.
 
Old 07-31-2006, 09:31 AM   #4
explorer
Member
 
Registered: Feb 2003
Posts: 229

Rep: Reputation: 34
Php

Rafal,

First off, see if php is installed - create a file containing this:
<?php
phpinfo();
?>

and save it as phpinfo.php in stv/www/htdocs, then try to open it with firefox. If PHP is installed properly, it will display a complete graphical report on your PHP installation. If it doesn't display the report, PHP is not installed correctly. To install, or check installation, Open Yast, then select / software / software management. In the search window on the left, type in PHP5 and click the search button. There will be a pretty long list returned on the right, but the top two options are the ones you are concerned with; they should be at the top of the list:
apache2-mod_php5 and
PHP5

They should both be checked already indicating that they are already installed. If either of them are not checked, check the uncheck one, or both if both are unchecked, and click the accept button at the bottom right to install the packages. Then try the phpinfo.php file in your browser again. This should get php going for you.

Mike
 
Old 07-31-2006, 02:49 PM   #5
RAFAL
Member
 
Registered: Feb 2006
Location: Warsaw, Poland
Distribution: Archlinux, Debian
Posts: 139

Original Poster
Rep: Reputation: 16
Hello !


Thank you for advice!

I know where was a problem.

This is correct code which works fine now:
<?php
print("PHP works fine");
?>

...and before I tried with this code:
<php?
print("PHP works fine");
?>


After I have installed SuSe 10.1 I have faced following problems with Apache:

1) I couldn't start apache with command apache2ctl start because of the error (file include.conf not found)
SOLUTION:
I have commented this line in config file
#Include /etc/apache2/sysconfig.d/include.conf

2) Second problem was with php (described before --- I couldn't open *.php file in browser, every time I was asked to download it)
SOLUTION:
SUSE installed Apache with PHP but config files were wrong.
In loadmodule.conf I have added this line:
LoadModule php5_module /usr/lib/apache2/mod_php5.so

.. and in mod_mime-defaults.conf this line:
AddType application/x-httpd-php .php

This line informs Apache about new type with extension *.php (this was a reason why browser asked me to download file, *.php file was unknown for Apache)

I have also made mistake in code and instead of '<?php' I had '<php?' , but after I have corrected it, I was able to execute this simple PHP code.

I hope my explanation can be helpful for everybody who faced similar problem.

regards
Rafal
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache 2, PHP 5, SuSE 9.2 - cannot run php files dickohead Linux - Networking 6 06-28-2006 10:25 AM
Suse 9.3/apache2/php4 - Firefox tries to download index.php, other *php pages work stefanlasiewski SUSE / openSUSE 1 01-18-2006 06:12 PM
PHP / VideoLAN / Fedora Core Question - how can I get the PHP "exec" function to work gtrawoger Linux - Software 3 12-21-2005 06:51 AM
php5 apache2 mysql4 don't work, php does not seem to read php.ini atom Linux - Software 5 03-24-2005 11:05 AM
reinstalled apache, php, still no php support SuSE 8.2 hindenbergbaby Linux - Software 1 10-14-2003 01:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 03:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration