From:             [EMAIL PROTECTED]
Operating system: RedHat Linux 6.2 (2.2.12 kernel)
PHP version:      4.0.6
PHP Bug Type:     Session related
Bug description:  relative URL incorrect when a "session id" is appended to URL

I'm not sure if this is a PHP problem, an Apache problem, or a browser

PHP 4.0.6, configured with:
./configure --with-apache=../apache_1.3.20 \
--with-mysql=/usr/local/mysql \
--enable-track-vars \

Apache 1.3.20, configured with:
./configure "--with-layout=Apache" \
"--prefix=/etc/httpd" \
"--activate-module=src/modules/php4/libphp4.a" \
"--enable-suexec" \
"--suexec-caller=http" \
"--suexec-docroot=/home/baseweb" \
"--suexec-logfile=/var/log/httpd/suexec_log" \
"--suexec-safepath=/bin:/usr/bin" \

Browsers checked, all act consistently for this problem:
Konqueror 2.1.1
    on platform Linux Mandrake 8 (2.4.3-20mdk kernel), with KDE 2.1.1
Netscape Communicator 4.73
    on platform Windows NT 4.0 SP5
Internet Explorer 5.01 SP1
    on platform Windows NT 4.0 SP5

URL to the server's phpinfo() page:

Short summary:
I have been having trouble with session management functions
all day, so I am going to store my session stuff in a database
instead of burning time and brain cells debugging this.  (So there
are no session_ function calls at all.)     I ended up implementing
an idea from here:

I am creating a 32-bit "session id" the standard way I've seen
$session_id = md5(uniqid(rand()));

I chose to try an example of "hiding" the session id on the end of the
as described in a New Riders book "Web Application Development with PHP
by Tobias Ratschiller and Till Gerken.
(so that the URL is of the form:

When I use relative URLs for pages and images, and there is a session id
at the end of the URL, all browsers that I've encountered produce "broken"
of this form:

instead of the expected

To get this sample application functional, I had to prepend '../'
to my relative URLs, for both hypertext links, and img src path
Why?  The files are all in the same directory, so I think I've found
a bug (and it's workaround).

The reason I am not sure if the error is on the browser side or the
server side is:  When I view the page source, it appears as expected,
not with the "broken" link/image paths.

The "flow" through this sample application is:
Start ->
index.html (login form, enter any login id, any password) ->
login.html (authenticates, creates $session_id, then redirects in
main.html/$session_id    ->
mail.html/$session_id (when you click on first link)
billing.html/$session_id (when you click on second link)
web.html/$session_id (when you click on third link)
logout.html/$session_id (when you click on the last link) ->  Start

URL to functional sample application:

URL to functional sample application PHP source:

URL to broken sample application:

URL to broken sample application PHP source:

Differences are isolated to these files: (redirect to index.html) (redirect to index.html)  (image path)
main.html   (hypertext links to mail, billing, web, logout pages)

Thanks for your hard work on PHP 4!  It is really great,
and I want to make it better!

Edit bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to