Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ArchStanton's avatar

Valet serving php files

Hi,

I have a simple php site I want to serve on Valet. If I create an index.html it works fine but all .php files return a 404.

Any idea how I fix this? I really don't want to go back to MAMP.

0 likes
4 replies
rob897's avatar
rob897
Best Answer
Level 30

valet is going to look for a public/index.php file by default is my best guess.

1 like
ejdelmonico's avatar

As rob897 mentioned, put your index.php file in a public directory at the root of the project. That should work for you if you have all the requirements installed.

1 like
tykus's avatar

Valet is very flexible in determining which of it's many drivers to use to serve an app, and will use the BasicValetDriver at the very least, which should server your php files; what you might have is a driver that has been mismatched.

You can check which driver Valet is using for your current site by running valet which from the commandline. If an incorrect driver is being used, then you can specify a LocalValetDriver.php in the root of your app to force a particular driver simply by extending that class.

ArchStanton's avatar

@tykus The driver was fine but that is a good time, thanks. In the end it was an intenal redirect thing.

The replies did help me get there though!

Please or to participate in this conversation.