hi. i'm using xamppp for localhost. i have the page: ed.php . it contains a variable $val(this contains a simple html code). i want to echo this as a text and down as a preview for the code. ex: if $val='<b>this is a bold text</b>'; then up to echo this text and down to display the text but bolded -> for simple codes everything it's oke in localhost and on a real server (ex:size,align,color of a text) ->but ehne i want do dispaly an image : <img src=" .... on localhost works ,but on a real server DOESN'T ! i dont know why im sure that the image is corectly uploaded to server, because if a make a html page with only the code i put in $val, the browser displays the image. also from a link an image still doesn't displays -> The problem is why in localhost everything works oke but on server Doesn't ???
localhost is your local machine... what do you mean real server? I have never seen a "fake" server before.
i know is my local machine(then a virtual server,not "fake") i mean real server as 000php.com u register, make a subdomain, upload your files using,f.e., filezilla and then anyone from the world can acces the files(html and php pages)
localhost is just like our computer drive.., we can use with in our system, and real server means we can access through out the globe..!!
Yes i know this ! the problem is why in xampp my page works fine and on a real server doesn't. i wrote up what's the problem ... Maybe i didnt wrote the right title(my mistake sorry..) I meant to say whats the diffrences when a php code runs on localhost and on a server(i thought it's the same, but then why i get a diffrent result on a server ? )
Perhaps show us your code? FYI, image source can be relative and absolute. Maybe your image source is beyond the scope of your virtual directory, that's why remotely it cannot access it, but locally it can.
There shouldn't have any difference when you run a PHP code on localhost or the "real server" - if any, there could be a number of reasons such as the version your PHP is running, programs or settings of your server that may affect its performance, wrong or different configuration, etc, etc. But the bottom line is, they are totally the same and they should run the same.
If i wouldn't have uploaded the image or it must or i dindt wrote the right extension ,then why if i make a new html page which contains the same html code as $val contains it displays the image ??? ( sorry for bad english
I don't fully understand what you're asking, but I think you're suggesting that images and links that work on your local PC don't work when you upload your site. Is this correct? If so, you need to check the PATH of your images. Chances are, they are either 'relative', i.e. images\myimage.jpg or full paths, i.e. c:\windows\desktop\images\.. What you actually want is an absolute path to your image relative to the base path. If your site is http://www.domain.com/mysite/myimages/image.jpg I would suggest you use /mysite/myimages/image.jpg as the image path.
Show us your code and we can probably help better. For example if your script is stored in a folder called "public_html", and in that folder you have another folder named "images" with the "image1.jpg" (or whatever) in. Then on XAMMP it would be: $image="C:\xammp\www\images\image1.jpg" however, when you upload that to your "real" server, it will most probably be running linux. Thus it will look for the image in a folder tree named: C:\xammp\www\images\image1.jpg, however this wont exist. So like the other posts said, you should make $image = "/images/image1.jpg" This means nomatter what the folder tree is like (linux or windows) it will look i the subfolder "images" for the "imag1.jpg". Hope this helps
The configuration difference, maybe. If both PHP versions are similar then they should work fine. Change the image base directory to the domain name of your server, youcould be using http://localhost/image.png while on your web host it's http://example.com/image.png.
The best thing to do, as i and another said, would be to refer to images as "/image.png" or "/images/image.png", removing the need to predefine the URL
Fist:thanxs guys for helping me. i uploaded the files ed.php , danger.gif, test.html on the 000.php server. In ed.php is a variable : $var='<html> <body><h2>Norwegian</h2> <img border="0" src="danger.gif" alt="Pulpit rock" width="304" height="228" /> </body> </html>'; i first want to display my text as it is. it works on localhost and server(its a textarea which receive the value of $val ). i think until here its clear then down i have the code: echo $val; (to make a preview in the page of the code) It works fine with text tags(size font ..) lists.. - the problem is with that image (danger.gif). When i open the ed.php page everything it's oke with other tags(for example :it displays corectly the text "norwegian" with the size specific of the h2 html tag), but the image doesn't. the internet explorer or chrome show instead the image a small icon which indicates that hadn't found the image ... - maybe i didnt upload the image well, but why the test.html which contains exactly the value of the $val it displays corectly the image in my browser ? i mention that ed.php, dager.gif , test.html are in the same folder. i think now its clear what's my problem. again sorry for bad english
Change: $var='<html> <body><h2>Norwegian</h2> <img border="0" src="danger.gif" alt="Pulpit rock" width="304" height="228" /> </body> </html>'; PHP: to: $var='<html> <body><h2>Norwegian</h2> <img border=\"0\" src=\"/danger.gif\" alt=\"Pulpit rock\" width=\"304\" height=\"228\" /> </body> </html>'; PHP:
hmmm, where is the image located? in relation to public_html? is it at: yoursite.com/danger.gif or: yoursite.com/images/danger.gif ?
Well, when you FTP into your site, there should be a folder called "public_html" OR "www" on the screen. That is your root folder.