Php code cannot be read when run on localhost

hi, i am Hamdi. I’m still a beginner using Linux. and manjaro was my first linux. i have problems running php.
i tried to run my php code in localhost/test.php.
The test.php file contains commands such as “echo” and so on.
but when I try to run localhost/test.php, the result that appears is a blank page.
it seems my php code is not readable.
even though I have installed PHP, Apache and MariaDB.
I checked the status of Apache and MariaDB and it was running and there were no problems.
I checked the error log in “/var/log/httpd/error_log”
but I didn’t find the error.
I tried checking the configuration using sudo apachectl configtest
the result is that the syntax is okay.
there are no errors either.
I tried opening the apache configuration in httpf.conf using the command sudo nano /etc/httpd/conf/httpd.conf.
then I tried changing LoadModule mpm_event to #LoadModule mpm_event.
while #LoadModule mpm_prefork becomes LoadModule mpm_prefork.
then I saved and tried restarting apache again.
and I checked the status and it was active.
then I tried again to run localhost/test.php
but the result is that the page is still blank.
my php code is still unreadable.
while the HTML and CSS code can still be read.
Please help me.

Go over this topic and verify your installaion

thank you for your answers. that’s very helpful.
I’ve tried it and it works.
However, that only applies to newly created PHP code files.
whereas when I tried the php code file that I took from GitHub. and just run it on localhost/ . the page returns blank. php code is not readable, problem as before.

Manjaro forum is not a support forum for someone getting their feets wet in some programming language neither a support forum for random code found on github nor anywhere else.

There is plenty fora around the interweb which has specialized in various languages.

That said - if you could make the info.php from the above topic work then php works - it is probably your lack of knowledge which is in play here.

There is only one thing you can do, search, read and learn.

Place the php file in /srv/http and point the browser to ip.x.y.z/test.php - then it may work or it may not - that depends on the code in question - and please - don’t ask why here - ask the author of said code, please?

oke, thanks

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.