Very Basic PHP Apache Question


On my localhost, I would like to know how to get a PHP script called when I first arrive on site. In other words, how do I get Apache to pick up index.php instead looking for index.html? I currently have only index.php in the root folder and I’m just getting a view of the folder contents.

I’m running Apache 1.3.31 on WinXP with PHP 4.3.9



In you httpd.conf file for the directive of DirectoryIndex add (or replace if you want) the index.php to the list. It’s very likely that there is already default.htm default.html index.htm index.html in the list already.


I managed to get the results I was after when I corrected a syntactical error; I had used <? php instead of <?php. But what’s odd is that my conf includes only “DirectoryIndex index.html” for the DirectoryIndex. I don’t understand how this is working.

Any thoughts on this?

And, BTW, is there a syntax checker for PHP?


Well, the synatx error would not be the cause of the problem (so to speak). I suspect that you just saw a blank page because of the syntax error. that would be because you have error reporting turned off. (Good for security, bad for troubleshooting/development).

Apache probably is intutive enough to see the lacking a formal index.htm (html) page and presents that instead. Not quite sure here though.

What do you mean by a syntax checker? There are several programs that provide you with feedback on your syntax. Typically they use color hightlighting to identify things like functions, variables, constants, constructs, etc… Ultimately, the true syntax checker will be the web. Try it and see.

Good luck


OK, I’m new to this, so can you help me out with a little more information on two items you mentioned.

First, how do I turn on error reporting?
Second, how can I find the programs that will provide me with feedback on my syntax?


error reporting (for the PHP) is in the PHP.INI file.

Do a google search for syntax highlight editors.


Are we talking about error_reporting or display_errors? error_reporting is a function you place in your script or set in the php.ini to control what errors are “allowed” to have an error message sent out. display_errors is a php.ini setting that allows you to control whether or not the errors are sent to the browser.

You might also look at if you have log_errors turned on. Granted this is generally used when you have display_errors turned off so you have some kind of record… if it is on go to error_log and see where it is logging the errors.

feedback on my syntax
Do you mean like a syntax highlighter or a true interactive debugger? If you are just looking for syntax highlighting - there are more then you can shake a stick at. Here is a list of PHP editors. Try out more then a few and see which you like.


I looking for an interactive debugger.


Hmm - the ones I know of are Eclipse, Magma, and Zend. I personally don’t use any of them, prefer vim.