Question:
I need a smart computer nerd that knows php well.?
anonymous
2006-11-05 20:19:59 UTC
I have apache installed, configured, and running on my computer. I have php installed and configured. I have apache configured to run php. Now I'm supposed to test it on a web page with the script
phpinfo()
?>

...and then save the file as a .php file. Then I'm supposed to open it to see if the test works.

The question is, HOW in the world do you open it THROUGH a a server without loading it onto a real website? I know html very well and I know how to make websites and webpages, but this book I am using to learn php really drops the ball on this step. I was under the impression that APACHE is the server I'm supposed to use to open it, but it doesn't say that. It doesn't make any sense. Can anyone help me? Thanks.
Three answers:
argiope
2006-11-05 20:32:37 UTC
you should rung the apache on your local machine then put the php file where you've defined as the DocumentRoot on apache's httpd.conf.

then call it on the browser like:

http://localhost/example.php or http://127.0.0.1/example.php



also check the like for a real good apache-php-mysql suite
WickedSmaht
2006-11-06 04:38:05 UTC
Apache is the process serving the pages to your browser. You could look to see if it's configured correctly by putting "http://servername" in a browser (replace with your servername, or if need be, the local IP) . A default page should appear. If not, you may not have apache correctly installed. You can do all this locally on the machine with apache ("the server" in your scenario).



Apache gets configured to have a root dir for the site. save your PHP test file in the root dir (just as a quick-n-dirty test) and put "http://servername/test.php" in a browser and see if it works.



do NOT put "file://..." into the browser, with the path to the file. This is simply asking the browser to read the file and attempt to render it, without a server processing it through a port request.



Once you are browsing your pages through a browser, you are using "real" server. The only difference is how the localserver or IP is resolved versus a true www site (using local DNS or your ISP's). If you developing on the machine with apache, it should have no problem using your local machine's name or IP when browsing.



Hope that helps a bit.
SAW
2006-11-06 06:14:53 UTC
You need to put the file in your default web directory which may be named "htdocs" or "html." If it's on your own PC, enter http://localhost/your_file_name.php. If it's on an external web server, enter http://your_server_name/your_file_name.php.



By the way, if phpinfo doesn't run, check the following:



1) You need a semicolon (;) after phpinfo() but that probably wouldn't prevent phpinfo from executing.



2) The ability to run phpinfo may be disabled in your php.ini configuration file. If so, just enable it, restart Apache and it should work.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...