PHP on Apache 24 (windows) not working.

Alles, was PHP betrifft, kann hier besprochen werden.

PHP on Apache 24 (windows) not working.

Postby kawikbr » 29. August 2023 21:52

Hi ALL.

Newbe here.

Im planning to learn PHP, so I installed Apache 2.4 Server on my Windows 10 Home edition. (C:/apache24)
Php was also installed. (c:/php).

Did all the configurations on system variables, and apache is runing fine.
Created a HTML file and loaded it fine.

But whenever I load a PHP file (http://127.0.0.1/test.php) the file show its content, and does not "run".

BUT, If I go to comand line and type > Php test.php < it works fine.

So, I conclude that PHP is not working on Apache Server.

I,ve tryed to find the php line on the httpd.conf file, but it isnt there. Searched the internet for the correct configurations, but didnt find.

What am I doing wrong?
kawikbr
 
Posts: 1
Joined: 29. August 2023 21:21
XAMPP version: 3.3.0
Operating System: W10

Re: PHP on Apache 24 (windows) not working.

Postby Nobbie » 31. August 2023 00:35

You did not configure Apache correctly for PHP.

Why dont you install Xampp instead of messing around with Apache and PHP? Here is the Xampp Forum anyway and Xampp installs Apache, PHP and MariaDB perfectly preconfigured.
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: PHP on Apache 24 (windows) not working.

Postby MilesWeb » 25. January 2024 09:55

You can configure Apache to recognize and process PHP files. Here are some steps that you can follow,
1. Load the PHP Module in Apache:
Code: Select all
LoadModule php_module "c:/php/php[version].dll"


2. Configure PHP as a Handler:
Code: Select all
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php .html


3. Make sure the PHPIniDir directive is set in your Apache configuration & adjust the path accordingly:
Code: Select all
PHPIniDir "c:/php"


4. save the httpd.conf file and restart your Apache server.
run below command with administrative privileges
Code: Select all
httpd -k restart
MilesWeb: Your Hosting, Our Responsibility!!
User avatar
MilesWeb
 
Posts: 10
Joined: 19. January 2024 10:40
XAMPP version: 8.0.30
Operating System: linux

Re: PHP on Apache 24 (windows) not working.

Postby avisdigital » 05. March 2024 11:40

Hi,

Is this solution always working fine ?

Thanks,

Antony
avisdigital
 
Posts: 1
Joined: 05. March 2024 11:36
XAMPP version: 8.2
Operating System: Mac OS

Re: PHP on Apache 24 (windows) not working.

Postby Nobbie » 05. March 2024 15:32

No.

It is designed for Xampp on WIndows. Its not designed for different webserver stacks and not for different OS. There may be differences.
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04


Return to PHP

Who is online

Users browsing this forum: No registered users and 77 guests