LinuxQuestions.org
Visit Jeremy's Blog.
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 10-10-2005, 05:53 AM   #1
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Rep: Reputation: 30
PhP not working correctly in Suse 9.3


I have Suse 9.3, Apache2 and php4 installed. I also have a php form generator. Now I want to create and test these php forms on suse 9.3 before I upload them to a website I am working on. But I seem to be doing something wrong becuase I can't view any php files in Suse 9.3. I tried opening them with firefox and konqueror and all I get is a window that pops up asking me what do do with the file.

Also I am using windowmaker, NOT kde or gnome.


If there is a link that has this question already answered that would be great. Please point me to it. I also am a bit pressed for time and I need to get this working ASAP, if not I will be installing another distro that I am sure it will work in. But again I really don't have time for that either. Any help is greatly appreciated.


Webwolf
 
Old 10-10-2005, 06:02 AM   #2
onjoo
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Suse 10, Suse-factory , RHEL4, SLES9, SLED10
Posts: 380

Rep: Reputation: 30
what does commands:
Code:
rpm -qa | grep php
and
Code:
rpm -qa | grep apache
list?
 
Old 10-10-2005, 06:21 AM   #3
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
Wow. THe PhP list is very long and I can't cut and paste it, lol. I have things like modphp4core files, php4database, php4devel, php4-servelet, php4db, php4session and a lot more. Is there anything I should look for in particular or would you like me to type the whole list?

Apache is much, much shorter.

apache2-prefork-2.0.53-9
apache2-2.0.53-9
apache2-mod-php4-4.3.10-14


Webwolf
 
Old 10-10-2005, 09:18 AM   #4
onjoo
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Suse 10, Suse-factory , RHEL4, SLES9, SLED10
Posts: 380

Rep: Reputation: 30
My php packages (suse9.1) :
php4-4.3.4-43.44
php4-bz2-4.3.4-26
php4-zlib-4.3.4-26
apache2-mod_php4-4.3.4-43.44
php4-mysql-4.3.4-43.44
php4-session-4.3.4-43.44
php4-gd-4.3.4-26
phpMyAdmin-2.5.6-34.8
php4-recode-4.3.4-43.44

Those apache packages are the same.
So I have a really stupid question : Can you see basic html-documents?

I hope someone else can help you, my knowledge basically stops here..

You could check what /etc/php.ini says
especially :
Enable the PHP scripting language engine under Apache.
engine = On

And you could check settings in /etc/apache2/httpd.conf
and check if /etc/apache2/conf.d/php4.conf exists
 
Old 10-10-2005, 10:54 AM   #5
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
I was going to kick myself if it was only file association problem, lol. But yes I can view html documents.

The last two packages on your list I do not have. Which is strange considing I have so much installed.

phpMyAdmin
php4-recode

I am not sure f this is the problem or not but let me see. And Then I will check the others as well.



Webwolf
 
Old 10-10-2005, 11:08 AM   #6
onjoo
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Suse 10, Suse-factory , RHEL4, SLES9, SLED10
Posts: 380

Rep: Reputation: 30
Well Im quite sure those two packages won´t help:

phpMyAdmin is for MySQL-database administration over the web ...
phprecode - im not even sure what it does, but I guess its some sort of character encoding thingy???
 
Old 10-10-2005, 11:20 AM   #7
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
Well. What I think I might have to do is re-install Suse. I tried do a minimal install this time and add only what I wanted/needed. But Suse doesn't seem to like that to much. This has not been the only problem I have had. Small problems but they are time consuming. Thanks.


Webwolf
 
Old 10-10-2005, 11:31 AM   #8
ralvez
Member
 
Registered: Oct 2003
Location: Canada
Distribution: ArchLinux && Slackware 10.1
Posts: 298

Rep: Reputation: 30
Well ... before you re-install I would do something else. It seems to me that you do not have things configured to "work with each other".
Try this:
1. Create an html file (say you call it phptest.html).
2 Inside this file enter a simple paragraph like <p>just a test</p>
3. Following that enter a php statement like <?php echo"<p>printing from PHP</p>" ?>

If this works it means that apache was configured to parse PHP from within html files. If it does not try this:

1. Create a php file (say you call it phptest.php)
2. Inside this file enter <?php echo"<p>printing from PHP</p>" ?>
3. Try opening this file with your browser.

If this works you have apache to parse only .php files

If it does not work you need to configure apache server to parse these type of files.

Hope this helps.

Rick
 
Old 10-10-2005, 01:37 PM   #9
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by ralvez
Well ... before you re-install I would do something else. It seems to me that you do not have things configured to "work with each other".
Try this:
1. Create an html file (say you call it phptest.html).
2 Inside this file enter a simple paragraph like <p>just a test</p>
3. Following that enter a php statement like <?php echo"<p>printing from PHP</p>" ?>

If this works it means that apache was configured to parse PHP from within html files. If it does not try this:

1. Create a php file (say you call it phptest.php)
2. Inside this file enter <?php echo"<p>printing from PHP</p>" ?>
3. Try opening this file with your browser.

If this works you have apache to parse only .php files

If it does not work you need to configure apache server to parse these type of files.

Hope this helps.

Rick

LOL, I wish I read this before I did the re-install. Oh well. I tried it and it didn't work. Now I know where to start. Thanks.

Webwolf
 
Old 10-10-2005, 02:58 PM   #10
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
I have searched and I am not sure where to start. Is it the httpd.conf file I need to edit? If so what do I need to add to it?

Thanks for answering this.

Webwolf
 
Old 10-10-2005, 08:25 PM   #11
mdiotto
LQ Newbie
 
Registered: Oct 2005
Posts: 23

Rep: Reputation: 15
Just to confirm: have you put your php files in /srv/www/data and acessed them through http://localhost/phpfile.php ?

Another thing you should try is verify httpd.conf if the php4 module is being loaded.
 
Old 10-10-2005, 08:55 PM   #12
ralvez
Member
 
Registered: Oct 2003
Location: Canada
Distribution: ArchLinux && Slackware 10.1
Posts: 298

Rep: Reputation: 30
Yes, you start by editing httpd.conf.
In Slackware it is located in /etc/apache/httpd.conf but it may be in a different location in your distro.

You have to add the following:
Code:
    DirectoryIndex index.html index.php
    # The following lines allow the server to parse php files
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
# ==> mod_php configuration settings <==
Include /etc/apache/mod_php.conf
The last statement is only if it is not there. In my experience it is already there, but just in case.

Hope this helps.

Rick

p.s.

If you enable the use of the home directories ( look for :
# UserDir: The name of the directory which is appended onto a user's home
<Directory /home/*/public_html> ) you can then test your development files by creating a "public_html" directory inside your home directoy. Then you put your files there and access them by entering http://localhost/~yourhomedirectory/index.html.

Last edited by ralvez; 10-10-2005 at 08:57 PM.
 
Old 10-11-2005, 06:32 AM   #13
webwolf70
Member
 
Registered: Feb 2004
Distribution: Windows XP. I gave up with Linux & I left LQ.
Posts: 502

Original Poster
Rep: Reputation: 30
Ralvez. I did what you said. And it is still not working. I know I am missing something really stupid and small.

Can anyone send a link or something with an example of an httpd.conf file that has php and apache working together?


Thanks.

Webwolf
 
Old 10-29-2005, 08:19 AM   #14
phbc50
LQ Newbie
 
Registered: Oct 2005
Posts: 2

Rep: Reputation: 0
Apache 2 and php

I had the same problem, here is what you can try :
edit /etc/apache2/sysconfig.d/loadmodules.conf
make sure the following line is present :
Code:
LoadModule php4_module                    /usr/lib/apache2-prefork/libphp4.so
then edit /etc/apache2/httpd.conf comment out these lines :
Code:
# List of resources to look for when the client requests a directory
#DirectoryIndex index.html index.html.var
and add :
Code:
DirectoryIndex index.html index.php
AddHandler php-script   php
AddType text/html       php
AddType application/x-httpd-php-source phps
the /etc/init.d/apache2 restart
That worked for me.
regards,
phbc50
 
Old 10-29-2005, 09:33 AM   #15
phbc50
LQ Newbie
 
Registered: Oct 2005
Posts: 2

Rep: Reputation: 0
Also to add

Sorry I forgot, in /etc/apache2/default-server.conf, I also added
Code:
<Directory "/srv/www/htdocs">
 DirectoryIndex index.html index.php
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps
 Options Indexes FollowSymlinks MultiViews
 AllowOverride All
 Order allow,deny
 Allow from all
</Directory>
Hope this helps
phbc50
 
  


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
php will NOT work correctly :( arichardson Fedora 8 11-18-2005 07:28 AM
php will NOT work correctly :( arichardson Fedora 3 11-17-2005 03:10 PM
Apache-ssl not correctly parsing php files jme Linux - Software 2 05-03-2005 12:04 PM
PHP not working correctly AMMullan Programming 4 07-07-2004 02:32 PM
Crypt in PHP and RH8 not working correctly. sschueller Linux - Software 0 03-06-2003 05:10 PM

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

All times are GMT -5. The time now is 05:45 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