I have just typed the following into the text editor. <?php phpinfo(); ?> How do I now save the file and exit?

Asked by lois on 2010-05-19

I have just typed the following into the text editor. <?php phpinfo(); ?>
How do I now save the file and exit? I've tried ^Y nothing seems to be happening
(Trying to install and configure LAMP using these instructions http://tuxtweaks.com/2010/04/installing-lamp-on-ubuntu-10-04-lucid-lynx/)

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
arochester
Solved:
2010-05-21
Last query:
2010-05-21
Last reply:
2010-05-20
lois (louisejboyd) said : #1

using gedit I get this error:
Could not save the file /var/www/testphp.php.
You do not have the permissions necessary to save the file. Please check that you typed the location correctly and try again.

peter b (b1pete) said : #2

lois, pls use in a terminal if you want it in your home folder

gedit testphp.php

the file can be saved by using file-->save. if elsewhere enter in the file system pls use

sudo gedit /xxxx/yyyyy/....../testphp.php

use sudo and the full path before file name ie /xxxx/yyyyy/..../file name

then enter your psswd when prompted; the editor opens, enter your script/text then file-->save. that's it.

lois (louisejboyd) said : #3

HI Peter b

thanks for your reply. unfortunately still struggling. I'm not sure I follow, are you suggesting there is a problem with the location of the file? I thought it was a problem with my not having permission to save the file...?

I have typed gedit testphp.php into the terminal which then brings up the text editor and now it is coming up with bad flag errors.

Also tried saving the file to the home folder and it denies permission.

lois (louisejboyd) said : #5

Thanks, have tried using nano now and it gives the following error:

Error opening file '/var/www/testing.php': Permission denied

lois (louisejboyd) said : #6

thanks I think this may have worked but now having trouble with this one
"Now go back to your web browser and enter the address http://localhost/testing.php/. You should see a page displaying version information for your php installation."

should I be typing in something else other than localhost? if so what/ how do I get it? (sorry I'm a newbie)

lois (louisejboyd) said : #7

basically i type in http://localhost/testing.php/ into my browser google chrome and it comes up blank, no error or anything

Best arochester (arochester) said : #8

If you just open gedit, write text and try to save it will not let you because you do not have the correct permissions

You need to open gedit with the permissions and it should let you save.

With an app which starts and stays in the Terminal you use the command: sudo

With an app which can start in the Terminal - but opens another app, like gedit - you use the command:gksudo

When the instructions say "sudo nano /var/www/testing.php" the file at /var/www/testing.php might not exist yet, but you are creating it.

SO! Use the command: gksudo gedit /var/www/testing.php

Enter the text, save and exit.

When this is done you should be able to use your File Manager to negotiate /var/www/testing.php where you should see this file, with the text.

lois (louisejboyd) said : #9

Thanks arochester, that solved my question.