简体   繁体   中英

PHP script doesn't execute on Apache server

I have a very simple PHP script on a remote Apache web server. On my PC, it functions perfectly fine with php web server running but nothing appears to be executing in the web server and there appears to be no errors. I have a good suspicion that this is a configuration issue. Please advise!

httpd.conf contains the following lines

LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php
AddType application/x-httpd-php .php

Apache is (I believe) properly installed. Running apachectl -V shows me info, as expected:

Server version: Apache/2.2.15 (Unix)
Server built: XXX X XXXX XX:XX:XX
...

And PHP appears to also be properly installed. Running php -v shows me version info, as expected:

PHP 5.3.3 (cli) (build: XXX X XXXX XX:XX:XX)
...

I have tried the steps given by the answer to this question . As far as I know, the above configurations should a have worked. I may be wrong, but I don't have reason to suspect that there is anything wrong with the Javascript (making requests) or the PHP script because they work on my PC. Is there something I've missed in the configuration? If I've failed to provide enough details, please let me know.

Thanks in advance!

EDIT 1

PHP script:

<?php
    error_reporting(E_ALL);
    ini_set('display_errors', 1);

    $xml = file_get_contents("php://input");
    $xmlDoc = simplexml_load_string($xml);
    $xmlDoc -> asXml("someData.xml");
?>

I'd look for errors in the console for the JavaScript.

If there are none I would try to run the PHP by itself. Add error reporting to the top of your PHP file(s) right after your opening

If that doesn't reveal anything add some XML error handling as outlined here - http://php.net/manual/en/simplexml.examples-errors.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM