Jerry Stuckle wrote:[color=blue]
> Trogdor wrote:[color=green]
> > I set up a server on an AMD 650 machine running gentoo linux.
> >
> > I installed Apachie 2, MySQL 4.1 and PHP 4.3.11
> >
> > I use another computer on my local net (192.168.0.x) to access the[/color][/color]
server as a client.[color=blue][color=green]
> >
> > MySQL works perfectly. I have created and queried databases with[/color][/color]
no problem.[color=blue][color=green]
> >
> > Apachie 2 appears to work with no problem. I can call up web pages[/color][/color]
in the expected maner.[color=blue][color=green]
> >
> > I created a set of php scripts which I found in Larry Ullman's book[/color][/color]
"PHP and MySQL For Dynamic Web Sites." For those of you with that
book, I used Script 7.7 and replaced all the constants with my own
values.[color=blue][color=green]
> >
> > The script does the following things:
> > -) require_once() a script which opens MySQL and attaches the[/color][/color]
database.[color=blue][color=green]
> > -) Creates a form for the user to enter their username and[/color][/color]
password.[color=blue][color=green]
> > -) Handles the form.
> > -) If all input was provided, query the database for the[/color][/color]
username/password pair.[color=blue][color=green]
> > -) If username/password are in the database, then
> >
> > session_start();
> > $_SESSION['authenticated'] = TRUE;
> > header ("Location: main-admin.php");
> > exit();
> >
> > Everything appears to work untill I hit the session_start(). If I[/color][/color]
leave any fields blank or give a bad password, the script catches it
and generates the error responce.[color=blue][color=green]
> >
> > But if I give a good responce, the script just yields a perfectly[/color][/color]
blank HTML doc. Not even a title.[color=blue][color=green]
> >
> > If I go to the server and run
> > # php index.php
> > it comes back with "Illegal Instruction." but with no explanation.
> >
> > If I comment out the session_start(); then everything works[/color][/color]
perfectly, including the header().[color=blue][color=green]
> >
> > If I move session_start(); to the very beginning of the script, it[/color][/color]
still dies and with the same symptoms. And since the script is
generating a form on its first pass, the header() function is not
encountered.[color=blue][color=green]
> >
> > So why does php 4.3.11 concidder session_open to be an illegal[/color][/color]
instruction?[color=blue][color=green]
> >
> > I have read the php manual, but have found nothing there.
> >
> > php.ini has session auto start set to 0. I did not see anything[/color][/color]
else in php.ini which seemed to be related.[color=blue][color=green]
> >
> > Thanks for any help or suggestions you can give.
> >
> > I have coppied the entire script below for those who are[/color][/color]
interested.[color=blue][color=green]
> >
> > Bob W.
> >
> >
> >
> >
> > <?php # /home/justadventure/html/admin/index.php
> >
> > # This is the Index page for Admins.
> > # Admins must enter by this page. It is the only page which[/color][/color]
authenticates.[color=blue][color=green]
> > # It also starts a session.
> > # Every other admin page will check for authentication, via a[/color][/color]
session variable.[color=blue][color=green]
> > # If that variable is unavailable, then access is denied.
> > #
> > # This page both prompts for authentication via a form and also[/color][/color]
handles the form.[color=blue][color=green]
> > # It verifies that the user is allowed to continue and then passes[/color][/color]
control to the Main page.[color=blue][color=green]
> > #
> > # If authentication fails, then an explaination is displayed.
> > #
> > # Version 1.0 10-MAY-2005
> >
> > # First, check if the form was submitted and we are now to handle[/color][/color]
it.[color=blue][color=green]
> > if (isset($_POST['submit'])) {
> > require_once ('../../secret/mysql-admin-main.php');
> > function escape_data ($data) {
> > global $dbc;
> > if (ini_get('magic_quotes_gpc')) {
> > $data = stripslashes($data);
> > }
> > return mysql_real_escape_string($data, $dbc);
> > }
> > $message = NULL;
> > if (empty($_POST['username'])) {
> > $u = FALSE;
> > $message .= '<p>You forgot to enter your username!</p>';
> > } else {
> > $u = escape_data($_POST['username']);
> > }
> > if (empty($_POST['password'])) {
> > $p = FALSE;
> > $message .= '<p>You forgot to enter your password!</p>';
> > } else {
> > $p = escape_data($_POST['password']);
> > }
> >
> > if ($u && $p) { // If everything's OK.
> > $query = "SELECT adm_usrname FROM admins WHERE adm_usrname='$u'[/color][/color]
and adm_password=PASSWORD('$p')";[color=blue][color=green]
> > $result = @mysql_query ($query);
> > $row = mysql_fetch_array ($result, MYSQL_NUM);
> > if ($row) {
> >
> > // Start the session, register the values & redirect.
> > session_start();
> > $_SESSION['authenticated'] = TRUE;
> > header ("Location: main-admin.php");
> > exit();
> >
> > } else {
> > $message = '<p>The username and password entered do not match[/color][/color]
those on file.</p>';[color=blue][color=green]
> > }
> > mysql_close();
> > } else {
> > $message .= '<p>Please try again.</p>';
> > }
> > }
> > ?>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> >[/color][/color]
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">[color=blue][color=green]
> > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> > <head>
> > <meta http-equiv="content-type" content="text/html;[/color][/color]
charset=iso-8859-1" />[color=blue][color=green]
> > <title>JustAdventure Administers Login Page</title>
> > </head>
> > <body>
> > <?php
> > if (isset($message)) {
> > echo '<font color="red">', $message, '</font>';
> > }
> > # Create the form and designate this script as the handler.
> > ?>
> > <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
> > <fieldset><legend>Enter your information in the form[/color][/color]
below:</legend>[color=blue][color=green]
> > <p><b>User Name:</b> <input type="text" name="username" size="10"[/color][/color]
maxlength="20" value="<?php if (isset($_POST['username'])) echo
$_POST['username']; ?>" /></p>[color=blue][color=green]
> > <p><b>Password:</b> <input type="password" name="password"[/color][/color]
size="20" maxlength="20" /></p>[color=blue][color=green]
> > <div align="center"><input type="submit" name="submit"[/color][/color]
value="Login" /></div>[color=blue][color=green]
> > </fieldset></form><!-- End of Form -->
> > </body>
> > </html>
> >
> >
> >
> > --------------= Posted using GrabIt =----------------
> > ------= Binary Usenet downloading made easy =---------
> > -= Get GrabIt for free from
http://www.shemes.com/ =-
> >
> >
> > ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure[/color][/color]
Usenet News==----[color=blue][color=green]
> >
http://www.newsfeeds.com The #1 Newsgroup Service in the World![/color][/color]
120,000+ Newsgroups[color=blue][color=green]
> > ----= East and West-Coast Server Farms - Total Privacy via[/color][/color]
Encryption =----[color=blue]
>
> Trogdor,
>
> I can see where running from the command line might cause a problem -[/color]
[color=blue]
> you aren't running with Apache and a browser, so you don't have[/color]
sessions[color=blue]
> available. But an illegal instruction seems a bit harsh.
>
> As to the Apache problem - is there anything in your php.log? And[/color]
have[color=blue]
> you sent ANYTHING (even a blank line) before the header call?
>
> I did see an entry in the php bugs database at
http://www.php.net
> (always a good thing to check!) where someone had a similar problem[/color]
when[color=blue]
> he installed 4.3.11 over 4.3.10 and ended up with mixed extensions.
> Removing 4.3.10 completely (probably should remove everything) and
> reinstalling 4.3.11 fixed his problem.
>
>
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
>
jstucklex@attglobal.net
> ==================[/color]
I've just installed 4.3.11 and got an illegal instruction with
session_start() as well. Unfortunately i have no solution yet. I tried
PHP 5 and then went back to 4.3.10 & still got the same - with php and
mod_php under apache. Possibly when I changed version some stuff was
left behind but the standard 4.3.11 definitely had this problem. I've
got AMD Athlon 1000 processor.
boggins