i am new to php..can anyone help me with the basics of PHP. i mean after installing php,how do i save my first PHP file. i mean saving that file as .php i know ..but in which folder should i save it and after saving how do i run myprogram.
any help will be appreciated..

Recommended Answers

All 4 Replies

i am new to php..can anyone help me with the basics of PHP. i mean after installing php,how do i save my first PHP file. i mean saving that file as .php i know ..but in which folder should i save it and after saving how do i run myprogram.
any help will be appreciated..

you install LAMP or WAMP?

i am new to php..can anyone help me with the basics of PHP. i mean after installing php,how do i save my first PHP file. i mean saving that file as .php i know ..but in which folder should i save it and after saving how do i run myprogram.
any help will be appreciated..

In Linux I save it in /var/www/ but in Windows environments this is different, when you installed PHP you may have specified a folder. You can then access your PHP script by going to http://localhost/file.php but you will need a web server such as Apache set up to pass it to PHP.

Hope that helps:)

In WINDOWS edit your httpd.conf
add this:

DocumentRoot  "C:/dependsonyourdirectory"

<Directory "C:/dependsonyourdirectory">

    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

</Directory>

<IfModule dir_module>
    #here you name it index.php
    DirectoryIndex index.php index.htm index.html
</IfModule>

IN LINUX RHEL:

/var/www is the default.

under httpd.conf /etc/httpd/conf

DocumentRoot "dependsonyourdirectory"

<Directory "dependsonyourdirectory">

    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

</Directory>


create a file name index.php type this:
<?php
phpinfo();
?>

put it on "dependsonyourdirectory"

hope this will help you..

Or you use xampp or install the services individually.
In any case, as a biginner I would recommend using a program called notepad++ and the wikipedia article about it is at: http://en.wikipedia.org/wiki/Notepad%2B%2B
The advantage with a boosted version of notepad is that it contains a syntax highlighter making code more readable and easier to spot errors. And to save a file as a php file, simply select the option All files (*.*) and add at the end of the filename .php To view the files, place them in your active server directory which is usually called something like htdocs or public_html. Then after that to view it in the browser you need to type in the website address or if the website/webpages are not on the internet but on the computer you are using then you use the website http://localhost/file.php with file.php being a file inside the htdocs or public_html folder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.