[SOLVED] how to save a file so that it can be opened in localhost
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to save a file so that it can be opened in localhost
Am trying to rewire my brain circuits to use Linux instead of Windows. I installed a LAMP server (on Ubuntu 11.04) I get the "It works!" file from http://localhost/
I see the file path that leads to the default page: (index.html) in File System/var/www/index.html
When, using gedit, I attempt to save another file (test.php) in .../var/www/ , the system tells me it could not save the file, and that I don't have the required permissions.
It doesn't ask me for a password to allow me to save the file there.
Thanks for your kind replies. Please know that you are writing to a new Linux user. Let me explain my problem in a different way. Using Windows, any .html file can be opened in a browser. To open a .php file however, that file must be in the htdocs file in a XAMPP server, and the browser must access it through http://localhost
I am assuming the Linux var/www folder is like the Windows htdocs folder.
My question is, how do I, using Ubuntu, save a file (be it made in gedit or an IDE such as Quanta Plus) named test.php to the var/www folder [so that it can be opened using localhost]?
When I use the above command, it moves the file (test.php) to the /var/www/ folder. I can see that it is in that folder, and not corrupt. When I use localhost to open the .html file, it displays properly in the browser ("It works"). However, when I change the address to http://localhost/test.php, I get a popup that asks "What should Firefox do with this file?" I tried a second .php file, and it was moved to the /var/www/ folder, but again, the same popup appears instead of the web page.
Sadly, the sarcastic response you'd expect from a frustrated rookie is not given as an option in the popup.
My guess is that PHP is not installed/activated/working in LAMP. Is this a reasonable assumption, and if it is, should I start over and re-install LAMP?
I don't have LAMP installed on Ubuntu but the other Linux systems I have used always had these file in either /var/www/htdocs or /var/www/html. I guess that's not the case with Ubuntu?
Quote:
My guess is that PHP is not installed/activated/working in LAMP
I would guess that your guess is correct. There is something wrong with the php configuration but the problem is it could be any number of things. Wrong Document Root in php.ini, needed php modules not loaded as well as others.
What method did you use to install LAMP. The link below gives what looks like the simplest way?
Usually, as indicated in a couple of the posts in your link, restarting Apache works. Any time you modify configuration files you need to restart Apache.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.