.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;
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
add a comment |
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
add a comment |
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
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
php5 apache-2.4
edited May 5 '14 at 6:52
JamesStewy
asked May 4 '14 at 22:55
JamesStewyJamesStewy
167228
167228
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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>
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 nameadd-footerin my case isbackButtonand/script.plis/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 addedAddHandler php5-script phpto 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 aboutAddHandler application/x-httpd-php5 .phpLook 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
|
show 1 more comment
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
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 nameadd-footerin my case isbackButtonand/script.plis/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 addedAddHandler php5-script phpto 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 aboutAddHandler application/x-httpd-php5 .phpLook 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
|
show 1 more comment
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>
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 nameadd-footerin my case isbackButtonand/script.plis/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 addedAddHandler php5-script phpto 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 aboutAddHandler application/x-httpd-php5 .phpLook 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
|
show 1 more comment
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>
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>
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 nameadd-footerin my case isbackButtonand/script.plis/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 addedAddHandler php5-script phpto 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 aboutAddHandler application/x-httpd-php5 .phpLook 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
|
show 1 more comment
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 nameadd-footerin my case isbackButtonand/script.plis/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 addedAddHandler php5-script phpto 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 aboutAddHandler application/x-httpd-php5 .phpLook 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
|
show 1 more comment
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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