Reputation: 199
I am setting up a new website.
I am hosting it by myself in a linode node. The site is already up and running.
I installed nginx running on the port 80, and apache running on the port 8001.
My problem is that when I do the AJAX call, the response (responseText) is the whole php code. I don't understand how to make it run through Apache.
I haven't done any configuration to apache other than changing the port to not collide with the nginx.
apache2 installed, nginx installed.
function getSuccessOutput() {
$.ajax({
method: 'get',
url:'test.php',
complete: function (response) {
console.log(response.responseText);
$('#output').html(response.responseText);
},
error: function () {
$('#output').html('Bummer: there was an error!');
},
});
return false;
}
In the console I get the full php script.
The PHP finishes with an echo $result. If I run it with php -f in the server outputs the result OK.
I just need the result in the responseText, I will see how to handle it later.
I am not understanding how to make the code run on apache, I understand it needs to get interpreted by someone, but I don't know how to do it.
Thanks!
Upvotes: 0
Views: 74
Reputation: 1406
Check your php file, if there is an open tag in the beginning of the file:
<?php
Do not use short open tags because it is only available if enabled using the short_open_tag in the php.ini configuration file.
<?
Upvotes: 1