开发者

web browser not processing PHP code as PHP code

开发者 https://www.devze.com 2023-03-25 06:55 出处:网络
I have Joomla installed in my computer, but recently have been writing php files that aren\'t related to the Joomla-managed site. For some reason, when I try to open开发者_开发知识库 those php files i

I have Joomla installed in my computer, but recently have been writing php files that aren't related to the Joomla-managed site. For some reason, when I try to open开发者_开发知识库 those php files in the web browser using xampp (note: Joomla also is using xampp), the browser doesn't process the code w/in the tags as php code.

For example, after opening a basic page (a page with title "test", no content except in the body tags) in the web browser and going to the source code, the following is shows up in the source code:

<body>
<?php echo "hello"; ?>

</body>

instead of the HTML conversion. (i.e. just "hello")

Does anyone have an idea about what's going on here?

Thanks.


It's probably because PHP module isn't loaded in your apache. Be sure it is enabled


  1. PHP is interpreted in the server, not the browser. Whatever's going wrong, you need to look at the SERVER side to resolve it.

  2. My first guess: maybe you didn't suffix the file ".php" (so the server doesn't recognize it as a PHP file?)

  3. Second guess: is the directory containing your PHP files configured to parse PHP?

If you have Joomla, you probably have PHP. You probably also have Apache.

So check your Apache configuration, and check your file naming conventions.


Is the file extension .php? The server doesn't magically know when you're serving php files, this is a good way to ensure it knows what you're doing.


Apache is looking into your localhost's defined root directory for files it can parse. In this case htdocs. This is the default for XAMPP. As far as Apache is concerned, it will not interpret any files outside of that folder.


if the problem in php module it better to re install php5 in to the system and it will work fine. probably the problem is in php module you should try re installing php in your system.


Just restart httpd service. It will work fine.

sudo systemctl restart httpd.service

if it has not worked please reinstall PHP once again.

0

精彩评论

暂无评论...
验证码 换一张
取 消