Forum Moderators: phranque
Apologies in advance for what is an overly-long post and my n00b-level question that has probably been answered explicitly a gazillion times already
I have tried looking, off and on for far too long, but my Google-Fu in this area is sadly lacking
Anyhoo
I have had Apache 2.0.63 (with PHP Version 5.2.6) running on the C drive of my local machine (Win XP Home) for a few months and, as far as PHP includes are concerned, it works... or at least... it does with an ugly work-around that involves hard-coding the absolute path to 'uploaded' (for example, CSS and favicon) files in the <head>
I have tried using a variety of php $DOCUMENT_ROOT AND $SERVER sorta strings, but without success, at least not on on my local machine <grr/>
This has been bugging me for ages!
My ugly workaround is wasting my time and bandwidth :(
Hopefully, there's a simple solution... one that doesn't waste too much of your time and bandwidth...
Anyhoo..
Fingers crossed
Hopefully, I have clearly - if not quite concisely - explained my dilemma
Thanks in advance
EXAMPLE of path to an Apache Install file:
C:\Program Files\Apache Group\Apache2\bin\ApacheMonitor.exe
EXAMPLE of path to a PHP Install file:
C:\php\php.ini
EXAMPLE of an html file D:\_www\widgets\index.html :
<?php include ("phpincludes/doctype.php"); ?>
<title>blue widgets</title>
<meta name="description"content="lorem ipsum">
<meta name="keywords"content="widgets">
<?php include ("phpincludes/myHead.php"); ?>
</head>
<body id="index">
<?php include ("phpincludes/allBodyBegin.php"); ?>
<h1>
Hello World
</h1>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod
</p>
<?php include ("phpincludes/myBodyEnd.php"); ?>
EXAMPLE of D:\_www\widgets\phpincludes\doctype.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-GB">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
EXAMPLE of D:\_www\widgets\phpincludes\myHead.php:
<!-- myHead.php -->
<meta name = "revised" content = "<?php echo date ("F d Y H:i:s", getlastmod()); ?>">
<link rel="icon" type="image/x-icon" href="http://www.example.com/graphics/favicon.ico" media="all">
<link rel="shortcut icon" type="image/x-icon" href="http://www.example.com/graphics/favicon.ico" media="all">
<link rel="stylesheet" type="text/css" href="http://www.example.com/css/mystyles.css">
<!-- <snip/> -->
MUCH TRIMMED VERSION of C:\Program Files\Apache Group\Apache2\conf\httpd.conf (it's still rather looooooong.... sorry... but - as you might have guessed already - I have no idea)
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.0/> for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#<snip/>
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
# LAVAZZA WROTE THIS ON LINE 164 (APPROX)
LoadModule rewrite_module modules/mod_rewrite.so
#<snip/>
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
# You must correct the path for the root to match your system's configured
# user directory location, e.g. "C:/WinNT/profiles/*/My Documents/My Website"
# or whichever, as appropriate.
#
#<Directory "C:/Documents and Settings/*/My Documents/My Website">
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# <Limit GET POST OPTIONS PROPFIND>
# Order allow,deny
# Allow from all
# </Limit>
# <LimitExcept GET POST OPTIONS PROPFIND>
# Order deny,allow
# Deny from all
# </LimitExcept>
#</Directory>
# added by LAVAZZA WROTE THIS ON LINE 318 (APPROX)
<Directory "D:/_www">
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Allow from all
</LimitExcept>
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
#DirectoryIndex index.html index.html.var LAVAZZA WROTE THIS ON LINE 340 (APPROX)
DirectoryIndex index.html index.php
# <snip/>
ServerSignature On
#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
# <snip/>
Alias /icons/ "C:/Program Files/Apache Group/Apache2/icons/"
<Directory "C:/Program Files/Apache Group/Apache2/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
# LAVAZZA WROTE THIS ON LINE 505 (APPROX)
Alias /test "C:/test"
<Directory "C:/test">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
# LAVAZZA WROTE THIS ON LINE 514 (APPROX)
Alias /drupal57 "C:/drupal-5.7"
# huh? should there be a trailing slash?
# i.e. "C:/drupal-5.7/"
<Directory "C:/drupal-5.7">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# LAVAZZA WROTE THIS ON LINE 525 (APPROX)
Alias /www/ "D:/_www/"
<Directory "D:/_www/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# LAVAZZA WROTE THIS ON LINE 535 (APPROX) (and it works, well, apart from the bits that don't!)
Alias /widgets "D:/widgets"
<Directory "D:/widgets">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# <snip/>
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"
# "C:/Program Files/Apache Group/Apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
<Directory "C:/Program Files/Apache Group/Apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#<snip/>
# LAVAZZA WROTE THIS ON LINE 815 (APPROX)
AddType application/x-httpd-php .php .html .js .css
#AddType php-script .html .htm .php .js .css
# tried WITHOUT SUCCESS by LAVAZZA 2008-11-22
# <snip/>
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
# LAVAZZA WROTE THIS ON LINE 430 (APPROX)
# ? I have tried it WITH and WITHOUT a trailing slash: at the end of PHPIniDir "C:/php/"
PHPIniDir "C:/php/"
LoadModule php5_module "C:/php/php5apache2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
# <snip/>
and... just in case it's relevant... and I haven't scared off/bored to death every possible source of advice
OUTPUT from hXXp://localhost/test/phpinfo.php
System
Windows NT myPcBrand-aHexString 5.1 build 2600
Build Date
May 2 2008 18:01:20
Configure Command
cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"
"--with-extra-includes=C:\Program Files (x86)\Microsoft SDK\Include;C:\PROGRA~2\MICROS~2\ <spaceInserted>
VC98\ATL\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\MFC\INCLUDE" <spaceInserted>
"--with-extra-libs=C:\Program Files (x86)\Microsoft SDK\Lib;C:\PROGRA~2\MICROS~2\VC98\LIB;C:\PROGRA~2\ <spaceInserted>
MICROS~2\VC98\MFC\LIB"
Server API
Apache 2.0 Handler
Virtual Directory Support
enabled
Configuration File (php.ini) Path
C:\WINDOWS
Loaded Configuration File
C:\php\php.ini
PHP API
20041225
PHP Extension
20060613
Zend Extension
220060519
Debug Build
no
Thread Safety
enabled
Zend Memory Manager
enabled
IPv6 Support
enabled
Registered PHP Streams
php, file, data, http, ftp, compress.zlib
Registered Stream Socket Transports
tcp, udp
Registered Stream Filters
convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*
I'm sorry if that lot amounts to 'way too much wrong/irrelevant information'...
Any help will be MOST welcome
Cheers
lavazza
In the EXAMPLE of D:\_www\widgets\phpincludes\myHead.php above, if - instead of:
<link rel="stylesheet" type="text/css" href="http://www.example.com/css/mystyles.css">
I use
<link rel="stylesheet" type="text/css" href="../css/mystyles.css">
It works, on the 'online server'
But... on my local machine, the CSS file fails to load because, I assume, the 'path' is unresolvable, given my config settings
Told ya I didn't know what to search for :(
Anyhoo... if you can help I will be VERY grateful :)
some recent entries from error.log
[Mon Nov 24 18:59:16 2008] [notice] Parent: Created child process 1908
Failed loading c:/php/ext/php_xdebug-2.0.2-5.2.5.dll
[Mon Nov 24 18:59:16 2008] [notice] Child 1908: Child process is running
[Mon Nov 24 18:59:16 2008] [notice] Child 1908: Acquired the start mutex.
[Mon Nov 24 18:59:16 2008] [notice] Child 1908: Starting 250 worker threads.
[Mon Nov 24 18:59:50 2008] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Group/Apache2/htdocs/favicon.ico
[Mon Nov 24 18:59:54 2008] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Group/Apache2/htdocs/favicon.ico
[Mon Nov 24 22:31:46 2008] [error] [client 127.0.0.1] File does not exist: D:/_www/css, referer: [localhost...]
[Mon Nov 24 22:32:53 2008] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Group/Apache2/htdocs/css, referer: [localhost...]
[Mon Nov 24 22:39:43 2008] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Group/Apache2/htdocs/css, referer: [localhost...]
[Tue Nov 25 04:47:28 2008] [warn] pid file C:/Program Files/Apache Group/Apache2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Tue Nov 25 04:47:28 2008] [notice] Apache/2.0.63 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Tue Nov 25 04:47:28 2008] [notice] Server built: Jan 17 2008 22:58:29
[Tue Nov 25 04:47:29 2008] [notice] Parent: Created child process 2028
Failed loading c:/php/ext/php_xdebug-2.0.2-5.2.5.dll
[Tue Nov 25 04:47:29 2008] [notice] Child 2028: Child process is running
[Tue Nov 25 04:47:29 2008] [notice] Child 2028: Acquired the start mutex.
[Tue Nov 25 04:47:29 2008] [notice] Child 2028: Starting 250 worker threads.
[Tue Nov 25 04:50:26 2008] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Group/Apache2/htdocs/favicon.ico
[Tue Nov 25 04:50:28 2008] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Group/Apache2/htdocs/favicon.ico
[Tue Nov 25 04:50:30 2008] [error] [client 127.0.0.1] File does not exist: C:/Program Files/Apache Group/Apache2/htdocs/favicon.ico
some recent entries from access.log
127.0.0.1 - - [24/Nov/2008:22:32:52 +1300] "GET /www/siteABC/index.html HTTP/1.1" 200 20367
127.0.0.1 - - [24/Nov/2008:22:32:52 +1300] "GET /www/siteABC/graphics/filename.gif HTTP/1.1" 304 -
127.0.0.1 - - [24/Nov/2008:22:32:52 +1300] "GET /css/siteABC-default.css HTTP/1.1" 404 303
127.0.0.1 - - [24/Nov/2008:22:39:43 +1300] "GET /www/siteABC/index.html HTTP/1.1" 200 20367
127.0.0.1 - - [25/Nov/2008:04:50:25 +1300] "GET /www/ HTTP/1.1" 200 13113
127.0.0.1 - - [25/Nov/2008:04:50:25 +1300] "GET /www/siteXYZ/css/default.css HTTP/1.1" 200 14114
127.0.0.1 - - [25/Nov/2008:04:50:25 +1300] "GET /www/ HTTP/1.1" 200 13113
127.0.0.1 - - [25/Nov/2008:04:50:25 +1300] "GET /www/siteXYZ/graphics/fileABC.gif HTTP/1.1" 200 1625
127.0.0.1 - - [25/Nov/2008:04:50:25 +1300] "GET /www/siteXYZ/graphics/fileXYz.gif HTTP/1.1" 200 1603
127.0.0.1 - - [25/Nov/2008:04:50:25 +1300] "GET /www/siteXYZ/graphics/fileZXC.png HTTP/1.1" 200 20773
127.0.0.1 - - [25/Nov/2008:04:50:30 +1300] "GET /favicon.ico HTTP/1.1" 404 293
127.0.0.1 - - [25/Nov/2008:04:51:06 +1300] "GET /www/ HTTP/1.1" 200 13113
127.0.0.1 - - [25/Nov/2008:04:51:08 +1300] "GET /www/siteXYZ/css/default.css HTTP/1.1" 200 14114
complete file: install.log
Installing Apache HTTP 2.0 server with
DomainName = localhost
ServerName = localhost
ServerAdmin = myname@example.com
ServerPort = 80
ServerRoot = C:/Program Files/Apache Group/Apache2
Rewrote C:/Program Files/Apache Group/Apache2/conf/httpd-win.conf
to C:/Program Files/Apache Group/Apache2/conf/httpd.default.conf
Successfully removed C:\Program Files\Apache Group\Apache2\conf\httpd-win.conf
Duplicated C:/Program Files/Apache Group/Apache2/conf/httpd.default.conf
to C:/Program Files/Apache Group/Apache2/conf/httpd.conf
Duplicated C:/Program Files/Apache Group/Apache2/conf/ssl.default.conf
to C:/Program Files/Apache Group/Apache2/conf/ssl.conf
Duplicated C:/Program Files/Apache Group/Apache2/conf/magic.default
to C:/Program Files/Apache Group/Apache2/conf/magic
Duplicated C:/Program Files/Apache Group/Apache2/conf/mime.types.default
to C:/Program Files/Apache Group/Apache2/conf/mime.types
Successfully removed C:\Program Files\Apache Group\Apache2\conf\InstallConf.awk