My PHP code is commented out

喜夏-厌秋 提交于 2019-12-11 03:50:33

问题


Before everything happened, I was running this wordpress install for developing themes using xampp. But I decided to upgrade the memory of this machine from 2GB to 6GB since I need extra room for applications. I back-up my code in a separate partition by copying them. Since I have a 32bit OS at the time, I format the computer and installed a 64bit version. All is well and fine the OS side.

When I setup my web dev environment something goes wrong.

When I imported my htdocs back, first by just fully copying them to a new fresh install of xampp and notice that all of the codes that put are not working. My CI code is displaying my PHP code in the browser. My theme in wordpress is also commenting out my PHP code when I view the source. The themes included in my fresh wordpress install works so there's something I am missing here.

From the looks of it, the php is being executed properly since anything that I install works. Just that the ones that came from a previous xampp is not.


回答1:


Open up the php.ini file and set short_open_tag = On. Then restart apache.




回答2:


If you are opening a local script directly in the web browser, maybe through your editor, double-clicking on the file or dragging and dropping the file ito the browser - it will be treated as HTML only.

Instead, open the file by typing... http://localhost/your-file.php into the address bar. I personally create a projects folder in the htdocs folder and then create a bookmark for... http://localhost/projects/ and this will display all my projects that are saved into my projects folder.

Note: if you changed the mail port for the Apache server, you will need to add that to the path as well. eg. If your main port is 8888, your would do this... http://localhost:8080/your-file.php

I had the same problem and this worked for me. Good Luck



来源:https://stackoverflow.com/questions/12561993/my-php-code-is-commented-out

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!