Ok, I'm VERY new to php, and I have one question.

I bought "Sam's PHP, MySQL, and Apache All in One" and I am literally stuck on the install and configure phase. It eventually tells me to create a file in the "htdocs" folder which is where my "http://localhost" is set to. My problem is, it tells me to create a file called "phpinfo.php". So I open up notepad and type in the following code.

<?php
phpinfo();
?>

and save as "phpinfo.php". The problem is, when I save it, it is still just a text file and viewing "http://localhost/phpinfo.php" gives the the "No page exists" message. The funnier part is, after I save it, it's still just a text file, not an internet page like if you saved something as ".html"

If anyone can help me please do, I'm pretty sure I've done everything right, but now I'm confused =(

    Does http://localhost work? Did you see the Apache Default Page? What did you add in the httpd.conf file after PHP was installed? Did you restart the server?

      Yes, localhost works, and sends me to the apache page sayign I successfully put it on my computer. But I get the Message:

      Not Found - The requested URL /phpinfo.php was not found on this server.
      Apache/2.0.52 (Win32) Server at localhost Port 80

      I added:
      #LoadModule php5_module c:/php5/php5apache2.dll

      and

      #AddType application/x-httpd-php .php .phtml .html

      after the places it specified in the book.

        hi

        yes, .php is often shown as 'text-files'
        this is nothing to worry about
        this is why ity is easy to edit .php in Plain text editors, like notepad

        if you are on Linux, you could check out,
        Owner
        Group
        of the file you have saved
        and what permissions is set CHMOD , when you did save 'phpinfo.php'

        The default when I save a file is:
        Owner='root'
        and
        permission is set to 644
        644 is the usual for web documents
        rw r r
        means only 'root' can read+write and all other can read this file

        and standard for a visitor from web is, he is being 'nobody' ( not 'root' )

        [right]
        /halojoy
        with his new server at:

        http://213.100.118.115:8888/ [/right]
        🙂

          if you are on Linux

          oblivion isnt on Linux.

          Just wondering though, could it be that you're saving the file as phpinfo.php.txt?
          You might have to disable hiding of known filetypes in the filesystem interface (e.g. Windows Explorer, or whatever they call it).

            Thanks a lot laserlight, I'm really new apparently LOL. But still, it now opens the php file from the http://localhost/phpinfo.php but it just gives me the option of DLing and opening the php file in dreamweaver, it doesnt tell me the facts about php5 like the books says should pop up in the browser. Why do you think that may be?

              Also, you may need to add the php extension to the default file types in the Apache conf file...

                I looked through the php.ini file located in my C:/WINDOWS folder but when I searched through the text I never really saw a place to add any file extensions. Do you know like a specific place it would be in the code? 😕

                  I'm sorry, not the php.ini... (I've edited my original post to remove the mis-information) I meant the Apache Configuration file. Follow the link Laserlight provided and look for where it discusses AddType in the Apache conf file.

                    In the .conf file right under these two lines of code:

                    #AddType application/x-tar .tgz
                    #AddType image/x-icon .ico

                    I added this line:
                    #AddType application/x-httpd-php .php .phtml .html

                    Is this not correct?, cause it's been like that and still wont work.

                      is a comment character in the apache config file. Remove the hash.

                        Oh my god! Thank you so much hahahahahha. Something so simple as a "3" sign and it messes up. I feel really stupid right now, thank you very much, I love you.

                          NP. Apache config IS confusing!

                          If it is solved, make this thread so too. Look at the thread tools on top, and mark thread resolved

                            Write a Reply...