Click to See Complete Forum and Search --> : RH 8.0/apache/php config
jrugby
11-19-2002, 11:47 AM
I have installed RH 8.0 using the standard web server install and it appears to have loaded php, but when I run a test with a PHP file, it appears as a text file "all the code appears,html and php". I looked in the httpd.conf file to uncomment the files that everyone says needs uncommented, but they already appear to be set that way. They are set between <IfDefine> tags and <IfModule> tags. It has this for php, php3, and php4. I have gotten php running under windows, so I thought it should be no big thing to work with it under linux. Is it because I'm using RH 8.0? Should I be looking at other conf files? Should I try to re-install apache and/or php? If anyone needs more information from my conf. files, let me know.
I know this should not be this hard, but.......! Hey it is teaching me how to move about the command line real fast. Im an optimist.
Thanks.
z0mbix
11-19-2002, 11:51 AM
This is what the Red Hat docs say:
PHP
The configuration for PHP has been moved from httpd.conf into the file /etc/httpd/conf.d/php.conf. For this file to be loaded, you must have the statement Include conf.d/*.conf in your httpd.conf as described in the Section called Dynamic Shared Object (DSO) Support.
The PHP is now implemented as a filter and must therefore be enabled in a different manor. See the Section called Modules and Apache HTTP Server 2.0 for more about filters.
Under Apache HTTP Server 1.3, PHP was implemented using the following directives:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Under Apache HTTP Server 2.0, use the following directives instead:
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
In PHP 4.2.0 and later the default set of predefined variables which are available in the global scope has changed. Individual input and server variables are, by default, no longer placed directly into the global scope. This change may cause scripts to break. You may revert to the old behavior by setting register_globals to On in the file /etc/php.ini.
For more on this topic, refer to the following URL for details concerning the global scope changes:
http://www.php.net/release_4_1_0.php
jrugby
11-19-2002, 01:43 PM
I don't have that directory, file on my system. I checked quite well. I think I'm going back to install mandrake 8.1 on my system. All I have is head aches with Red hat 8.0
Thanks for all your help.
johnwebb
11-21-2002, 06:15 PM
With RedHat 8.0 you need to use the long php tag in your code.
<?php phpinfo(); ?> vs <? phpinfo(); ?>
EDIT: ok.. after tinkering around a bit and forcing the module loading by removing the <IfDefine HAVE_PHP4> tag, php now works under apache 1.3. The question now is, Where and how should HAVE_PHP be defined?
The Old Problem:
I am having this same problem under RH 7.2 and apache 1.3.
my index.php just comes up as a text file inside the browser window also. php is installed. running php -v on the command line gives this output.
4.0.4pl1
the php entries in my httpd.conf are as follows.
<IfDefine HAVE_PHP>
LoadModule php_module modules/mod_php.so
</IfDefine>
<IfDefine HAVE_PHP3>
LoadModule php3_module modules/libphp3.so
</IfDefine>
<IfDefine HAVE_PHP4>
LoadModule php4_module modules/libphp4.so
</IfDefine>
and.....
<IfDefine HAVE_PHP>
AddModule mod_php.c
</IfDefine>
<IfDefine HAVE_PHP3>
AddModule mod_php3.c
</IfDefine>
<IfDefine HAVE_PHP4>
AddModule mod_php4.c
</IfDefine>
and....
<IfModule mod_php4.c>
AddType application/x-httpd-php .php4 .php3 .phtml .php
AddType application/x-httpd-php-source .phps
</IfModule>
there's <IfModule> entries for mod_php3.c and mod_php.c also
Not sure if this helps but running httpd -l gives this output
Compiled in modules:
http_core.c
mod_so.c
suexe: enabled; valid wrapper /usr/sbin/suexe
I did notice that there's no "AddHandler" line in httpd.conf for php like there is for .cgi. Could this be the problem? Any help appreciated. Thanks in advance.
jrugby
11-22-2002, 10:11 AM
I wish I knew about that long tag for PHP before. I already loaded up mandrake 8.0 on my system and from the get go, php apache and mysql all are running fine. Now I have to figure out how to update to current versions in order to secure it alittle better. I don't want to be a newbie, but I am. I love tinkering with the system so that helps. I just hate when I screw it up so bad I have to start over, or don't know how to get it back to how it was. I wish there was a good book. All the books I have or checked on have different instructions/directorys than what is on my system that makes it harder to learn. Even peoples advice sometimes is different. Don't get me wrong I'm not complaining about people. I try all advice and learn from it. I think that is what makes Linux such a turn off to the complete beginner who just wants it to work. They won't give it a try and a try and a try untill they figure it out. I will keep trying! Thanks for everyones input.