?
Solved

PHP & HTTPD

Posted on 2005-03-22
3
Medium Priority
?
323 Views
Last Modified: 2010-03-04
Linux FC2

The second script following this one suddenly stopped working so I thought I should start fixing at number one.

This number one gives the following errors:
~/httpd/access_log
192.168.1.13 - - [22/Mar/2005:20:41:27 +0800] "GET /var/nobla/u1/h123.css HTTP/1.1" 404 299 "http://192.168.1.13/open_session.php" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922"

~/httpd/error_log
[Tue Mar 22 20:41:27 2005] [error] [client 192.168.1.13] File does not exist: /home/meeting/chair/var, referer: http://192.168.1.13/open_session.php

The first error seems to be a path problem to the file, it affects only presentation.
Can anyone point to me what I am doing wrong?

The second error has got me confused, I've got no idea since there is no file named "var" that is called in the script, only a directory (ref: error 1)
Can anyone explain, give me a solution?

Here is the number one script:
# open_session.php
<?  session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Open Session</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel=stylesheet type="text/css" href="/var/nobla/u1/h123.css">
</head>
<body class="wp2cpng">
<table class="tabl01"><tr><td width="100%">
<form method="post">1) Click here
<input type="text" name="date"></form><br>

<?php
if (isset($_POST['date'])) {
 $date = ($_POST['date']);
 $filename1 = "agenda/session_agenda" . $date;
 $_SESSION['filename1'] = $filename1;      # save it
 echo "Session date = Day: ";
 ?><b><font color="red"><?
 echo substr($filename1,25,2);
 ?></b></font><?
 echo " &nbsp; Month: ";
 ?><b><font color="red"><?
 echo substr($filename1,23,2);
 ?></b></font><?
 echo " &nbsp; Year: ";
 ?><b><font color="red"><?
 echo "20",substr($filename1,21,2);
 ?></b></font><?
 echo "<br>";
 if (file_exists($filename1)) {
  echo "<form method='post' action='select_element.php'><select size='8' name='selected'>";
  $agenda = file("$filename1");
  $_SESSION['agenda'] = $agenda;
  foreach($agenda as $lineNumber => $lineStr) {
       echo "<option>$lineStr</option>";
  }
    echo "</select><br><br>";
    echo "<input type='submit' name='submit' value='Continue '></form>";
 }
  else   {
  echo "No file found for the date entered<br><br>";
  }
}
?>
</td></tr></table></body></html>

Thank you for your help.
0
Comment
Question by:rblampain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:craigwardman
ID: 13602093
just to confirm,

link rel=stylesheet type="text/css" href="/var/nobla/u1/h123.css">

the /var folder is in your disk root, not website root, if you want it to start from website root, remove the preceding /

link rel=stylesheet type="text/css" href="var/nobla/u1/h123.css">

That may help with 404 error if the file is under the website directory :)
0
 

Author Comment

by:rblampain
ID: 13608619
Thanks to  craigwardman
The file is not under the website root, it is under the disk root.
The "documentroot" in HTTPD is "/home/meeting/chair" and a script from this directory is trying to read the file "/var/nobla/u1/h123.css" ("/var/nobla" was created at installation time).  

Apache is trying to read "/home/meeting/chair/var/nobla/u1/h123.css" how can I make it read "/var/nobla/u1/h123.css"?  
0
 
LVL 8

Accepted Solution

by:
craigwardman earned 2000 total points
ID: 13611247
I think you would be best to alias this folder somewhere within the documentroot or to create a symbolic link.. as i doubt Apache will be able to access files outside of documentroot for security reasons..

to create a symlink, use this command from bash$:

ln -s /var/nobla/u1 /home/meeting/chair

This will create a symbolic link to the u1 folder giving access to its files from the /home/meeting/chair documentroot..

(you may need to play around with the file/folder attributes of this directory to get fully working)
(i.e chmod 755 /var/nobla/u1)

In your httpd.conf file, you must make sure to have this directive for Options:

<Directory />
    Options FollowSymLinks          <---
    AllowOverride None
</Directory>


Another way to do it, with a folder alias, would be as follows, in httpd.conf:

Alias /var/nobla/u1/ "/var/nobla/u1/"

<Directory "/var/nobla/u1/">
    Options Indexes
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

this forwards all requests for documentroot/var/nobla/u1 to the actual directory /var/nobla/u1


but i would personally use the symlink :)

Hope this is helpful !


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question