Apache shows PHP code instead of executing it

前端 未结 26 2063
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 02:23

I have recently been trying to install PHP and Apache on my computer. After many hours, they\'re installed. I have modified the httpd.conf and php.ini files like everyone sa

26条回答
  •  梦谈多话
    2020-11-22 03:14

    This was happening to me also when running $_POST in MAMP. All of my .ini and httpd files were all set up correctly. If you are doing form handling and you have an html document and posting the info to a php formhandler running $POST, make sure that you are running the html file from localhost via your server, and not just locally.

    This was a shortcut I did to run html documents, by just clicking the html file in my directory and launching in my web browser, when in reality to check if php is being processed in your form, you must run your html through your servers. A very simple protocol that I overlooked.

    Example:

    Wrong: file:///Applications/MAMP/htdocs/form/form.html

    Right: http://localhost:your port number/form/form.html

    Now the php should be processed once you click your submit button

提交回复
热议问题