PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 23, 2022

[FIXED] PHP not being interpreted by apache2(on Debian)

 February 23, 2022     apache, apache2, debian, php     No comments   

Issue

i'm currently suffering from a problem with my apache server. It won't interpret php after i upgraded my system with

    apt-get update
    apt-get upgrade
    apt-get dist-upgrade

By the way I'm using Debian(Linux version 2.6.32-042stab090.3).

Anyways i've been looking up at various sites to find a solution. They mostly said that in my http.conf/apache2.conf is something missing to include php-files to be interpreted by the php5 interpreter. They suggested that I should add

    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>

to my configfile and other variations but none of them worked. And yes I restartet the apache2 server after editing the config-file. They also said that the regex of the php5.conf could be wrong and lead to a interpreter which doesn't cares about real php-files or whatever. Also some of them suggested that I should run

    sudo apt-get purge libapache2-mod-php5
    sudo apt-get remove libapache2-mod-php5

so that the config-files of php were rebuild correctly, but because I lack of luck it also shows an error:

    Err http://ftp.us.debian.org/debian/ testing/main libapache2-mod-php5filter amd64 5.6.0~rc2+dfsg-1
      404  Not Found [IP: 128.61.240.89 80]
    Unable to correct missing packages.
    E: Failed to fetch http://ftp.us.debian.org/debian/pool/main/p/php5/libapache2-mod-php5filter_5.6.0~rc2+dfsg-1_amd64.deb  404  Not Found [IP: 128.61.240.89 80]

So then there was another suggest which said that i should check the error.log of apache2, but it shows only non-helpful messages for me.

    [Sun Jul 20 01:19:27.468164 2014] [mpm_prefork:notice] [pid 31052] AH00163: Apache/2.4.9 (Debian) PHP/5.6.0RC2 configured -- resuming normal operations
    [Sun Jul 20 01:19:27.468204 2014] [core:notice] [pid 31052] AH00094: Command line: '/usr/sbin/apache2'
    [Sun Jul 20 16:22:25.052630 2014] [mpm_prefork:notice] [pid 31052] AH00169: caught SIGTERM, shutting down

Solution

I had exactly the same problem after upgrading from wheezy to jessie. Aside the fact that they moved from apache 2.2 to 2.4, which led me to a bunch of incompatibilities and errors, php too was not being interpreted anymore.

But as they say, the greatest secrets are held in plain sight, here's how I fixed it (kids easy!).

I was verifying php availability with the short script

<?
 phpinfo();
?>

After a few hours of brain cells damage and getting old, I replaced it with:

<?php
 phpinfo();
?>

And everything worked like a charm.

So it's a PHP problem, not APACHE. It is because apparently the short tag was disabled by default in jessie. Look into your php.ini (/etc/php5/apache2/php.ini) for the 'short_open_tag' parameter, and set it to On, eventually or use the full tag in scripts (<?php). I understand it's a parameter kept for backwards compatibility only, but still there was a rough time looking for it.



Answered By - cyber
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing