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

MyirLik's avatar

Php files won`t load

Hi, do you know why php files don't start? I haven't suffered so far. I also made a .php test file in which I gave a simple echo and it doesn't display anything. Do you have any ideas? I use Windows as an operating system, php 7.4. Is it possible because of the hosts file? I was using the docker and I needed it. If I want to use laravel, everything works perfectly but not on a simple php file. Do you have any ideas?

0 likes
13 replies
automica's avatar

@myirlik are you getting any errors in the logs?

if you add

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

to the top of your php page, you should see some errors.

Sinnbeck's avatar

Where did you put the file? And what was in it exactly?

MyirLik's avatar

in htdocs. Php project without any frameworks

Sinnbeck's avatar

Try copying the file into the public directory of the working laravel app and call it there

MyirLik's avatar

isMobile() ? ($detect->isTablet() ? 'tablet' : 'mobile') : 'desktop'); #if (isset($_COOKIE["cookiename"])) echo "aaa"; if($layout=='desktop' || isset($_COOKIE["mobilec"])) include('app/index.php');

displays what's in the file, if it's a php function it doesn't load This is exactly what it displays on the web page

jlrdw's avatar

Show whole page.

Did you require your mobile detect Library in a require statement.

Sinnbeck's avatar

Then what you posted isnt what is in the file. Only showing some of it, makes it hard for us to help you

Sinnbeck's avatar

Please post the content of the php file

automica's avatar

@myirlik if you are just seeing the contents of the php file as text and it’s not rendering as php, then check you have installed and enabled php on your server.

To see if you have, create a new page called info.php and paste the following into it.

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

And view in browser

Please or to participate in this conversation.