This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Question And Answer


If you have problem with php, you can ask here, hopely i can anwers it or another people can answer it

thank you

dadan ramdan

Task Discussion


  • dadan ramdan   June 20, 2011, 3:06 p.m.

    look on the task install php

    there is part to edit httpd.conf on apacher server

  • (aleb   June 22, 2011, 12:06 p.m.
    In Reply To:   dadan ramdan   June 20, 2011, 3:06 p.m.

    Is that in the wamp server or my editor?

    Thanks,

    Caleb

  • dadan ramdan   June 22, 2011, 2:41 p.m.
    In Reply To:   (aleb   June 22, 2011, 12:06 p.m.

    try to look on the wamp server directory find httpd.conf ussualy on directory apace/conf or conf

  • dadan ramdan   June 26, 2011, 11:54 a.m.
    In Reply To:   dadan ramdan   June 22, 2011, 2:41 p.m.

    because of my curiosity

    i installed the wamp server

    and the httpd.conf is on folder

    this is C:\wamp\bin\apache\Apache2.2.17\conf

    open with your editor

    look around line 127 make sure there is

    LoadModule php5_module "c:/wamp/bin/php/php5.3.5/php5apache2_2.dll"

    and look around line 386

    make sure there is

    AddType application/x-httpd-php .php
        AddType application/x-httpd-php .php3

     

    but the one i see when i install wamp already install properly php

    when you want to create php ex: hello.php

    put on this dir

    C:\wamp\www

    hopely this work for you

     

     

  • (aleb   June 26, 2011, 12:52 p.m.
    In Reply To:   dadan ramdan   June 26, 2011, 11:54 a.m.

    Okay, thanks! I will follow the process and get back with you. Thanks for your help.

    (aleb

  • (aleb   June 26, 2011, 1:37 p.m.
    In Reply To:   dadan ramdan   June 26, 2011, 11:54 a.m.

    Thank you so much too Dadan. I checked it out and this is what I found:

    Line 384) AddType application/x-compress .Z
        385)  AddType application/x-gzip .gz .tgz
        386) AddType application/x-httpd-php .php
        387) AddType application/x-httpd-php .php3

    Look's fine. And my task worked.

    (aleb

  • (aleb   June 20, 2011, 12:21 p.m.

    I'm using Notepad++ and have WAMP Server. I created a folder on my desktop and inside the folder I saved the hello.php file. However, when I try to open the page, it won't let me because it's a php file extension. It ask if I want to open the file and I say yes, but it only opens up my other editor (Aptana Studio 3.0) and still won't open the actual file.

    Thanks,

    Caleb

  • BobW   June 24, 2011, 4:14 a.m.
    In Reply To:   (aleb   June 20, 2011, 12:21 p.m.

    Any files that you create like the "hello world" php file have to be accessed with a browser for you to see the end result of your code. Same of course applies to HTML and CSS files.

    In Windows when you install WAMP it gets installed to your C: drive at the root level. In other words, if you open your "My Computer" folder and double click on the C drive you'll see a folder at the bottom most likely that will say WAMP.

    Inside that folder there are a number of other folders but the one you want is called htdocs or www. I forget exactly which because I use XAMPP. In any case, once you find that folder move the hello.php file into that folder and open a browser, either Firefox, Chrome or Internet Explorer and type the following:

    localhost/hello.php or http://localhost/hello.php

    You should then see the fruits of your labor.

    Let me know if you have any other questions.

  • (aleb   June 26, 2011, 12:54 p.m.
    In Reply To:   BobW   June 24, 2011, 4:14 a.m.

    Hi Bob,

    Thanks, I will give that a try too.

    (aleb

    >>>>>>UPDATE! It worked Bob! Thanks so much!<<<<<

    I'm sorry, I replied without noticing you had already replied back to me. I have Aptana Studio 3 and Notepad++ and neither one would open the hello.php file. It would try to but instead of the browser opening as it does with html or css files, a box pops up asking me to choose something to open the hello file with. So, should I use the same successful process you listed for the rest of my class tasks/projects?

    Thanks again,

    (aleb

  • BobW   June 26, 2011, 1:11 p.m.
    In Reply To:   (aleb   June 26, 2011, 12:54 p.m.

    You are very welcome. Just remember that any .php file that is not in that www folder will aumatically be opened by your editor. HTML files are a bit different in that since they don't need a database will automatically open with your browser if double clicked, unless you happen to change that in "Default Programs" in control panel and associate the extension (.HTML) with your text editor.

  • BobW   June 26, 2011, 2:57 p.m.
    In Reply To:   (aleb   June 26, 2011, 12:54 p.m.

    Yes. Any php file you create that's meant to be seen or published on the web must be placed in that www or htdocs  folder. Otherwise if you try to open it WIndows will assume that you want to edit the file. Also you don't have php installed in Windows. In other words Windows itself is not set up as a server and even if it was you would still have a folder called www. 

    Also as far as editors go, Aptana is great but since you're just learning I highly recommend you stick with Notepad++. I also recommend trying E Text Editor . It will help you be more productive.

    Getting back to WAMP: The reason you installed WAMP (or XAMPP or MAMP for Mac) is because it creates a server "like" environment. It installs Apache, PHP and MySQL in an enclosed self contained environemt. Meaning that unless you deposit your files insude the www folder (or htdocs) Windows cannot interact with it. The reason you open files with your browser is because in essence your "fooling" the browser into thinking that you are accessing a website (files) on the internet.

    The structure of WAMP is such that it's designed to only work within a certain set of folders, functions and actions, hence you have to use WAMP"s folders (www or htdocs) to publish your site. Actually that is exactly how you should approach these files. You are publishing a website. Your not just creating a file or files. The php file (hello.php) represents a website.

    If you wanted you can install WordPress inside of WAMP also and create a fully functional WordPress based website. So from now on you are working on a website and as you learn more about php and your hello.php file gets more functions and such, your website is getting more and more content and functions.

    I hope all that makse sense and if I have confused you in any way please let me know and I'll do my best to rephrase.

  • (aleb   June 26, 2011, 9:36 p.m.
    In Reply To:   BobW   June 26, 2011, 2:57 p.m.

    Bobw,

    No, you didn't confuse me. The sole reason I installed WAMP prior to even knowing about P2PU was so I could work with Wordpress and test new themes. I just didn't realize I could just drag a file over into the WAMP www folder, so instead, I tried to import and install the hello.php file into WAMP through the myphpadmin.  That's what stumped me.:-) Again, thanks so much for your help.

    (aleb