Installing php server

Dear sir,
After installing the apache server I need to install the php server also. i downloaded the php server version : php-7.0.8-nts-Win32-VC14-x64 for my pc. How can I make it workable with the apache. while I command as localhost the codes are showing (<?php $var='hello world!'; echo $var; ?>) instead of result (hello world!)!
I already added the command in apache/conf/httpd as follows:

loadmodule php7module"c:/PHP/php7"
AddHandler application/x-httpd-php.php
phpInDir c:/PHP

Try putting a space between x-httpd-php and .php. Same with php7module and “c:/PHP/php7”.

1 Like

Dear sir,
I modified the instruction as you stated. still now I am facing trouble.
I tried to restart the httpd manually(httpd -k restart in cmd) , the command prompt states the message as below:
httpd: Syntax error on liine 520 of c:/apache24/conf/httpd.conf: can’t locate API module structure ‘php7 module’ in file c:/PHP/php7: no error
how can I solve this problem?

Look in the PHP folder for the actual file, it won’t be “php7”.

It will be something like this depending on the actual version you have.

php7apache2_4.dll

2 Likes

If your installation is in C:/PHP/, then you’ll have to use C:/PHP/ as the destination folder, it can’t just be C:/PHP/php7/ where the destination folder doesn’t exist. You have to point to where your php.ini files are like what @Mittineague said.

It also depends on the OS architecture too.

2 Likes

Dear sir,
I have downloaded the php server again and found actual file “php7apache2_4” and changed in apache/conf/httpd as follows:

Loadmodule php7_module "c:/PHP/php7apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir c:/PHP

I tried to restart the httpd manually(httpd -k restart in cmd) , the command prompt states one new message as below:
AH00558: httpd: could not reliably determine the servers fully qualified domain name , using fe80::a92a:8482:7a625d9e. set the ‘Servername’ directive globally to suppress this message

That looks similar to my httpd.conf except I have quotes (and phar which you probably don’t need if you don’t know what it is).

PHPIniDir "C:/PHP"
LoadModule php7_module "C:/php/php7apache2_4.dll"
# AddModule mod_php7.c
AddType application/x-httpd-php .php .phar

Go to the httpd.conf file and look for the following line.

# ServerName gives the name and port that the server uses to identify itself.

A few lines after that, it should say something like

ServerName {www.example.com}:80

Where {www.example.com} is your respective domain name. You can use localhost if you want or any domain that you want, but you’ll also have to change the hosts file in C:/Windows/System32/drivers/etc/hosts if you want to use something other then localhost. If you haven’t changed the domain name in the httpd.conf file yet, you will have to do so. If that line has a # meaning it has been commented out, you will have to remove that # to uncomment it.

2 Likes

Ah, I missed that as being a possible problem because mine is commented out.
Looking again more carefully, I must be in the "often"s

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
1 Like

Building apache and php from source on windows is an exercise in futility. Is there any reason you’re not using xamp or a better yet a vm.

Dear Oddz,
Actually, I want to have a deep knowledge about server. that is why I am working from the basic. The matter of sorrw is that, still now I could not fix it.

This is the warning message only and your web server should work with it normally.

I can suggest you to install Wamp server package instead of trying to install and configure Apache,PHP and MySQL yourself. It can be hard if you’re novice.

You can find the WAMP software here: http://www.wampserver.com/

1 Like

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