Solved <?php phpinfo(); ?>

I have installed php many times and thought I understood what was required to display phpinfo(), but for some reason I just get '<?php phpinfo(); ?>' shown in my browser. I deleted all pkgs and started from scratch, installing only apache24, php56 and mod_php56 and adding a php.conf in apache's Include directory which simply contains

Code:
<FilesMatch "\.php$">
       SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>

I'm sure I only needed to do this in the past to get phpinfo() working but I'm obviously missing something...
 
have you checked to see what modules/includes are actually loaded ?

Code:
httpd -t -D DUMP_INCLUDES
Included configuration files:
  (*) /usr/local/etc/apache24/httpd.conf
 ....
    (528) /usr/local/etc/apache24/Includes/php.conf


httpd -t -D DUMP_MODULES
Loaded Modules:
....
 php5_module (shared)
 
Unfortunately everything looks as it should. I don't want a stupid little problem like this to beat me but I'm lost for what could be causing it...

Maybe I'll reinstall FreeBSD...
 
If your file is called index.php, then make sure that you also add:

Code:
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
</IfModule>
 
It looks very much like Apache isn't parsing it as PHP which normally points to a config error in httpd.conf / php.conf.

Just for completeness to rule out PHP-side issues, does other php code also do the same?.
Can you open the php file from the command line? (you'll need it without the <?php ?>), but it should output the normal output.
There isn't a typo in your test php file?, for example:
Code:
<? php phpinfo(); ?>
Finally is there anything odd in the /usr/local/etc/php.ini config file?. Ensuring you've copied one of the php.ini-development/production to create it?.

Other than that I'm out of ideas.
 
In the process of migrating from php56 to php71 I deleted all the php56 pkgs, installed mod_php71 and now phpinfo() no longer works! Well I tried it on two system, and it works on one but not on the other.

As I see it there is very little to go wrong... There is only httpd.conf and mod_php71 which should be involved AFAICS...

httpd.conf should contain Sethandler application/x-httpd-php and
LoadModule php7_module libexec/apache24/libphp7.so

Both systems have the latest version of apache24 and mod_php71 although I've noticed that /usr/local/libexec/apache24/libphp7.so is a different size on both systems.

I'm stumped!
 
php.ini has remained unchanged for over a year, phpinfo()has been working up until today.

Now I've deleted mod_php71 and reinstalled mod_php56 in an effort to get back to where I was but it still doesn't work, so there must be something else which I've overlooked.
 
Finally solved and it's quite embarrassing....

I thought I had this:-

Code:
<FilesMatch "\.php$">
      SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
     SetHandler application/x-httpd-php-source
</FilesMatch>

but really I had this:-

Code:
<FilesMatch "\.php$">
      SetHandler aplication/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
     SetHandler application/x-httpd-php-source
</FilesMatch>

A complete day wasted :(...
 
Back
Top