Author Topic: How to make php active in Apache  (Read 9195 times)

Greg Pringle

  • Full Member
  • ***
  • Posts: 149
  • Karma: +0/-0
    • View Profile
How to make php active in Apache
« on: October 03, 2019, 04:50:21 pm »
Using Apache 2.2.34 and PHP 5.4.45 is not working as expected.
When php is run by hand it will return "Hello World" from:

set BEGINLIBPATH=D:\php5;D:\php5\modules
php -r "echo 'Hello World';"

When using a web page no results can be obtained.
<?php echo 'Hello World' ?>

Other lines have been tried with no results.

There is a C:\mptn\etc\php.ini
and httpd.conf has:
LoadModule php5_module d:/php5/apache2/modphp5.dll

Any thoughts?

xynixme

  • Guest
Re: How to make php active in Apache
« Reply #1 on: October 03, 2019, 06:31:20 pm »
No SET LIBPATHSTRICT=T?

If local, is the software in use to view the webpage also using the same LIBPATH setting(s)?

Devid

  • Newbie
  • *
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: How to make php active in Apache
« Reply #2 on: October 03, 2019, 06:47:01 pm »
Perhaps
Code: [Select]
AddType application/x-httpd-php .phpin httpd.conf (section <IfModule mime_module>).
Also
Code: [Select]
DirectoryIndex index.html index.phpalways in httpd.conf (section <IfModule dir_module>)

Greg Pringle

  • Full Member
  • ***
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: How to make php active in Apache
« Reply #3 on: October 03, 2019, 07:38:01 pm »
Both of the suggestions have just been tried but no luck yet.

I also removed the php.ini and the command line still worked but the web page did not.

Devid

  • Newbie
  • *
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: How to make php active in Apache
« Reply #4 on: October 03, 2019, 08:39:12 pm »
Try in httpd.conf
Code: [Select]
LoadModule php5_module modules/modphp5.dlland copy modphp5.dll in the apache/modules directory.
My startup.cmd for apache:
Code: [Select]
@echo off
rem adjust as necessary
set HOSTNAME=localhost
set beginlibpath=c:\apps\apache2\bin;c:\apps\apache2\modules;c:\apps\php5;c:\apps\php5\modules;c:\usr\lib
set LIBCX_TRACE=+mmap
bin\httpd -d . 2>&1
Furthermore
Code: [Select]
ErrorLog "logs/error_log"
LogLevel debug
in httpd.conf and post your log...
(Attached my httpd.conf and php.ini)

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2244
  • Karma: +170/-0
    • View Profile
Re: How to make php active in Apache
« Reply #5 on: October 04, 2019, 05:09:10 am »
A bit more is needed in httpd.conf than just loading the module.

Most of https://www.thesitewizard.com/php/install-php-5-apache-windows.shtml is relevant -in particular the references to 'AddType application/x-httpd-php .php'

Cheers,

Paul

Greg Pringle

  • Full Member
  • ***
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: How to make php active in Apache
« Reply #6 on: October 04, 2019, 02:28:35 pm »
To all,
PHP5  is now running normally in Apache/2.2.34 (OS/2) PHP/5.4.45
The php.ini is in directory d:\php5

httpd.conf has:
LoadModule php5_module "d:/php5/apache2/modphp5.dll"
PHPIniDir "/php5"
<IfModule dir_module>                 
    DirectoryIndex index.php index.html
</IfModule>                           
<IfModule mime_module>
...
AddType application/x-httpd-php .php
...
</IfModule>
DocumentRoot "/web/corvedia"

then a file was created:
D:\web\corvedia\index.php
<HTML>                                                         
<BODY>                                                         
This is a test                                                 
<p>                                                             
 <?php echo 'Hello World' ?>                                   
<p>                                                             
<?php                                                           
phpinfo();                                                     
?>                                                             
</BODY>                                                         
</HTML>       

and the PHP information was returned.

Thanks to all.