rd42 Posted November 21, 2002 Posted November 21, 2002 OS Redhat Webserver Apache (but it's the Redhat install with different dirs) PHP 4.2.2 appears to be properly installed, the test page works. MySQL database and fields have been created. When I go to http://localhost/catalog/default.php it pukes out code instead of the default oscommerce page. help :shock: below is a sample of what I see on the page: 0) { $category_depth = 'products'; // display products } else { $category_parent_query = tep_db_query("select count(*) as total from categories where parent_id = '" . $current_category_id . "'"); $category_parent = tep_db_fetch_array($category_parent_query); if ($category_parent['total'] > 0) { $category_depth = 'nested'; // navigate through the categories } else { $category_depth = 'products'; // category has no products, but display the 'no products' message } } } ?> FONT_STYLE_TOP_BAR FONT_STYLE_HEADING FONT_STYLE_SUB_BAR FONT_STYLE_TOP_BAR
mattice Posted November 21, 2002 Posted November 21, 2002 What happens is the php gets parsed as if it was TEXT. This can mean about 3 things: - Apache doesn't know the .php extention is php (check httpd.conf) - You're missing the opening <?php in that specific file - Your upload is broken (binary where it should be ascii mode) HTH Mattice "Politics is the art of preventing people from taking part in affairs which properly concern them"
rd42 Posted November 21, 2002 Author Posted November 21, 2002 Thanks for the reply, I think my problem may be in the binary vs. ascii mode you mentioned. Did a upload the wrong package, untar it wrong, etc. Some other clues: The opening <?php in that default.php is default.htm. When I create a test.php with the contents <?php phpinfo(); ?> It works phpMyAdmin 2.3.3 works References to php in httpd.conf LoadModule php4_module /user/lib/httpd/modules/libphp4.so AddType application/x-httpd-php .php Thanks again!
mattice Posted November 21, 2002 Posted November 21, 2002 The opening <?php in that default.php is default.htm Ehmm...? Anyway, if the <?php phpinfo(); ?> works in a file called xxxx.php Apache is parsing things nicely. So I reckon you uploaded your tar in ascii or your php files in binary.... Or did you get the Windows package? Don't know if that makes a difference... "Politics is the art of preventing people from taking part in affairs which properly concern them"
IST Posted November 21, 2002 Posted November 21, 2002 I ran into the same problem where the default.php is shown in source code in the browser. This happens on RedHat 8.0 Httpd starts properly. I create a test.php with the contents <?php phpinfo(); ?> and the browser shows nothing when loading this page. The same catalog works fine with RedHat ADV. 2.1 and 7.3. I'm sure this a a php related issue but don't know how to fix this. Please help. Thanks a lot in advance
mattice Posted November 21, 2002 Posted November 21, 2002 Check your httpd.conf for the settings shown above. "Politics is the art of preventing people from taking part in affairs which properly concern them"
IST Posted November 22, 2002 Posted November 22, 2002 Hi Mattice, I have these lines added into httpd.conf, but still have the same problems. LoadModule php4_module /user/lib/httpd/modules/libphp4.so AddType application/x-httpd-php .php I'm not quite sure what you meant by broken upload with binary and acsii mode. Are you talking about package downloading mode? I don't think I have problem with the binary and ascii mode issue since the same catalog works fine on RH 2.1 AS and 7.3. I'm running out of clues here. What should I try next? Thanks, Lam
mattice Posted November 22, 2002 Posted November 22, 2002 Did you restart apache? If so did it complain? Is php compiled into apache AT ALL? "Politics is the art of preventing people from taking part in affairs which properly concern them"
IST Posted November 22, 2002 Posted November 22, 2002 Yes I did restart the httpd. If I do this in httpd.conf <IfDefine HAVE_PHP4> LoadModule php4_module /user/lib/httpd/modules/libphp4.so AddType application/x-httpd-php .php </IfDefine> httpd restarts fine without any complaint at all. Without the <IfDefine...> httpd restarts fine but gives me a warning that php4 module is already loaded and it skips. However, I check and don't see php4 module called out any where else in the httpd.conf I did rpm -qa|grep php and see a below list php ldap-4..... php dbg-server... php odbc.... php dbg-base... php-devel... php-pgsql... php-4.2.... php-mysql... php-dbg... .... So look like all the php stuff are here, but it still does not work. Thanks, IST
IST Posted November 22, 2002 Posted November 22, 2002 It was the php.ini configuration. In RH 8.0, the short_open_tag is set to off by default. This tag needs to turn on. Few other tags and paramters need to be changed for php pages to work properly. PHP and Apache in RH 8.0 do not work strainght out of the box like RH 2.1 AS I had a working php.ini from RH 7.3. I copied it over to 8.0 and it works. IST
Recommended Posts
Archived
This topic is now archived and is closed to further replies.