.php files not working with AddHandler - Apache 2.4 Announcing the arrival of Valued Associate...
Stop battery usage [Ubuntu 18]
Aligning matrix of nodes with grid
Why don't the Weasley twins use magic outside of school if the Trace can only find the location of spells cast?
3 doors, three guards, one stone
Can the prologue be the backstory of your main character?
If I can make up priors, why can't I make up posteriors?
How to market an anarchic city as a tourism spot to people living in civilized areas?
What are the performance impacts of 'functional' Rust?
Can smartphones with the same camera sensor have different image quality?
Estimate capacitor parameters
Is it possible to ask for a hotel room without minibar/extra services?
Can I throw a sword that doesn't have the Thrown property at someone?
Why does this iterative way of solving of equation work?
How can I make names more distinctive without making them longer?
How to say that you spent the night with someone, you were only sleeping and nothing else?
Is above average number of years spent on PhD considered a red flag in future academia or industry positions?
How do I automatically answer y in bash script?
Was credit for the black hole image misattributed?
Fishing simulator
Passing functions in C++
Complexity of many constant time steps with occasional logarithmic steps
What do you call a plan that's an alternative plan in case your initial plan fails?
How are presidential pardons supposed to be used?
Autumning in love
.php files not working with AddHandler - Apache 2.4
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm 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
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
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
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
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
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 13 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
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