Results 1 to 10 of 13
Hi,
Where can I get detailed info regarding how to configure and use Apache along with PHP. I have Red Hat 8.0 and have installed Apache Server, PHP and MySQL ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-27-2003 #1Just Joined!
- Join Date
- May 2003
- Posts
- 10
Configure Apache and PHP
Hi,
Where can I get detailed info regarding how to configure and use Apache along with PHP. I have Red Hat 8.0 and have installed Apache Server, PHP and MySQL thats available in the packages. MySQL is working fine.
Also http://localhost displays the page fine. I need to setup a PHP site in my computer, so I need to know how to go about configuring it ir is it already preconfigured when I had installed it ?
Also are there any GUI tools available to configure them or do I need to edit files and if so which files are those.
Thanks.
- 05-27-2003 #2Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
If you've install PHP from an RPM (or from the system installation, that's the same thing), then it's already configured. Just create a .php file and try it out.
If you want PHP to be able to use MySQL, make sure that you have the php-mysql package installed.
- 05-29-2003 #3Linux Engineer
- Join Date
- Apr 2003
- Location
- Sweden
- Posts
- 796
Just create a index.php page and put it under your webbpage directory with follwing text in it.
If it workes the text will apear on your monitor, otherwise install PHP from rource or from rpm. Make sure to enable mysql-support if you compile it from source.Code:<?php print "Does my PHP-engine work?? \n"; ?>
Regards
Regards
Andutt
- 05-29-2003 #4Just Joined!
- Join Date
- May 2003
- Posts
- 10
Situation almost under control :-)
Hello there,
Thanks for all your inputs. I had made two php pages - namely test.php and tes1.php with the following codes -
Test.php
<?
phpinfo();
?>
Test1.php
<?php
phpinfo();
?>
I had placed them in the folder /var/www/html/
Now when i type the url http://localhost/test.php
I get a blank page and when I execute http://localhost/test1.php I get the detailed info regarding PHP. Why is this so. What other configurations do I need ? Please suggest.
Thanks.
- 05-30-2003 #5Just Joined!
- Join Date
- May 2003
- Posts
- 10
Hi there,
That worked. Thanks. Now I need to fix this issue.
I got a simple site made in PHP and MySQL and is running perfect. I have hosted it locally in Win 98 using PHPTriad. Now when I take the same to the Linux, I get the main page displayed. However when I try to login, nothing happens. I get no errors either. The login details are stored in a config.php file.
Also after a successful login, I have a script to create the tables for the application. The database has to be created beforehand or can be created through the script itself.
How do I check whether my PHP is configured for MySQL or not ?
PS. kindly note that I had installed Apache, PHP and MySQL as available in the packages from the installation disks during the setup itself. I haven't compiled them myself. MySQL is working fine, I say this because I can login to it and create databases and tables.
- 05-30-2003 #6Linux Engineer
- Join Date
- Apr 2003
- Location
- Sweden
- Posts
- 796
You really shouldnt cross-post topics!!
RegardsRegards
Andutt
- 05-30-2003 #7Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
What kind of login mechanism are you trying to use?
- 05-30-2003 #8Just Joined!
- Join Date
- May 2003
- Posts
- 10
Hi there,
These are the 2 files, one is admin.php and the other vars.php
admin.php
Code:<? require( "functions.php" ); session_start(); if( isset( $action ) ): if( $action == "logout" ): session_unregister( "name" ); session_unregister( "passwd" ); displayHeader( "Logout" ); echo " <center><h4>You have logout successfully!</h4></center> <p align=center>$homeTitle"; displayFooter(); endif; endif; if( isset( $name ) && isset( $passwd ) ): if( $name != $adminName || $passwd != $adminPasswd || $name == "" || $passwd == "" ): error( "Invalid username and password" ); elseif( !session_is_registered( "name" ) && !session_is_registered( "passwd" ) && $name == $adminName && $passwd == $adminPasswd ): session_register( "name" ); session_register( "passwd" ); displayAdmin(); elseif( session_is_registered( "name" ) && session_is_registered( "passwd" ) && $name == $adminName && $passwd == $adminPasswd ): displayAdmin(); else: error( "Fatal error, please close your browser and try again!" ); endif; else: displayForm(); endif; function displayForm() { displayHeader( "Login in" ); echo " <center><h4>Login in</h4></center> <div align=center> <center> <form method=post action=admin.php> <table border=0 cellpadding=0 cellspacing=0 width=230> <tr> <td width=70 height=20>User:</td> <td width=130 height=20><input type=text name=name size=20 maxlength=10></td> </tr> <tr> <td width=70 height=20>Password:</td> <td width=130 height=20><input type=password name=passwd size=20 maxlength=10></td> </tr> <tr> <td width=70 height=20></td> <td width=130 height=20><input type=submit value=\" Login \"></td> </tr> </table> </form> </center> </div> <p align=center><a href=javascript:history.back()>Back</a></p>"; displayFooter(); } function displayAdmin() { global $badWordFilter, $banIP; displayHeader( "Admin Area" ); echo " <center><h4>Admin Area</h4></center> <p align=center><a href=delete.php>Delete Message</a></p> <p align=center><a href=filter.php>Bad Words Filter"; echo $badWordFilter == 1 ? "(on)" : "(off)"; echo"</a></p><p align=center><a href=banip.php>Ban IP"; echo $banIP == 1 ? "(on)" : "(off)"; echo "</a></p> <p align=center><a href=createdb.php>Create Database</a></p> <p align=center><a href=dropdb.php>Drop Database</a></p> <p align=center><a href=forum.php>Thread Index</p>"; displayFooter(); } ?>
vars.php
[/code]Code:<? $forumTitle = "Discussion Forum"; // Forum title $homeTitle = "MyForums.com"; // Homepage name $homeURL = "http://localhost/forum/forum.php"; // Homepage URL $replyURL = "http://localhost/forum/reply.php"; // URL to 'reply.php' file $dbHost = "localhost"; // MySql host name $dbName = "forum"; // Database name $dbUser = "hello"; // User name $dbPasswd = "hello"; // Password $adminName = "admin"; // Admin name $adminPasswd = "admin"; // Password, please change them $badWordFilter = 1; // allow bad words checking? 1=yes, 0=no $banIP = 1; // ban ip? 1=yes, 0=no $emailAdmin = 1; // sent new posting to admin? 1=yes, 0=no $adminEmail = "kaustav11@yahoo.com"; // email address where new posting sent to $maxThread = "20"; // Thread number per page $fontFamily = "Verdana"; $fontSize = "9pt"; $linkColor = "#0080C0"; $visitedColor = "#0080C0"; $hoverColor = "#0080C0"; $bgColor = "#FFFFFF"; // background color $bgImage = ""; // background image ?>
- 05-30-2003 #9Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
What is PHPTriad? Anyway, I can't see anything without the functions.php file that is included by admin.php. The most probable error seems to be that cookies are disabled in your browser, though.
- 05-30-2003 #10Just Joined!
- Join Date
- May 2003
- Posts
- 10
Hello there,
PhpTriad is setup name for phpMyAdmin ( www.phpmyadmin.net ).
The code for functions.php is -
Thanks.Code:<? require( "vars.php" ); function dbConnect() { global $dbHost, $dbUser, $dbPasswd, $dbName; @mysql_connect( $dbHost, $dbUser, $dbPasswd ) or error( mysql_error() ); mysql_select_db( $dbName ); } function displayHeader( $title ) { global $fontFamily, $fontSize, $visitedColor, $hoverColor, $linkColor, $forumTitle, $bgColor, $bgImage; echo " <html> <head> <title>$title</title> <style type=\"text/css\"> <!-- body, table { font-family: $fontFamily; font-size: $fontSize; line-height: 1.5 } A:link { color: $linkColor; text-decoration: underline } A:visited { color: $visitedColor; text-decoration: underline } A:hover { color: $hoverColor; text-decoration: none } A:active { color: $linkColor; text-decoration: underline } --> </style> </head> <body bgcolor=$bgColor background=$bgImage> <center><h2><font face = 'Comic Sans Ms' size=6 color=#FF6600>$forumTitle</font></h2></center> "; } function displayFooter() { /* Please do not remove or change the code below */ echo " <p align=center></p> <p align=center>All Rights Reserved by <a href=http://localhost/forum/forum.php>myforum.com</a> 2003.</p> </p> </body> </html>"; /* Please do not remove or change the code above */ exit; } function error( $error ) { global $forumTitle; displayHeader( "Error Page" ); echo " <center><h4><Error Page></h4></center> <center><h4><font color=#FF0000>Error: $error</font></h4></center> <p align=center>$forumTitle</p>"; displayFooter(); exit; } ?>


Reply With Quote
