'Fresh Laravel install deletes server.php on artisan serve

I'm a bit fresh to Laravel. I installed it via composer in the xampp/htdocs file. I installed the latest version 5.6. The install works with no errors, and the file structure is as it should be.

When I run the php artisan serve command from inside the folder, it deletes the server.php file and therefore outputs the error:

This site can’t be reached.

localhost refused to connect.

So I thought why not just add a new file inside and it will work... Well, trying to add new file shows that I do not have permissions to add files to this folder.

I tried a new install a few times, but the situation is always the same.

Has anybody else encountered this problem?



Solution 1:[1]

So I realised it was some kind of server problem... well, removed the antivirus, chanhed my firewall settings and everithing works as it should.

Solution 2:[2]

My advice to avoid this in the future is to start creating Laravel applications in a folder inside of your My Documents folder in Windows or using /home/{your-username}/projects directory in Unix environments.

What likely happened is xampp has certain permissions that don't play nice with what you need in Laravel.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tadej Bogataj
Solution 2 Dylan Pierce