Re: cannot execute img src in localhost

Discussion in 'HTML' started by Jonathan N. Little, Nov 8, 2012.

  1. Marty wrote:
    > I have a web page that is webpage.php. It shows up fine in localhost
    > (ubuntu) except for the graphics. The header image, which is an img src,
    > shows the alt text and carves out a space for the image. But the image
    > does not show.
    >
    > If I change the page to .html I can see everything in the browser. But, I
    > cannot execute the .html page on local host at all.


    PHP is server side scripting where it outputs html. It sounds like you
    have invalid PHP code.

    >
    > I tried asking in a php group but they said this is really a problem with
    > the html not functioning.


    Probably not. If just changing the file extension to .html fixes your
    problem then what your problem is most likely is that you are not
    writing PHP code but HTML markup.

    >
    > Any suggestions?
    >


    Post the the source code.


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Nov 8, 2012
    #1
    1. Advertising

  2. Marty wrote:
    > On Wed, 07 Nov 2012 20:46:21 -0500, Jonathan N. Little wrote:
    >
    >> Marty wrote:
    >>> I have a web page that is webpage.php. It shows up fine in localhost
    >>> (ubuntu) except for the graphics. The header image, which is an img
    >>> src, shows the alt text and carves out a space for the image. But the
    >>> image does not show.
    >>>
    >>> If I change the page to .html I can see everything in the browser. But,
    >>> I cannot execute the .html page on local host at all.

    >>
    >> PHP is server side scripting where it outputs html. It sounds like you
    >> have invalid PHP code.
    >>
    >>
    >>> I tried asking in a php group but they said this is really a problem
    >>> with the html not functioning.

    >>
    >> Probably not. If just changing the file extension to .html fixes your
    >> problem then what your problem is most likely is that you are not
    >> writing PHP code but HTML markup.
    >>
    >>
    >>> Any suggestions?
    >>>
    >>>

    >> Post the the source code.

    >
    > I can save it as .html or .php and the results are the same. I can see
    > everything formatted perfectly and I can see the alt text as well as the
    > placeholder for the image. But the image does not display.
    >
    > To simplify troubleshooting, I put the image and the source file in the
    > same folder var/www. I use BlueFish editor and the preview or browser
    > button is set up to display the file in LocalHost.
    >
    > I edited the source file to get rid of as much crap as possible and still
    > maintain the problem section:
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    > <html>
    > <head>
    > <title>My Title</title>
    > <meta name="description" content="My Descsription">
    > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    > <meta name="msvalidate.01" content="5D6F360E7CD47C4B14275762DBC20BAA">
    > <link href="mystyle.php" rel="stylesheet" type="text/css">
    >
    > </head>
    > <body>
    > <div align="center">
    > <table class="black_tableoutline" bgcolor="#FFFFFF" width="960">
    > <tbody>
    >
    > <tr style="height: 60px; text-align: center;">
    > <th height="484" valign="top" width="83%">
    > <p align="center">
    > <img src="problemfile.jpg" alt="problem image" height="220"
    > width="700">
    > </p>
    > <table align="center" bgcolor="#eef3f9" height="40"
    > width="676" border="0">
    > <tbody>
    > <tr>
    > <td class="style25" height="36" valign="top"
    > width="601"><span
    > class="gobanner">Some Text
    > ..</span>. </td>
    > <td class="style25" valign="top" width="150"><img
    > src="orange_go_btn34.jpg"
    > alt="" align="left" height="34" width="112"></td>
    > </tr>
    > </tbody>
    > </table>
    >
    > </div>
    > </body>
    > </html>
    >


    Okay there is your answer. That is HTML markup not PHP code. PHP code
    would be something like this:


    <?php

    $A_PHP_Variable="I am a variable";
    $A_num=5;
    $Double_Me=$A_num * 2;

    echo "<p>Creating HTML with PHP and $A_num doubled is $Double_Me</p>";

    ?>



    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Nov 8, 2012
    #2
    1. Advertising

  3. Jonathan N. Little

    se Guest

    "Marty" <> skrev i meddelelsen
    news:509b1f50$0$58015$c3e8da3$...
    > On Wed, 07 Nov 2012 20:46:21 -0500, Jonathan N. Little wrote:
    >
    >> Marty wrote:
    >>> I have a web page that is webpage.php. It shows up fine in localhost
    >>> (ubuntu) except for the graphics. The header image, which is an img
    >>> src, shows the alt text and carves out a space for the image. But the
    >>> image does not show.
    >>>
    >>> If I change the page to .html I can see everything in the browser. But,
    >>> I cannot execute the .html page on local host at all.

    >>
    >> PHP is server side scripting where it outputs html. It sounds like you
    >> have invalid PHP code.
    >>
    >>
    >>> I tried asking in a php group but they said this is really a problem
    >>> with the html not functioning.

    >>
    >> Probably not. If just changing the file extension to .html fixes your
    >> problem then what your problem is most likely is that you are not
    >> writing PHP code but HTML markup.
    >>
    >>
    >>> Any suggestions?
    >>>
    >>>

    >> Post the the source code.

    >
    > I can save it as .html or .php and the results are the same. I can see
    > everything formatted perfectly and I can see the alt text as well as the
    > placeholder for the image. But the image does not display.
    >
    > To simplify troubleshooting, I put the image and the source file in the
    > same folder var/www. I use BlueFish editor and the preview or browser
    > button is set up to display the file in LocalHost.
    >
    > I edited the source file to get rid of as much crap as possible and still
    > maintain the problem section:
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    > <html>
    > <head>
    > <title>My Title</title>
    > <meta name="description" content="My Descsription">
    > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    > <meta name="msvalidate.01" content="5D6F360E7CD47C4B14275762DBC20BAA">
    > <link href="mystyle.php" rel="stylesheet" type="text/css">
    >
    > </head>
    > <body>
    > <div align="center">
    > <table class="black_tableoutline" bgcolor="#FFFFFF" width="960">
    > <tbody>
    >
    > <tr style="height: 60px; text-align: center;">
    > <th height="484" valign="top" width="83%">
    > <p align="center">
    > <img src="problemfile.jpg" alt="problem image" height="220"
    > width="700">
    > </p>
    > <table align="center" bgcolor="#eef3f9" height="40"
    > width="676" border="0">
    > <tbody>
    > <tr>
    > <td class="style25" height="36" valign="top"
    > width="601"><span
    > class="gobanner">Some Text
    > ..</span>. </td>
    > <td class="style25" valign="top" width="150"><img
    > src="orange_go_btn34.jpg"
    > alt="" align="left" height="34" width="112"></td>
    > </tr>
    > </tbody>
    > </table>
    >
    > </div>
    > </body>
    > </html>


    <link href="mystyle.php" rel="stylesheet" type="text/css">
    A stylesheet must have the extention .css
    se, Nov 8, 2012
    #3
  4. 2012-11-08 7:18, "se", using a forged address, wrote:

    > <link href="mystyle.php" rel="stylesheet" type="text/css">
    > A stylesheet must have the extention .css


    Nonsense. As long as the HTTP headers specify Content-Type: text/css,
    any conforming browser will treat the data as CSS.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Nov 8, 2012
    #4
  5. Jonathan N. Little

    Lewis Guest

    In message <k7ffae$8of$>
    se <> wrote:

    > <link href="mystyle.php" rel="stylesheet" type="text/css">
    > A stylesheet must have the extention .css


    What idiot told you that?

    No, a stylesheet can have any name at all, and any (or no) extension.


    --
    For more than a thousand generations the Jedi were the guardians of
    peace and justice in the galaxy. Before the dark times. Before the
    Empire.
    Lewis, Nov 8, 2012
    #5
  6. Jonathan N. Little

    Tim Streater Guest

    In article <509b1f50$0$58015$c3e8da3$>,
    Marty <> wrote:

    > >> I tried asking in a php group but they said this is really a problem
    > >> with the html not functioning.


    There is no php in what you have posted.

    > I edited the source file to get rid of as much crap as possible and still
    > maintain the problem section:
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    > <html>
    > <head>
    > <title>My Title</title>
    > <meta name="description" content="My Descsription">
    > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    > <meta name="msvalidate.01" content="5D6F360E7CD47C4B14275762DBC20BAA">
    > <link href="mystyle.php" rel="stylesheet" type="text/css">
    >
    > </head>
    > <body>
    > <div align="center">
    > <table class="black_tableoutline" bgcolor="#FFFFFF" width="960">
    > <tbody>


    This table and tbody are not closed.

    > <tr style="height: 60px; text-align: center;">


    This table row is not closed.

    > <th height="484" valign="top" width="83%">


    This th is not closed.

    --
    Tim

    "That excessive bail ought not to be required, nor excessive fines imposed,
    nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
    Tim Streater, Nov 8, 2012
    #6
  7. On Thu, 08 Nov 2012 02:56:17 +0000, Marty wrote:

    > I edited the source file to get rid of as much crap as possible and
    > still maintain the problem section:


    No you didn't. If the problem is displaying the image, then it should be
    apparent in the following (and arguably the <p> and </p> could be
    omnitted):

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>My Title</title>
    </head>
    <body>
    <p>
    <img src="problemfile.jpg" alt="problem image" height="220"
    width="700">
    </p>
    </body>
    </html>

    As a general observation, if you use a content-type http pseudo header in
    the document head, some people suggest that best practice is to place it
    as the first element in the <head>, as it may require that the document
    be re-parsed - the sooner the browser can make this decision the less
    time it wastes parsing stuff that will become redundant when it starts
    again.

    Also - as an aside - in a "normal"[1] apache web server + php
    configuration, if a file called something.php contains only html markup
    and no <?php ... ?> code sections, the php processor will pass it
    unaltered to the web server process for sending to the requesting client.

    [1] every configuration is different, but there are some things that most
    configurations will do the same way.

    Rgds

    Denis McMahon
    Denis McMahon, Nov 8, 2012
    #7
  8. Jonathan N. Little

    Tim Streater Guest

    In article <509bd4db$0$3987$c3e8da3$>,
    Marty <> wrote:

    > Forget the code above. I see it has a lot of distracting elements. Here
    > is an HTML file. The problem is the same. I cannot display the image in
    > LocalHost. By the way, the same code will display properly on a browser.
    > It just will not work with localhost. So, I do not think it is an html
    > problem at all. Know of any newsgroups that could help with a localhost
    > problem?
    >
    > Could it be the doctype statement?


    I only ever do this:

    <!DOCTYPE html>

    as it's unclear to me why I'd do anything else.

    > By the way, you most certainly can have a .php for a css file. Doing so
    > enables you to do lot of other things as well. It works perfectly in a
    > regular browser.
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    > <html>
    > <head>
    > <title>My Title</title>
    > <meta name="description" content="My Descsription">
    > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


    Missing </head> (not that it matters, most likely).

    > <body>
    > <img src="problemimage.jpg" alt="problem image"
    > height="220" width="700">
    > </body>
    > </html>


    It would help to know what you mean by "I cannot display the image in
    LocalHost". Do you mean that you have the html file, and the problem
    image, on for example your desktop and then double-click the html file?

    Or are you running apache on your machine, with the image and html files
    in the proper place so that you can put http://localhost/problem.html
    into your browser?

    --
    Tim

    "That excessive bail ought not to be required, nor excessive fines imposed,
    nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
    Tim Streater, Nov 8, 2012
    #8
  9. 2012-11-08 18:15, Tim Streater wrote:

    > Or are you running apache on your machine, with the image and html files
    > in the proper place so that you can put http://localhost/problem.html
    > into your browser?


    That seems to be the natural interpretation. Now, we might conjecture
    that the server software sends wrong information in HTTP headers. We
    just need to hack into the OP's system to check that... wait a sec...

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Nov 8, 2012
    #9
  10. Marty wrote:
    > Forget the code above. I see it has a lot of distracting elements. Here
    > is an HTML file. The problem is the same. I cannot display the image in
    > LocalHost. By the way, the same code will display properly on a browser.
    > It just will not work with localhost. So, I do not think it is an html
    > problem at all. Know of any newsgroups that could help with a localhost
    > problem?



    Wait a minute, by the above are you saying that it works if your view is
    using your local filesystem but fails using the server? IOW

    file:///var/www/thepage.html

    works but

    http://localhost/thepage.html

    doesn't?

    If so then that would point to a problem with your server configuration.
    You need to check out your /etc/apache2/httpd.conf


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Nov 8, 2012
    #10
  11. On Thu, 08 Nov 2012 15:50:51 +0000, Marty wrote:

    > Know of any newsgroups that could help with a localhost
    > problem?


    First of all, there is no such thing as a localhost problem, the problem
    is either with your local webserver configuration, or with your html. Do
    you even have a local webserver running?

    Please try the following shell command:

    sudo ps -A | grep apache

    You should see something like:

    1269 ? 00:03:17 apache2
    9231 ? 00:00:00 apache2
    9232 ? 00:00:00 apache2
    9238 ? 00:00:00 apache2
    9239 ? 00:00:00 apache2
    9243 ? 00:00:00 apache2
    9661 ? 00:00:00 apache2
    9750 ? 00:00:00 apache2
    10175 ? 00:00:00 apache2
    10176 ? 00:00:00 apache2
    10597 ? 00:00:00 apache2

    If that shows several entries, then the webserver seems to be running.
    Try typing the following 2 lines, both followed by return (note there may
    be no visible response to the 'nc localhost 80', just type the GET
    anyway.):

    nc localhost 80
    GET /webpage.php

    This should display the content that your php file generates and delivers
    via the webserver.

    If the 'nc localhost 80' returns a normal (eg name@host$) prompt, then
    it's possible your webserver, although running, isn't active on the
    expected port.

    Try the following command:

    sudo netstat -t -l -p -v | grep http

    This should output a line similar to the one below (the 1269 will
    probably be a different number, and I've trimmed some whitespace):

    tcp 0 0 *:http *:* LISTEN 1269/apache2

    Finally, try opening the browser and enter the following in the location
    bar:

    http://localhost/name.ext

    Where name.ext is the name and extension of your image file. If the image
    file is in the root directory of the web server, then it should display
    in the browser. If it does not display, then either:

    a) There's no browser running
    b) The file is not where the server is looking for it

    Rgds

    Denis McMahon
    Denis McMahon, Nov 8, 2012
    #11
  12. Marty wrote:

    > I get You don't have permission to access /imagefile.jpg on this server.
    > When I do localhost/imagefile.jpg
    >


    Your server is not setup properly. This is not an HTML problem this is a
    Apache server setup problem, (assuming your are using Apache). Or your
    have a permission problem, for example you put the file with your
    profile and image is neither wwwdata user or group (marty:marty) OR your
    file is not world readable (660).


    sudo chown -R wwwdata:wwwdata /var/www/*

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Nov 9, 2012
    #12
  13. Marty wrote:
    > On Thu, 08 Nov 2012 20:25:10 -0500, Jonathan N. Little wrote:
    >
    >> Marty wrote:
    >>
    >>> I get You don't have permission to access /imagefile.jpg on this
    >>> server.
    >>> When I do localhost/imagefile.jpg
    >>>
    >>>

    >> Your server is not setup properly. This is not an HTML problem this is a
    >> Apache server setup problem, (assuming your are using Apache). Or your
    >> have a permission problem, for example you put the file with your
    >> profile and image is neither wwwdata user or group (marty:marty) OR your
    >> file is not world readable (660).
    >>
    >>
    >> sudo chown -R wwwdata:wwwdata /var/www/*

    >
    > I know next to nothing about linux commands. Is it a chown I need to use
    > or a chmod? Is the syntax you show here correct?
    >

    chown changes the owner and group

    chmod change the permission for owner, group, and world.

    Depends on what you need to do. I am assuming that your server's
    document root is /var/www if so then post the output of the following:

    ls -lha /var/www

    if your document root is different change accordingly

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Nov 9, 2012
    #13
  14. Marty <> writes:

    > On Thu, 08 Nov 2012 20:25:10 -0500, Jonathan N. Little wrote:
    >
    >> Marty wrote:
    >>
    >>> I get You don't have permission to access /imagefile.jpg on this
    >>> server.
    >>> When I do localhost/imagefile.jpg
    >>>
    >>>

    >> Your server is not setup properly. This is not an HTML problem this is a
    >> Apache server setup problem, (assuming your are using Apache). Or your
    >> have a permission problem, for example you put the file with your
    >> profile and image is neither wwwdata user or group (marty:marty) OR your
    >> file is not world readable (660).
    >>
    >>
    >> sudo chown -R wwwdata:wwwdata /var/www/*

    >
    > I know next to nothing about linux commands. Is it a chown I need to use
    > or a chmod? Is the syntax you show here correct?


    Yes, chown not chmod (though if things are really screwed you might need
    that as well) and, yes, the syntax is correct. It's something of a
    sledgehammer, but with little information to go on it seems like a good
    start. He's assuming that there is some permission problem and the
    easiest solution is to make everything owned by the user id that the
    apache server uses (that's wwwdata). The ":wwwdata" bit also sets the
    group id that owns the files which is probably overkill, but won't do
    any harm.

    The meta answer is to type man sudo and then man chown. You won't
    understand all of what you see but, in general, the basics are up the
    top so you can read until you get baffled. Do that enough and you'll
    find you don't get baffled so much after a while.

    --
    Ben.
    Ben Bacarisse, Nov 9, 2012
    #14
  15. Ben Bacarisse wrote:
    > Marty <> writes:
    >
    >> On Thu, 08 Nov 2012 20:25:10 -0500, Jonathan N. Little wrote:
    >>
    >>> Marty wrote:
    >>>
    >>>> I get You don't have permission to access /imagefile.jpg on this
    >>>> server.
    >>>> When I do localhost/imagefile.jpg
    >>>>
    >>>>
    >>> Your server is not setup properly. This is not an HTML problem this is a
    >>> Apache server setup problem, (assuming your are using Apache). Or your
    >>> have a permission problem, for example you put the file with your
    >>> profile and image is neither wwwdata user or group (marty:marty) OR your
    >>> file is not world readable (660).
    >>>
    >>>
    >>> sudo chown -R wwwdata:wwwdata /var/www/*

    >>
    >> I know next to nothing about linux commands. Is it a chown I need to use
    >> or a chmod? Is the syntax you show here correct?

    >
    > Yes, chown not chmod (though if things are really screwed you might need
    > that as well) and, yes, the syntax is correct.


    Yes is is possible to have it work with neither the owner or the group
    set to wwwdata if world is set to read. But

    -rw-rw---- marty marty imagefile.jpg

    would give him the problem that he is experiencing and simply turning on
    world read would fix it.

    More info would help and that is why I ask for a listing of the dir. For
    a private server to make thing easier to edit locally there are things
    you can do to simplify the process. If you access the server from
    Windows workstations you can make a samba share to the document root and
    used "force group = wwwdata". Or if you access from Linux on the local
    machine then edit apache config to set
    "export APACHE_RUN_GROUP=marty"

    Just depends on his situation.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Nov 9, 2012
    #15
  16. On Thu, 08 Nov 2012 20:25:10 -0500, Jonathan N. Little wrote:

    > sudo chown -R wwwdata:wwwdata /var/www/*


    Bad advice.

    He said he's using Ubuntu. On my Ubuntu server, the web user is www-data,
    not wwwdata! This was the default user name set up by the installer.

    What he could do is either of the following:

    Method:

    Easy Method A makes all the files in the /var/www tree the property of
    the apache process.

    1) sudo cat /etc/passwd | grep www

    Hopefully there's only one line, and it will look something like:

    www-user:x:999:999:www-group:/var/www:/bin/sh

    The fields are separated by the colon characters.

    user name : password : user id : group id : group name : home : shell

    A password of "x" means an encrypted password is stored in another file.

    2) Get the user name and group name from above line (which in this case
    is www-user:www-group)

    3) sudo chown -R wwwdata:wwwdata /var/www/*

    Easy Method B:

    Method B allows anyone to read all the files in the /var/www tree,
    regardless of who actually owns them.

    sudo chmod -R w+r /var/www/*

    There are other methods, but they all require more knowledge of linux
    users, groups and permissions than I'm prepared to contemplate getting
    into with Marty here.

    Rgds

    Denis McMahon
    Denis McMahon, Nov 9, 2012
    #16
  17. "Jonathan N. Little" <> writes:

    > Ben Bacarisse wrote:
    >> Marty <> writes:
    >>
    >>> On Thu, 08 Nov 2012 20:25:10 -0500, Jonathan N. Little wrote:
    >>>
    >>>> Marty wrote:
    >>>>
    >>>>> I get You don't have permission to access /imagefile.jpg on this
    >>>>> server.
    >>>>> When I do localhost/imagefile.jpg
    >>>>>
    >>>>>
    >>>> Your server is not setup properly. This is not an HTML problem this is a
    >>>> Apache server setup problem, (assuming your are using Apache). Or your
    >>>> have a permission problem, for example you put the file with your
    >>>> profile and image is neither wwwdata user or group (marty:marty) OR your
    >>>> file is not world readable (660).
    >>>>
    >>>>
    >>>> sudo chown -R wwwdata:wwwdata /var/www/*
    >>>
    >>> I know next to nothing about linux commands. Is it a chown I need to use
    >>> or a chmod? Is the syntax you show here correct?

    >>
    >> Yes, chown not chmod (though if things are really screwed you might need
    >> that as well) and, yes, the syntax is correct.

    >
    > Yes is is possible to have it work with neither the owner or the group
    > set to wwwdata if world is set to read. But
    >
    > -rw-rw---- marty marty imagefile.jpg
    >
    > would give him the problem that he is experiencing and simply turning
    > on world read would fix it.


    Sure, but (to rather labour this detail) my point about maybe needing
    both is just that if user and group read permission are missing,
    changing the owner won't do it.

    > More info would help and that is why I ask for a listing of the
    > dir.


    Absolutely. Further hints can also come from the error log.

    To the OP: have a look at the error log. On my setup I just do

    tail /var/log/apache2/error.log

    to see that last few entries. When there is a misconfiguration you
    might get lots of errors, in which case viewing the whole file is more
    useful.

    <snip>
    --
    Ben.
    Ben Bacarisse, Nov 9, 2012
    #17
  18. Denis McMahon <> writes:

    > On Thu, 08 Nov 2012 20:25:10 -0500, Jonathan N. Little wrote:
    >
    >> sudo chown -R wwwdata:wwwdata /var/www/*

    >
    > Bad advice.
    >
    > He said he's using Ubuntu. On my Ubuntu server, the web user is www-data,
    > not wwwdata!


    Well spotted!

    > This was the default user name set up by the installer.
    >
    > What he could do is either of the following:
    >
    > Method:
    >
    > Easy Method A makes all the files in the /var/www tree the property of
    > the apache process.
    >
    > 1) sudo cat /etc/passwd | grep www


    Or just "sudo grep www /etc/passwd". Indeed, on my default install (and
    I think on many) there's no need for the sudo since /etc/passwd is
    readable by all.

    > Hopefully there's only one line, and it will look something like:
    >
    > www-user:x:999:999:www-group:/var/www:/bin/sh


    Just to clarify (since the OP is new to this) you are most likely to see
    www-data in both places.

    > The fields are separated by the colon characters.
    >
    > user name : password : user id : group id : group name : home : shell
    >
    > A password of "x" means an encrypted password is stored in another file.
    >
    > 2) Get the user name and group name from above line (which in this case
    > is www-user:www-group)
    >
    > 3) sudo chown -R wwwdata:wwwdata /var/www/*


    I think you meant to edit that!

    > Easy Method B:
    >
    > Method B allows anyone to read all the files in the /var/www tree,
    > regardless of who actually owns them.
    >
    > sudo chmod -R w+r /var/www/*


    I think you meant:

    sudo chmod -R o+r /var/www/*

    > There are other methods, but they all require more knowledge of linux
    > users, groups and permissions than I'm prepared to contemplate getting
    > into with Marty here.


    It's a nightmare trying to guess what might or might not be wrong here.
    I am still not convinced it's a file permission or ownership thing,
    since the defaults work without change (at least on my setup) but
    something is wrong so permissions do need to be checked.

    --
    Ben.
    Ben Bacarisse, Nov 9, 2012
    #18
  19. On Fri, 09 Nov 2012 13:10:16 +0000, Ben Bacarisse wrote:

    > Denis McMahon <> writes:


    >> 2) Get the user name and group name from above line (which in this case
    >> is www-user:www-group)
    >>
    >> 3) sudo chown -R wwwdata:wwwdata /var/www/*

    >
    > I think you meant to edit that!


    Yes, it should have been something like:

    3) Use the following, substituting the user name and group name from step
    2 for user and group:

    sudo chown -R user:group /var/www/*

    >> sudo chmod -R w+r /var/www/*

    >
    > I think you meant:
    >
    > sudo chmod -R o+r /var/www/*


    Damn it, I'm on a roll today. :(

    Yes, I did, and in my defence, I still make the w+r (world+read) mistake
    myself regularly, especially if I haven't had to chmod anything for a few
    days.

    Rgds

    Denis McMahon
    Denis McMahon, Nov 9, 2012
    #19
  20. Jonathan N. Little

    se Guest

    "Lewis" <> skrev i meddelelsen
    news:...
    > In message <k7ffae$8of$>
    > se <> wrote:
    >
    >> <link href="mystyle.php" rel="stylesheet" type="text/css">
    >> A stylesheet must have the extention .css

    >
    > What idiot told you that?


    A .php extention won't work together with a rel="stylesheet"
    At least not in EW2. I just made a trial. You should do.

    >
    > No, a stylesheet can have any name at all, and any (or no) extension.
    >
    >
    > --
    > For more than a thousand generations the Jedi were the guardians of
    > peace and justice in the galaxy. Before the dark times. Before the
    > Empire.
    se, Nov 9, 2012
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Richter

    <txt src= ...> equivalent of <img src= ...>

    Steve Richter, Feb 8, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,061
    Laurent Bugnion
    Feb 9, 2006
  2. Greg Johnson
    Replies:
    4
    Views:
    3,049
  3. pheadxdll
    Replies:
    16
    Views:
    3,613
    Neredbojias
    Jun 6, 2007
  4. Ben Bacarisse

    Re: cannot execute img src in localhost

    Ben Bacarisse, Nov 8, 2012, in forum: HTML
    Replies:
    0
    Views:
    468
    Ben Bacarisse
    Nov 8, 2012
  5. Ian
    Replies:
    0
    Views:
    411
Loading...

Share This Page