search

Home  >  Q&A  >  body text

The PHP program runs normally in the root directory, but a 500 error occurs in the subdirectory.

The PHP program in the root directory of my website can run normally, but in the subdirectory (English version directory), a 500 error occurs whenever the PHP program is run.

I specially made one

<?PHP

echo "This is a PHP test";

?>

Test this sentence and put it in the root directory. It runs normally. If you put it in a subdirectory, the same 500 error occurs, indicating that it is not a problem with the PHP code, but a problem with where it is set.

Please give me some advice, I am a PHP newbie.

汤兆胜***汤兆胜***1020 days ago1242

reply all(3)I'll reply

  • 大瓶可乐@php.cn

    大瓶可乐@php.cn2022-02-09 11:48:39

    Open the php error report and you can clearly see the cause of the error

    reply
    0
  • autoload

    autoload2022-02-07 09:15:33

    To see if it is a path problem, take a look at the php error log

    reply
    0
  • 汤兆胜***

    The key is that it has not been touched. It was fine before. It seems that the server automatically upgraded from PHP5.X to PHP7.X and then something went wrong.

    汤兆胜*** · 2022-02-07 10:56:37
  • Cancelreply