Go Back   openSUSE Forums > Archives > SF Archives > ARCHIVES - Programming & Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Programming & Scripting A place to discuss website design, programming, shell scripts, etc

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 14-Apr-2008, 00:13
RaX
Guest
 
Posts: n/a
Thumbs up

I have just installed apache 2 + php5, from YaST2. I tested if my apache web server was running fine (after changing the read and execute permission on /srv/www/htdocs/, and adding a simple html file for its index.html) by entering as URL:
Code:
http://localhost
... and it worked fine.

But now when I try to test if the PHP installation was fine, by creating a file info.php, putting it again in /srv/www/htdocs/, adding to the file the classic lines:
Code:
<?
phpinfo();
?>
... and running:
Code:
http://localhost/info.php
It doesn't works, since the browser tries to download the file:


What else I have to do to allow php to run just fine from apache ? :blink:
  #2 (permalink)  
Old 14-Apr-2008, 01:17
ken_yap
Guest
 
Posts: n/a
Default

Add php5 to the list of modules in APACHE_MODULES in /etc/sysconfig/apache2 and restart apache2.
  #3 (permalink)  
Old 15-Apr-2008, 14:46
RaX
Guest
 
Posts: n/a
Default

Quote:
Add php5 to the list of modules in APACHE_MODULES in /etc/sysconfig/apache2 and restart apache2.
[/b]
That's already included there my friend:
Code:
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5"
What else can I do to solve this problem ? :blink:

PD: What I can do to be sure that apache is running w/out problems ? I created a simple index.html file then I located it in /srv/www/httdocs, then I tested apache from my browser by going to http://localhost/ and the server loaded the simple page I had created. I guess that's enough to test that apache is running ok, or not ?
  #4 (permalink)  
Old 15-Apr-2008, 17:18
FuryWS
Guest
 
Posts: n/a
Default

Check if you have a valid php5.conf in /etc/apache2/conf.d/ and then check if it is included near the end of /etc/apache2/default-server.conf.

EDIT: Also, use full PHP tags:

<?php ... ?>

I believe php5.ini disables short tags by default.
  #5 (permalink)  
Old 15-Apr-2008, 18:33
RaX
Guest
 
Posts: n/a
Default

I made the change to the tags and it worked! Thanks a lot for your help.

A strange message is appearing when I restart apache, do you know how to solve it ?

Quote:
Dixie7:/srv/www/htdocs # rcapache2 restart
Module "php" is not installed, ignoring.
Check the APACHE_MODULES setting in /etc/sysconfig/apache2.
Syntax OK
Shutting down httpd2 (waiting for all children to terminate) done
Starting httpd2 (prefork) done
Dixie7:/srv/www/htdocs # [/b]
  #6 (permalink)  
Old 15-Apr-2008, 19:34
FuryWS
Guest
 
Posts: n/a
Default

Quote:
A strange message is appearing when I restart apache, do you know how to solve it ?
[/b]
No idea. But I would try and re-install mod_php5, it also reinstalls PHP5. Just update it through Yast, click on it once to get a "recycle" icon instead of checked box. Backup your php5.ini first, tho'.
  #7 (permalink)  
Old 16-Apr-2008, 10:00
RaX
Guest
 
Posts: n/a
Default

Problem solved!

In my intents to make to work PHP, I added 'php' to:
/etc/sysconfig/apache2

So it looked like this:
Quote:
APACHE_MODULES="authz_host actions alias auth_basic authz_groupfile authn_file authz_user autoindex cgi dir include log_config mime negotiation setenvif status userdir asis imagemap php php5 authz_default"[/b]
I removed that, restarted apache then it did not appear anymore:
Code:
Dixie7:/ # rcapache2 restart
Syntax OK
Shutting down httpd2 (waiting for all children to terminate)******** done
Starting httpd2 (prefork)********************************************done
  #8 (permalink)  
Old 16-Apr-2008, 12:28
FuryWS
Guest
 
Posts: n/a
Default


Oh, yeah, you have a directive somewhere requiring php4. I don't think what you did is a proper solution, though. Rather hunt the offending directive and have only php5 installed (unless you need them both). With your solution, you have both PHP4 and PHP5 modules installed. Check the error_log in /var/log/apache2, maybe it will provide more info about the offending directive.
  #9 (permalink)  
Old 16-Apr-2008, 14:11
RaX
Guest
 
Posts: n/a
Thumbs up

Quote:
Oh, yeah, you have a directive somewhere requiring php4. I don't think what you did is a proper solution, though. Rather hunt the offending directive and have only php5 installed (unless you need them both). With your solution, you have both PHP4 and PHP5 modules installed. Check the error_log in /var/log/apache2, maybe it will provide more info about the offending directive.
[/b]
Forget about it, I already removed that 'php' addition I made to that parameter.

Changing of topic. Yesterday I installed other stuff, in my search to finally solve my problem as specified here

So since yesterday I have 2 php.ini files, located at:
/etc/php5/cli/php.ini
/etc/php5/apache2/php.ini

Apparently they appeared after installing either one of these packages, which I installed yesterday:
  • yast2-http-server
    or
  • apache2-mod_php5
What file from both do you think is the one "on-charge", of carrying the real php internal configuration ? I mean... can not be both right ? :blink:
  #10 (permalink)  
Old 16-Apr-2008, 14:47
FuryWS
Guest
 
Posts: n/a
Default


The one in /etc/php5/apache2/php.ini is for the Apache module (for the "web server"), the other is CLI, when you call PHP from command line.
 

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2