EasyPHP 1.8默认页异常:访问本地Web时index.php不显示自动打开index.html
Hey there! I totally get your frustration—let's break down why your index.php isn't showing up instead of index.html, and how to fix it.
The Root Cause
EasyPHP uses Apache under the hood, and Apache has a setting called DirectoryIndex that tells it which files to look for first when accessing a folder. By default in older versions like 1.8, index.html is listed before index.php in this priority order. That means if both files exist in your www folder, Apache will load index.html automatically instead of index.php.
How to Fix It
There are two simple ways to adjust this:
1. Modify Apache's Global Configuration (Applies to All Sites)
- Open your EasyPHP installation folder (usually something like
C:\Program Files\EasyPHP-1.8or wherever you installed it). - Navigate to the
apache\conffolder and open thehttpd.conffile with a text editor (like Notepad or VS Code). - Use the search function to find the line starting with
DirectoryIndex. It’ll look something like this:DirectoryIndex index.html index.php - Swap the order so
index.phpcomes first:DirectoryIndex index.php index.html - Save the file, then restart the Apache server from the EasyPHP control panel. Now Apache will check for
index.phpfirst!
2. Use a .htaccess File (Only Applies to Your www Folder)
If you don’t want to mess with the global Apache settings, you can create a local configuration file just for your website folder:
- Open a text editor and paste this line:
DirectoryIndex index.php index.html - Save the file as
.htaccess(make sure the filename starts with a dot and there’s no.txtextension at the end). - Move this file into your EasyPHP
wwwfolder. Apache will automatically pick up this setting for that directory.
Either method should make your index.php load by default when you access your local site. Let me know if you run into any hiccups!
内容的提问来源于stack exchange,提问作者user9311878




