VI command and permissions to /srv aka lamp issue

Hello there i am trying to test and see if my php5 works but i cannot seem to create a file to see if php works aka
or however you type it but i do vi /srv/www/htdocs/file.php to create the file and it opens up great but it doesn’t let me type anything in there lol i right clicked it and set the input method to none then i can type but i cant save i tried :w and XX but it tells me it cannot make changes to the file in bright red ? am i doing something wrong? also i need to install phpmyadmin so i am trying to save the install file to /srv/www/htdocs and then extract it in there aka
mv phpMyAdmin-3.3.4-all-languages phpmyadmin

or what not but i don’t have permission to the directory i am not using my laptop as my hosting device lol thats why i pay for dedi hosting i just want to install lamp to my computer with port 80 blocked etc… just to mess around with php coding so is there any way just to raise permissions to /srv so i can just create files in there since it is in the user group root? lol i know this might seem dumb but i really really dont want to turn my machine into windows xp permission’s basically lol i am so close to going to /etc/sysconfig displaymanager and changing my DISPLAYMANAGER_ROOT_LOGIN_REMOTE=“no” to say yes LOL i know this sounds dumb but i am only using this laptop for 1 thing only just to code php i don’t play games on this i don’t browse the web nothing just trying to set up lamp to experiment with php so can someone please help me?

Ignorance is not laughing matter – LOL!

To get meaningful assistance tell us whic openSuSE version and desktop environment (if any) you have installed.

Software (e.g. phpMyAdmin) is best installed via YaST >> Software >> Software Management.
Install the pattern Web and LAMP Server.

Read a basic book such as “Webmaster in a Nutshell”.

If you want to set up a web server, create a folder and change its ownership to the webmaster’s username (your own?).

you@localhost:~> su -
localhost:~ # mkdir /serv/www/vhosts.d
localhost:~ # chown you  /serv/www/vhosts.d
localhost:~ # exit

and create *DocumentRoot * for each of your websites within /serv/www/vhosts.d.

Users on Unix and Linux systems generally have their own personal web-sites with the DocumentRoot in ~/public_html or somesuch.
If you just want to practice then place your scripts in ~/public_html and view the results in a browser via http://localhost/~you/.

you@localhost:~> echo "<?php phpinfo() ?>" > ~/public_html/phpinfo.php
you@localhost:~> su - sudo /usr/sbin/rcapache2 start
you@localhost:~> w3m http://localhost/~you

BTW, this is not valid PHP for a long time allready. You should use tthe long <?php version of the PHP tag.

i greatly appreciate the help guys i am running opensuse 12.1 gnome environment eng-int i really appreciate your help i mean thank you this solved all of my problems :slight_smile: and as for webmaster in a nutshell i am googling that as we speak thanks for the suggestion. and hcvv i am currently reading php5 fast and easy web development they have not told me it isnt valid instead they are teaching me to use that tag and <script language=“php”> </script> tag may i ask you if you think i should pick up a different book? lol i don’t want to learn things that are not valid lol but thank you for your input i really do appreciate it :slight_smile: also should i be turning on apache 2 a different way then sudo /etc/init.d/apache2 start? lol just curious :slight_smile:

Strange book you have. The short form <? ?> is not supported by default in recent PHP versions. The normal form <?php ?> is, as is the official long form <script …></script> which I have never seen used in practice. Sorry I don’t have any recommendations for a better book.

You don’t have to keep starting and restarting Apache. Use YaST to make it start at boot and leave it running. In particular you don’t have to restart Apache if you have just edited a script. The only times you have to restart Apache with PHP is if you have modified php.ini or have installed another PHP module.

it is okay ken_yap that you don’t have any recommendations for a better book i greatly appreciate your input :slight_smile: and thanks i am looking in yast to make my apaache start at boot :slight_smile: and you mean say like i add or modify a module in my php5.ini i should restart apache for example to make it take effect?

I would think that logicaly this is the ultimate PHP documentation: PHP: PHP Manual - Manual

And of course in openSUSE YaST is the prefered systemm management tool. Thus YaST > System > System Services (runlevel) will give you the easiest interface to make Apache a service running on your system from boot until shutdown.

Yes, but you don’t need to edit php5.ini if you add a PHP module from an openSUSE package as the package will install a .ini file for the module.

There’s quite nice tutorial on using PHP DevZone
You could also read tutorial for Lighttpd HowToSetupFastCgiIndividualPermissions - Lighttpd - lighty labs . Check how was it made for users. Or alternatively Home - PHP-FPM as a spawner.