Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Localhost will not show img in php file

28 views
Skip to first unread message

Marty

unread,
Nov 7, 2012, 2:25:56 PM11/7/12
to
I have a web page that is a .php file. I can view it on localhost (I use
ubuntu) and it looks fine. However, there are some img src tags with a
header image and a few other images. They do not display. The alt text
displays and there is space carved out in the displayed page. But the
images will not show up. I have put them in the same folder as the .php
file, tried them in separate folders, it does not matter as the results
are the same.

As an .HTML page everything shows up fine in the browser (not under
localhost).

I have not been on this newsgroup for a long time. But, I have never
failed to find the solutions I need when I did come here for help. Any
suggestions?

Jerry Stuckle

unread,
Nov 7, 2012, 4:28:18 PM11/7/12
to
The browser doesn't know anything about PHP. Your problem is in your
html. Try asking in alt.html. And be sure to post the appropriate html
code.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

Marty

unread,
Nov 7, 2012, 5:53:38 PM11/7/12
to
On Wed, 07 Nov 2012 16:28:18 -0500, Jerry Stuckle wrote:

> On 11/7/2012 2:25 PM, Marty wrote:
>> I have a web page that is a .php file. I can view it on localhost (I
>> use ubuntu) and it looks fine. However, there are some img src tags
>> with a header image and a few other images. They do not display. The
>> alt text displays and there is space carved out in the displayed page.
>> But the images will not show up. I have put them in the same folder as
>> the .php file, tried them in separate folders, it does not matter as
>> the results are the same.
>>
>> As an .HTML page everything shows up fine in the browser (not under
>> localhost).
>>
>> I have not been on this newsgroup for a long time. But, I have never
>> failed to find the solutions I need when I did come here for help. Any
>> suggestions?
>>
>>
> The browser doesn't know anything about PHP. Your problem is in your
> html. Try asking in alt.html. And be sure to post the appropriate html
> code.

But the browser displays a webpage.php just fine. Just so I am clear
about what you mean. Are you saying that the code in the page is html
code and the fact that this .php page does not show an img src tag is
really an html problem and not a php problem? The php code, such that
there is, executes just fine (I have a php include that does work).

Denis McMahon

unread,
Nov 7, 2012, 10:28:00 PM11/7/12
to
Are you running a web browser (maybe apache) on localhost and connecting
to http://localhost/filename.php to view the php page?

If not, how are you viewing it on localhost?

To see the output from the php, you need to have a web browser that knows
about php running on the server (which in this case is localhost) and
request the php page from that webserver.

The webserver then sees that the file is a .php file, calls the php
processor to process the file, takes the output from the php processor
and sends it to the requesting client as the web page.

Technically a php file referenced by url on a webserver is a resource
that generates a web page (or something else - it could deliver a file or
send dynamically generated binary content of some sort) when it is
processed by the php script processor, and not a web page (although
mostly they seem to be used to generate (x)html web pages).

I mention all of this as an incorrect use of the terminology often
indicates a lack of understanding of the processes involved, and if you
don't understand the processes involved, it's not impossible that you
haven't get things set up correctly for what you want to do.

Rgds

Denis McMahon
0 new messages