Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have freshly installed apache and php and configured them, then I started apache and was trying to print phpinfo() on my webpage, but when I use phpinfo() in my code, the page keeps stuck on loading.

My code:
PHP
<?php phpinfo(); ?>


What I have tried:

My error logs:

Starting the 'Apache2.4' service
The 'Apache2.4' service is running.
pm_winnt:notice] [pid 11060:tid 704] AH00455: Apache/2.4.48 (Win64) PHP/7.4.22 configured -- resuming normal operations
[Mon Aug 02 20:31:20.766914 2021] [mpm_winnt:notice] [pid 11060:tid 704] AH00456: Apache Lounge VS16 Server built: May 18 2021 10:45:56
[Mon Aug 02 20:31:20.766914 2021] [core:notice] [pid 11060:tid 704] AH00094: Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'
[Mon Aug 02 20:31:20.769908 2021] [mpm_winnt:notice] [pid 11060:tid 704] AH00418: Parent: Created child process 5520
[Mon Aug 02 20:31:21.176277 2021] [mpm_winnt:notice] [pid 5520:tid 712] AH00354: Child: Starting 64 worker threads.
Posted
Updated 3-Aug-21 4:11am
v5

It needs to be in a web page, try this:
HTML
<!DOCTYPE HTML>
<html>
<head>
    <title>PHP Configuration details</title>
</head>
<body>
    <?php
        phpinfo();
    ?>
</body>
</html>
 
Share this answer
 
Comments
Dev X 3-Aug-21 9:04am    
@Richard MacCutchan Hello sir, it is still not working. Also, my apache server is running at port 80.
Richard MacCutchan 3-Aug-21 9:15am    
"it is still not working."
Sorry, no one here can possibly guess what is the problem. You need to gather more information on exactly what is happening when you launch the page.
Dev X 3-Aug-21 9:24am    
my connection gets failed, when I try to access http://localhost/index.php on my browser, while using phpinfo(); on my PHP code.
Richard MacCutchan 3-Aug-21 9:46am    
Sorry, but no one here can possibly guess what is happening on a system that we do not have access to. You need to check your setup, all system logs etc.
Dev X 3-Aug-21 10:01am    
ok, sir. I'll try to update my question.
I had issues a long time ago with something similar, and it turned out to be problems with the Windows Firewall blocking connection attempts. Make sure that you're exposing the port 80 or 8080 (whatever you have it set to) and make sure that you're connecting via "localhost" or "127.0.0.1", not your IPv4 or internal IP.

Those logs don't really seem to indicate much either, but depending on where you're running your server from as well could also impact access. For example, if you have XAMPP installed into the Program Files directory, make sure it's running with elevated privileges to be able to access the files in the directory.

Finally, a page refusing to load could also be the browser actively trying to connect to Tomcat but being unable to do so. It might seem like the page is taking a long time to load, when in fact it's just unable to connect to load it. Have you tried removing the PHP code and printing a simple "Hello world" to see whether it loads? If it does load, then you have a clearer idea that it is in-fact PHP causing problems.
 
Share this answer
 
Comments
Dev X 4-Aug-21 7:51am    
@Chris Copeland, sorry for the late response, but echo and all is working fine, even the mysqli connect or the pdo is also working fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900