.php files not working with AddHandler - Apache 2.4 Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Come Celebrate our 10 Year Anniversary!Apache + PHP in paths with accented lettersPHP 5 won't run scripts lacking explicit `<?php`PHP files not getting parsed?PHP pages working slow from time to timeApache certificates for some urls not workingApache 2.4 with PHP 5.5, LDAP in PHP not workingMod - Rewrite / .htaccess Issue with Apache 2.4.12php5-fpm with nginx Session Not Maintained / Dropped RandomlyNew server worked for a few hours, but now connections time outCGI errors (Can't open perl script / Permission denied)

Can two person see the same photon?

What initially awakened the Balrog?

How can I prevent/balance waiting and turtling as a response to cooldown mechanics

How to ternary Plot3D a function

Is CEO the "profession" with the most psychopaths?

Differences to CCompactSize and CVarInt

Special flights

Relating to the President and obstruction, were Mueller's conclusions preordained?

Test print coming out spongy

The Nth Gryphon Number

Select every other edge (they share a common vertex)

Resize vertical bars (absolute-value symbols)

Would color changing eyes affect vision?

Positioning dot before text in math mode

"klopfte jemand" or "jemand klopfte"?

Co-worker has annoying ringtone

What does Turing mean by this statement?

Getting out of while loop on console

Universal covering space of the real projective line?

What are the main differences between Stargate SG-1 cuts?

Where is the Next Backup Size entry on iOS 12?

Can an iPhone 7 be made to function as a NFC Tag?

GDP with Intermediate Production

Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?



.php files not working with AddHandler - Apache 2.4



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Come Celebrate our 10 Year Anniversary!Apache + PHP in paths with accented lettersPHP 5 won't run scripts lacking explicit `<?php`PHP files not getting parsed?PHP pages working slow from time to timeApache certificates for some urls not workingApache 2.4 with PHP 5.5, LDAP in PHP not workingMod - Rewrite / .htaccess Issue with Apache 2.4.12php5-fpm with nginx Session Not Maintained / Dropped RandomlyNew server worked for a few hours, but now connections time outCGI errors (Can't open perl script / Permission denied)



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am having an issue with Apache 2.4 configuration with PHP5. I have got this:



<Directory / >
Options +ExecCGI
AddHandler cgi-script .cgi

Action backButton /backButton.cgi
AddHandler backButton .html .htm .php
</Directory>


It works for both .html and .htm files (i.e. backButton.cgi runs) but not for .php. I have tried everything I can find on the topic including just having .php (i.e AddHandler backButton .php).



If there is any extra information required please ask.










share|improve this question






























    0















    I am having an issue with Apache 2.4 configuration with PHP5. I have got this:



    <Directory / >
    Options +ExecCGI
    AddHandler cgi-script .cgi

    Action backButton /backButton.cgi
    AddHandler backButton .html .htm .php
    </Directory>


    It works for both .html and .htm files (i.e. backButton.cgi runs) but not for .php. I have tried everything I can find on the topic including just having .php (i.e AddHandler backButton .php).



    If there is any extra information required please ask.










    share|improve this question


























      0












      0








      0








      I am having an issue with Apache 2.4 configuration with PHP5. I have got this:



      <Directory / >
      Options +ExecCGI
      AddHandler cgi-script .cgi

      Action backButton /backButton.cgi
      AddHandler backButton .html .htm .php
      </Directory>


      It works for both .html and .htm files (i.e. backButton.cgi runs) but not for .php. I have tried everything I can find on the topic including just having .php (i.e AddHandler backButton .php).



      If there is any extra information required please ask.










      share|improve this question
















      I am having an issue with Apache 2.4 configuration with PHP5. I have got this:



      <Directory / >
      Options +ExecCGI
      AddHandler cgi-script .cgi

      Action backButton /backButton.cgi
      AddHandler backButton .html .htm .php
      </Directory>


      It works for both .html and .htm files (i.e. backButton.cgi runs) but not for .php. I have tried everything I can find on the topic including just having .php (i.e AddHandler backButton .php).



      If there is any extra information required please ask.







      php5 apache-2.4






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 5 '14 at 6:52







      JamesStewy

















      asked May 4 '14 at 22:55









      JamesStewyJamesStewy

      167228




      167228




















          1 Answer
          1






          active

          oldest

          votes


















          0














          You have this set:



          Action add-footer /script.pl
          AddHandler add-footer .html .htm .php


          Which seems odd to me. What is add-footer? What is script.pl? That seems to be an example from the Apache site that would cause requests for files with the html extension to trigger the launch of the footer.pl CGI script. Why would you need that?



          Seems like that should be:



          AddHandler php5-script php


          So your whole Directory directive should be:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi .pl
          AddHandler php5-script php
          </Directory>


          EDIT: Since the original poster does want the add-footer functionality—now called backButton—it seems that this configuration would be the best way to handle; combine what I am doing above with with the original poster posted to begin with:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler php5-script .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>


          ANOTHER EDIT: Seems like there was a typo the first time with me setting php instead of .php for AddHandler php5-script .php. But also, try this instead using application/x-httpd-php5 instead of php5-script:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler application/x-httpd-php5 .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>





          share|improve this answer

























          • Sorry, your right. I can see where you are coming from. This is indeed of the Apache site but I forgot to change it to my situation. The name add-footer in my case is backButton and /script.pl is /backButton.cgi (which is a bash script). I have edited the post above. What I am trying to do is to add some html content to every .html, .htm and .php page in a specific directory. The catch is I can't edit the pages. The solution above does exactly what I want for .html and .htm pages but not .php pages. The .php page itself runs fine but the extra content is not added.

            – JamesStewy
            May 5 '14 at 6:50











          • @JamesStewy Oh, okay. Then look at my latest edit. Combine what I am doing with what you are attempting to do & it should work.

            – JakeGould
            May 5 '14 at 14:08











          • So, I added AddHandler php5-script php to my example in the original post and it didn't make a difference. The php page loads but the html isn't added in.

            – JamesStewy
            May 6 '14 at 1:51











          • Hmmm… How about AddHandler application/x-httpd-php5 .php Look at my edit. Made a typo previously as well.

            – JakeGould
            May 6 '14 at 2:02












          • No difference...

            – JamesStewy
            May 6 '14 at 3:03











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "2"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f593064%2fphp-files-not-working-with-addhandler-apache-2-4%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You have this set:



          Action add-footer /script.pl
          AddHandler add-footer .html .htm .php


          Which seems odd to me. What is add-footer? What is script.pl? That seems to be an example from the Apache site that would cause requests for files with the html extension to trigger the launch of the footer.pl CGI script. Why would you need that?



          Seems like that should be:



          AddHandler php5-script php


          So your whole Directory directive should be:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi .pl
          AddHandler php5-script php
          </Directory>


          EDIT: Since the original poster does want the add-footer functionality—now called backButton—it seems that this configuration would be the best way to handle; combine what I am doing above with with the original poster posted to begin with:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler php5-script .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>


          ANOTHER EDIT: Seems like there was a typo the first time with me setting php instead of .php for AddHandler php5-script .php. But also, try this instead using application/x-httpd-php5 instead of php5-script:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler application/x-httpd-php5 .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>





          share|improve this answer

























          • Sorry, your right. I can see where you are coming from. This is indeed of the Apache site but I forgot to change it to my situation. The name add-footer in my case is backButton and /script.pl is /backButton.cgi (which is a bash script). I have edited the post above. What I am trying to do is to add some html content to every .html, .htm and .php page in a specific directory. The catch is I can't edit the pages. The solution above does exactly what I want for .html and .htm pages but not .php pages. The .php page itself runs fine but the extra content is not added.

            – JamesStewy
            May 5 '14 at 6:50











          • @JamesStewy Oh, okay. Then look at my latest edit. Combine what I am doing with what you are attempting to do & it should work.

            – JakeGould
            May 5 '14 at 14:08











          • So, I added AddHandler php5-script php to my example in the original post and it didn't make a difference. The php page loads but the html isn't added in.

            – JamesStewy
            May 6 '14 at 1:51











          • Hmmm… How about AddHandler application/x-httpd-php5 .php Look at my edit. Made a typo previously as well.

            – JakeGould
            May 6 '14 at 2:02












          • No difference...

            – JamesStewy
            May 6 '14 at 3:03















          0














          You have this set:



          Action add-footer /script.pl
          AddHandler add-footer .html .htm .php


          Which seems odd to me. What is add-footer? What is script.pl? That seems to be an example from the Apache site that would cause requests for files with the html extension to trigger the launch of the footer.pl CGI script. Why would you need that?



          Seems like that should be:



          AddHandler php5-script php


          So your whole Directory directive should be:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi .pl
          AddHandler php5-script php
          </Directory>


          EDIT: Since the original poster does want the add-footer functionality—now called backButton—it seems that this configuration would be the best way to handle; combine what I am doing above with with the original poster posted to begin with:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler php5-script .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>


          ANOTHER EDIT: Seems like there was a typo the first time with me setting php instead of .php for AddHandler php5-script .php. But also, try this instead using application/x-httpd-php5 instead of php5-script:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler application/x-httpd-php5 .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>





          share|improve this answer

























          • Sorry, your right. I can see where you are coming from. This is indeed of the Apache site but I forgot to change it to my situation. The name add-footer in my case is backButton and /script.pl is /backButton.cgi (which is a bash script). I have edited the post above. What I am trying to do is to add some html content to every .html, .htm and .php page in a specific directory. The catch is I can't edit the pages. The solution above does exactly what I want for .html and .htm pages but not .php pages. The .php page itself runs fine but the extra content is not added.

            – JamesStewy
            May 5 '14 at 6:50











          • @JamesStewy Oh, okay. Then look at my latest edit. Combine what I am doing with what you are attempting to do & it should work.

            – JakeGould
            May 5 '14 at 14:08











          • So, I added AddHandler php5-script php to my example in the original post and it didn't make a difference. The php page loads but the html isn't added in.

            – JamesStewy
            May 6 '14 at 1:51











          • Hmmm… How about AddHandler application/x-httpd-php5 .php Look at my edit. Made a typo previously as well.

            – JakeGould
            May 6 '14 at 2:02












          • No difference...

            – JamesStewy
            May 6 '14 at 3:03













          0












          0








          0







          You have this set:



          Action add-footer /script.pl
          AddHandler add-footer .html .htm .php


          Which seems odd to me. What is add-footer? What is script.pl? That seems to be an example from the Apache site that would cause requests for files with the html extension to trigger the launch of the footer.pl CGI script. Why would you need that?



          Seems like that should be:



          AddHandler php5-script php


          So your whole Directory directive should be:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi .pl
          AddHandler php5-script php
          </Directory>


          EDIT: Since the original poster does want the add-footer functionality—now called backButton—it seems that this configuration would be the best way to handle; combine what I am doing above with with the original poster posted to begin with:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler php5-script .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>


          ANOTHER EDIT: Seems like there was a typo the first time with me setting php instead of .php for AddHandler php5-script .php. But also, try this instead using application/x-httpd-php5 instead of php5-script:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler application/x-httpd-php5 .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>





          share|improve this answer















          You have this set:



          Action add-footer /script.pl
          AddHandler add-footer .html .htm .php


          Which seems odd to me. What is add-footer? What is script.pl? That seems to be an example from the Apache site that would cause requests for files with the html extension to trigger the launch of the footer.pl CGI script. Why would you need that?



          Seems like that should be:



          AddHandler php5-script php


          So your whole Directory directive should be:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi .pl
          AddHandler php5-script php
          </Directory>


          EDIT: Since the original poster does want the add-footer functionality—now called backButton—it seems that this configuration would be the best way to handle; combine what I am doing above with with the original poster posted to begin with:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler php5-script .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>


          ANOTHER EDIT: Seems like there was a typo the first time with me setting php instead of .php for AddHandler php5-script .php. But also, try this instead using application/x-httpd-php5 instead of php5-script:



          <Directory / >
          Options +ExecCGI
          AddHandler cgi-script .cgi
          AddHandler application/x-httpd-php5 .php

          Action backButton /backButton.cgi
          AddHandler backButton .html .htm .php
          </Directory>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 6 '14 at 2:04

























          answered May 4 '14 at 23:03









          JakeGouldJakeGould

          3,2141836




          3,2141836












          • Sorry, your right. I can see where you are coming from. This is indeed of the Apache site but I forgot to change it to my situation. The name add-footer in my case is backButton and /script.pl is /backButton.cgi (which is a bash script). I have edited the post above. What I am trying to do is to add some html content to every .html, .htm and .php page in a specific directory. The catch is I can't edit the pages. The solution above does exactly what I want for .html and .htm pages but not .php pages. The .php page itself runs fine but the extra content is not added.

            – JamesStewy
            May 5 '14 at 6:50











          • @JamesStewy Oh, okay. Then look at my latest edit. Combine what I am doing with what you are attempting to do & it should work.

            – JakeGould
            May 5 '14 at 14:08











          • So, I added AddHandler php5-script php to my example in the original post and it didn't make a difference. The php page loads but the html isn't added in.

            – JamesStewy
            May 6 '14 at 1:51











          • Hmmm… How about AddHandler application/x-httpd-php5 .php Look at my edit. Made a typo previously as well.

            – JakeGould
            May 6 '14 at 2:02












          • No difference...

            – JamesStewy
            May 6 '14 at 3:03

















          • Sorry, your right. I can see where you are coming from. This is indeed of the Apache site but I forgot to change it to my situation. The name add-footer in my case is backButton and /script.pl is /backButton.cgi (which is a bash script). I have edited the post above. What I am trying to do is to add some html content to every .html, .htm and .php page in a specific directory. The catch is I can't edit the pages. The solution above does exactly what I want for .html and .htm pages but not .php pages. The .php page itself runs fine but the extra content is not added.

            – JamesStewy
            May 5 '14 at 6:50











          • @JamesStewy Oh, okay. Then look at my latest edit. Combine what I am doing with what you are attempting to do & it should work.

            – JakeGould
            May 5 '14 at 14:08











          • So, I added AddHandler php5-script php to my example in the original post and it didn't make a difference. The php page loads but the html isn't added in.

            – JamesStewy
            May 6 '14 at 1:51











          • Hmmm… How about AddHandler application/x-httpd-php5 .php Look at my edit. Made a typo previously as well.

            – JakeGould
            May 6 '14 at 2:02












          • No difference...

            – JamesStewy
            May 6 '14 at 3:03
















          Sorry, your right. I can see where you are coming from. This is indeed of the Apache site but I forgot to change it to my situation. The name add-footer in my case is backButton and /script.pl is /backButton.cgi (which is a bash script). I have edited the post above. What I am trying to do is to add some html content to every .html, .htm and .php page in a specific directory. The catch is I can't edit the pages. The solution above does exactly what I want for .html and .htm pages but not .php pages. The .php page itself runs fine but the extra content is not added.

          – JamesStewy
          May 5 '14 at 6:50





          Sorry, your right. I can see where you are coming from. This is indeed of the Apache site but I forgot to change it to my situation. The name add-footer in my case is backButton and /script.pl is /backButton.cgi (which is a bash script). I have edited the post above. What I am trying to do is to add some html content to every .html, .htm and .php page in a specific directory. The catch is I can't edit the pages. The solution above does exactly what I want for .html and .htm pages but not .php pages. The .php page itself runs fine but the extra content is not added.

          – JamesStewy
          May 5 '14 at 6:50













          @JamesStewy Oh, okay. Then look at my latest edit. Combine what I am doing with what you are attempting to do & it should work.

          – JakeGould
          May 5 '14 at 14:08





          @JamesStewy Oh, okay. Then look at my latest edit. Combine what I am doing with what you are attempting to do & it should work.

          – JakeGould
          May 5 '14 at 14:08













          So, I added AddHandler php5-script php to my example in the original post and it didn't make a difference. The php page loads but the html isn't added in.

          – JamesStewy
          May 6 '14 at 1:51





          So, I added AddHandler php5-script php to my example in the original post and it didn't make a difference. The php page loads but the html isn't added in.

          – JamesStewy
          May 6 '14 at 1:51













          Hmmm… How about AddHandler application/x-httpd-php5 .php Look at my edit. Made a typo previously as well.

          – JakeGould
          May 6 '14 at 2:02






          Hmmm… How about AddHandler application/x-httpd-php5 .php Look at my edit. Made a typo previously as well.

          – JakeGould
          May 6 '14 at 2:02














          No difference...

          – JamesStewy
          May 6 '14 at 3:03





          No difference...

          – JamesStewy
          May 6 '14 at 3:03

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f593064%2fphp-files-not-working-with-addhandler-apache-2-4%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

          What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

          Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos