473,396 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Session_start generates Ilegal Instruction under php 4.3.11 Help?

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 server as a client.

MySQL works perfectly. I have created and queried databases with no problem.

Apachie 2 appears to work with no problem. I can call up web pages in the expected maner.

I created a set of php scripts which I found in Larry Ullman's book "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.

The script does the following things:
-) require_once() a script which opens MySQL and attaches the database.
-) Creates a form for the user to enter their username and password.
-) Handles the form.
-) If all input was provided, query the database for the username/password pair.
-) 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 leave any fields blank or give a bad password, the script catches it and generates the error responce.

But if I give a good responce, the script just yields a perfectly blank HTML doc. Not even a title.

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 perfectly, including the header().

If I move session_start(); to the very beginning of the script, it 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.

So why does php 4.3.11 concidder session_open to be an illegal instruction?

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 else in php.ini which seemed to be related.

Thanks for any help or suggestions you can give.

I have coppied the entire script below for those who are interested.

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 authenticates.
# It also starts a session.
# Every other admin page will check for authentication, via a session variable.
# If that variable is unavailable, then access is denied.
#
# This page both prompts for authentication via a form and also handles the form.
# It verifies that the user is allowed to continue and then passes control to the Main page.
#
# 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 it.
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' and adm_password=PASSWORD('$p')";
$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 those on file.</p>';
}
mysql_close();
} else {
$message .= '<p>Please try again.</p>';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<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 below:</legend>
<p><b>User Name:</b> <input type="text" name="username" size="10" maxlength="20" value="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>" /></p>
<p><b>Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p>
<div align="center"><input type="submit" name="submit" value="Login" /></div>
</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 Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #1
3 2194
Trogdor wrote:
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 server as a client.

MySQL works perfectly. I have created and queried databases with no problem.

Apachie 2 appears to work with no problem. I can call up web pages in the expected maner.

I created a set of php scripts which I found in Larry Ullman's book "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.

The script does the following things:
-) require_once() a script which opens MySQL and attaches the database.
-) Creates a form for the user to enter their username and password.
-) Handles the form.
-) If all input was provided, query the database for the username/password pair.
-) 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 leave any fields blank or give a bad password, the script catches it and generates the error responce.

But if I give a good responce, the script just yields a perfectly blank HTML doc. Not even a title.

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 perfectly, including the header().

If I move session_start(); to the very beginning of the script, it 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.

So why does php 4.3.11 concidder session_open to be an illegal instruction?

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 else in php.ini which seemed to be related.

Thanks for any help or suggestions you can give.

I have coppied the entire script below for those who are interested.

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 authenticates.
# It also starts a session.
# Every other admin page will check for authentication, via a session variable.
# If that variable is unavailable, then access is denied.
#
# This page both prompts for authentication via a form and also handles the form.
# It verifies that the user is allowed to continue and then passes control to the Main page.
#
# 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 it.
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' and adm_password=PASSWORD('$p')";
$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 those on file.</p>';
}
mysql_close();
} else {
$message .= '<p>Please try again.</p>';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<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 below:</legend>
<p><b>User Name:</b> <input type="text" name="username" size="10" maxlength="20" value="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>" /></p>
<p><b>Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p>
<div align="center"><input type="submit" name="submit" value="Login" /></div>
</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 Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


Trogdor,

I can see where running from the command line might cause a problem -
you aren't running with Apache and a browser, so you don't have sessions
available. But an illegal instruction seems a bit harsh.

As to the Apache problem - is there anything in your php.log? And have
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 when
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.
js*******@attglobal.net
==================
Jul 17 '05 #2

Jerry Stuckle wrote:
Trogdor wrote:
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 server as a client.
MySQL works perfectly. I have created and queried databases with no problem.
Apachie 2 appears to work with no problem. I can call up web pages in the expected maner.
I created a set of php scripts which I found in Larry Ullman's book "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.
The script does the following things:
-) require_once() a script which opens MySQL and attaches the database. -) Creates a form for the user to enter their username and password. -) Handles the form.
-) If all input was provided, query the database for the username/password pair. -) 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 leave any fields blank or give a bad password, the script catches it
and generates the error responce.
But if I give a good responce, the script just yields a perfectly blank HTML doc. Not even a title.
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 perfectly, including the header().
If I move session_start(); to the very beginning of the script, it 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.
So why does php 4.3.11 concidder session_open to be an illegal instruction?
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 else in php.ini which seemed to be related.
Thanks for any help or suggestions you can give.

I have coppied the entire script below for those who are interested.
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 authenticates. # It also starts a session.
# Every other admin page will check for authentication, via a session variable. # If that variable is unavailable, then access is denied.
#
# This page both prompts for authentication via a form and also handles the form. # It verifies that the user is allowed to continue and then passes control to the Main page. #
# 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 it. 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' and adm_password=PASSWORD('$p')"; $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 those on file.</p>'; }
mysql_close();
} else {
$message .= '<p>Please try again.</p>';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <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 below:</legend> <p><b>User Name:</b> <input type="text" name="username" size="10" maxlength="20" value="<?php if (isset($_POST['username'])) echo
$_POST['username']; ?>" /></p> <p><b>Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p> <div align="center"><input type="submit" name="submit" value="Login" /></div> </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 Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via
Encryption =----
Trogdor,

I can see where running from the command line might cause a problem - you aren't running with Apache and a browser, so you don't have sessions available. But an illegal instruction seems a bit harsh.

As to the Apache problem - is there anything in your php.log? And have 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 when 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.
js*******@attglobal.net
==================


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

Jul 17 '05 #3
> 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.


If you have the zend optimizer installed try upgrading it. If you do
not, make sure that any third party components are upgraded for that
version. Most of the time you have to recompile all extensions.

Also if that does not solve it. Completely reinstall PHP double check
that your config file points to the right spots and that PHP has
permission to access those areas.

Mike
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ZoombyWoof | last post by:
Hi. I'm very new to PHP so this may be a dumb question, but I'm stuck. I have just compiled and installed the latest and the greatest versions of Apache (2.0.48), PHP (4.3.3) and MySQL (4.0.15) on...
2
by: Reply-Via-Newsgroup Thanks | last post by:
Folks, I consider myself a reasonably strong PHP programmer, but I've not used sessions before (I've used cookies instead) and I'd appreciate it if someone could confirm something for me. ...
4
by: Bob | last post by:
Seem to have a problem ending a session. I get the following message. Warning: session_start(): Cannot send session cookie - headers already sent by (output started at...
3
by: Mario_5 | last post by:
How you protect your application from ilegal coping? Is it some passwords, or limited number of copies, or something else. Do you develop your own protection or you are use third party solutions?...
5
by: KJ | last post by:
I would like to know if there is a tool for download or purchase that will generate a skeleton xslt document, inserting all the xsl:template's matching each element specified in any given xsd. ...
6
by: Jeff Smythe | last post by:
Why does Session_Start in Global.asax fire for every page opened during a session of an ASP.NET application? Am I wrong to expect that it would fire only when the first page (i.e., any page in...
5
by: Niklas Uhlin | last post by:
Someone please explain why Session_Start fires multiple times / retains SessionID values between sessions, when you open an ASP.NET page from MS Word. For details of the problem, see below: 1....
5
by: Gabriel Lozano-Morán | last post by:
Is there any particular reason why the Session_Start() event gets triggerend by each aspx page request? Details: Windows XP Pro SP2 ..NET Framework v1.1.4322 C# SessionState set to mode...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.