Configuring Apache for PHP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Configuring Apache for PHP

Postby Kaworu » 19. January 2024 01:13

hi!

I installed XAMPP (the newest version) on my WIn10. Sadly, the most basic scripts aren't working properly. Per instance, I see nothing for the following script:

Code: Select all
<!DOCTYPE html>

<html>

    <body>
           
        <?php phpinfo() ?>

    </body>

</html>


It was advised to me to configure Apache for PHP. I found something about that, but for Linux OS. Could somebody tell me how to do so using Win10?

Sorry, I feel really silly :/ I tried to google that, but the first page of Google was unhelpful. Also, shouldn't XAMPP be an "out of the box" experience?

PS. http://localhost/dashboard/ works normally, it seems? But even the most simple PHP script is not working correctly on my computer... :-( I see just white pages. What should I do?
Kaworu
 
Posts: 8
Joined: 19. June 2021 14:14
XAMPP version: 3.3.0
Operating System: Win 10

Re: Configuring Apache for PHP

Postby Nobbie » 19. January 2024 12:57

You probably do not enter the URL of your script into your browser, instead you (probably) simply double clicked it in your explorer (what is totally wrong). Put your script into the htdocs folder of Xampp, mostly c:/xampp/htdocs, lets says it is called "test.php", finally enter the correct URL into your browser: http://localhost/test.php (you may simply click here on that link instead, if you called your script test.php).

There is nothing to be done for Apache / PHP, Xampp comes fully preconfigured and runs out of the box.

P.S.: Your test script generates wrong HTML code, as the phpinfo() call already generates the <DOCTYPE ...> line as well as the opening and closing tags <html> and </html> and as well as the body tags. This leads to broken HTML, that may also be the reason for your problem. Simply run this script instead:

Code: Select all
<?php
        phpinfo();
?>


Thats all.

P.P.S.: in June 2021 you already asked quite the same question and become quite the same answer. What did you do in the meantime and why do you ask again??
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04

Re: Configuring Apache for PHP

Postby Kaworu » 20. January 2024 13:20

P.P.S.: in June 2021 you already asked quite the same question and become quite the same answer. What did you do in the meantime and why do you ask again??


Hm... did I? Sorry? :( I remember I had some problems with PHP in the past, but I forgot what it was about. Sorry for the trouble :(

In the meantime I focused more on Python than on PHP, but now I wanna expand my repertoire, so to speak?

Thank you for the help :-)
Kaworu
 
Posts: 8
Joined: 19. June 2021 14:14
XAMPP version: 3.3.0
Operating System: Win 10


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 208 guests

cron