where to put html,php,mysql,css files?

Discussion in 'Web Server' started by RICH_S_WEB, Jul 20, 2013.

  1. RICH_S_WEB

    RICH_S_WEB New Member

    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    1
    Hi. My knowledge of computers is very limited so can you make any response as simple as possible please.

    I have a raspberry pi running the rasbpian linux. I've managed to install phpmyadmin, apache2 and mysql etc.


    I'm trying to learn to build websites using php, MySQL, html and css.

    I just want to check some code out to see if it works. I have located where the /var/www bit is in file manager which has a file called index.html. When I open this file with the Linux web browser it comes up with 'It works! This is the default web page for this server. The web server software is running but no content has been added, yet. Where on my computer do I save files to be able to change the index.html to some html I have written? When I try to save files to the /var/www bit in file manager it comes back with 'can't open file to write'. I save the file in leafpad as say myfirstparagraph.html or try to edit index.html in leafpad and save it but it just keeps coming back with 'can't open file to write'. My raspberry pi is connected to the internet.
    Can someone help please.

    Thanks
  2. McPhee

    McPhee New Member

    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    3
    Hi RSW,
    Generally the /var/www directory is owned by the "root" user on a default apache install (via package manager). The first thing to check would be the ownership/permissions on that directory and the files within it.

    Alternatively, you could create a new VirtualHost and configure its DocumentRoot to point to a directory owned by your user.

    I'm not familiar with the pi Linux flavor or it default setup, but hopefully this points you in the right direction.
  3. Pyplate

    Pyplate New Member

    Messages:
    15
    Likes Received:
    5
    Trophy Points:
    3
    McPhee's right, files in /var/www are owned by the root user by default. You're probably logged in as user pi, so you don't have the correct permissions to modify index.html. Try opening a terminal window, and typing

    Code:
    sudo leafpad /var/www/index.html
    The sudo command means you're opening leafpad with root privileges. Now when you make changes you'll be able to save them. When you copy files to /var/www using the cp command, you'll have to use sudo again.

Share This Page