Relative path on Unix server?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
raymedia
Forum Commoner
Posts: 27
Joined: Thu Oct 09, 2003 6:36 am
Location: Melbourne, Australia

Relative path on Unix server?

Post by raymedia »

i was developing my php site on windows - localhost and now i have moved it to unix server. but it seems it have problem with my relative path to files.

ie.

Code: Select all

<img src="images/corner/box_r1_c1.gif" alt="test"></img>
I have tried to look for an answer throughout the internet but no success.

i realise that i might solve this by using absolute path

ie.

Code: Select all

<img src="http://www.monkey.com/images/corner/box_r1_c1.gif" alt="test"></img>
but everytime i move the file i have to change it and i feel its not a very good practise. If anyone knows how to fix this, please help me. Thank you
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

on a side note for your reference <img> does NOT need a closing </img> tag.

what if you change your path to a root relative path like this

Code: Select all

<img src="/images/corner/box_r1_c1.gif" alt="test">
Mark
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

is the path and file name all lower case on the server, as windows is not case sensitive whereas UNIX is, could be your problem.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

use css
User avatar
raymedia
Forum Commoner
Posts: 27
Joined: Thu Oct 09, 2003 6:36 am
Location: Melbourne, Australia

Post by raymedia »

I have check it, but every files names are lower case. Below are some bit of the code.

Code: Select all

head>
	<title>TopStar Computer International :: <?=$title ?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<link rel="stylesheet" href="css/tci.css" type="text/css">
	<SCRIPT language="javascript" src="script/javascript.js"></SCRIPT> 
</head>

<body onLoad="MM_preloadImages('images/corner/box_r1_c1.gif','images/corner/box_r1_c2.gif','images/corner/box_r1_c3.gif','images/corner/box_r2_c1.gif','images/corner/box_r2_c3.gif','images/corner/box_r3_c1.gif','images/corner/box_r3_c2.gif','images/corner/box_r3_c3.gif','images/do.gif')">
<table width="800" border="0" cellspacing="0" cellpadding="0">
	<tr> 
		<td colspan="3">
			<table width="800" border="0" cellpadding="0" cellspacing="0">
				<tr> 
					<td width="300">
						<h2><b>
							TopStar Computer International
						</b></h2>
					</td>
					<td width="500" align="right"><img src="images/do.gif" width="450" height="71" align="top"></td>
				</tr>
			</table>
		</td>
	</tr>
	<form action="logout.php" method="post">
	<tr> 
		<td class="blueLine" align="left"><b><?=date("D, F j, Y") ?></b></td>
		<td class="blueLine"></td>
		<td class="blueLine" align="right"> 
			<input class="logoutButton" type="submit" name"action" value="Logout">	
		</td>
	</tr>
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

did you try my suggesion?

Mark
User avatar
raymedia
Forum Commoner
Posts: 27
Joined: Thu Oct 09, 2003 6:36 am
Location: Melbourne, Australia

Post by raymedia »

I did but no luck..its really frustrating.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

well i cannot see how linux doesnt support relative paths, i have exactly the same sites on both my linux and windows box (2 seperate apache versions btw)

i copied and pasted my site from windows (so there is no changes) and every thing works fine, i would also like to point out that all my sites use document relative links so this cannot be the case

all i can think of is...........

1 - you do not have permissions to a certain folder on unix (quite likely, linux has a habit of <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>' you up in this way)
2 - your file paths are not 'cased' correctly
Post Reply