Click to See Complete Forum and Search --> : redhat 8, apache, php and mysql (help!)


nomo_green
12-13-2002, 07:18 AM
redhat 8
apache 2
php 4
and mysql

my php scripts are not accessing the database and returning results for some reason. i can manually login to mysql console and select results so i know priv tables are set ok. if i put the phpinfo() script in the html dir it shows all the php stuff so php is configured. for some reason i cannot access the database through my scripts (they all worked fine under redhat 7.3). i've looked at php.net/mysql.com etc for answers with no luck. i checked my.cnf, php.ini and httpd.conf for any signs of something i missed, but all "seems" in order. nothing is showing up in logs either. as far as i know, i installed all needed rpms, it's some darn configuration crap. do i need to do anything special with apache2 or something? i'm so ungodly frustrated!!! it all worked fine on 7.3. this is a fresh install of rh 8, no upgrade.

any ideas anyone? i'm REALLY hoping this is a common problem and someone may know what i have done wrong?

thanks everyone :D

z0mbix
12-13-2002, 07:29 AM
PHP configuration has been changed in Apache 2.x. The docs for what changes have been made and where to edit configs etc are in the RH8.0 docs on their website.


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

from:

http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/ref-guide/s1-httpd-v2-mig.html

HTH :)

nomo_green
12-13-2002, 08:08 AM
the include conf.d and
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>

are in the right places. still doesn't work :confused:

i also tried setting the register_globals to on and still no luck.


any other ideas?

nomo_green
12-13-2002, 09:09 AM
got it working finally!!!!!!!!!!!!!!

strange crap. what a hassle for B.S.

what is was, was that i started my php scripts with the <? tag. well, all worked fine with my older apache, mysql and php like that, but for some reason it won't work unless i changed every script tag to <?php. supposedly in your my.cnf file there is this line:

; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
short_open_tag = Off

well i tried changing it to on, since i wanted it to recognize my <? so i wouldn't have to change all my scripts, but it wouldn't work. when i changed it (restarted apache and sql) it wouldn't connect to database. so i just set it back to "short_open_tag=off" and manually changed all my scripts to <?php and it works now.

god, what a major pain in the arse!

thanks for the reply cheeky_zombie

peace all

z0mbix
12-13-2002, 09:11 AM
Originally posted by nomo_green
got it working finally!!!!!!!!!!!!!!

strange crap. what a hassle for B.S.

what is was, was that i started my php scripts with the <? tag. well, all worked fine with my older apache, mysql and php like that, but for some reason it won't work unless i changed every script tag to <?php. supposedly in your my.cnf file there is this line:



well i tried changing it to on, since i wanted it to recognize my <? so i wouldn't have to change all my scripts, but it wouldn't work. when i changed it (restarted apache and sql) it wouldn't connect to database. so i just set it back to "short_open_tag=off" and manually changed all my scripts to <?php and it works now.

god, what a major pain in the arse!

thanks for the reply cheeky_zombie

peace all

No problem, glad you figured it out :)