Jump to content

Recommended Posts

Hello guys, I m trying to run a simple php code.

I have Apache Tomcat/6.0.18 running in Linux.

I dont know if it is php enabld or not.

i've created a hello.php file:

<html>
<body>
<p>This is going to be ignored.</p>
<?php echo 'While this is going to be parsed.'; ?>
<p>This will also be ignored.</p>
</body>
</html>

 

and put this file in the ../webapps/root dir.

When i run the file , this is the output:

This is going to be ignored.

This will also be ignored.

 

I dont know where the problem is?

Thank you.

Link to comment
Share on other sites

If you do a View Source on the page, do you see the PHP code? I'm guessing it's not PHP enabled. Since PHP tags looks like HTML, it might interpret it as an HTML tag and therefore not showing it on the generated page.

Link to comment
Share on other sites

hello all. I edited the httpd.conf file and added this:

LoadModule php4_module modules/libphp4.so
LoadModule php5_module modules/libphp5.so

In the giude it says:

   Tell Apache to parse certain extensions as PHP.  For example, let's have
   Apache parse .php files as PHP.  Instead of only using the Apache AddType
    directive, we want to avoid potentially dangerous uploads and created
    files such as exploit.php.jpg from being executed as PHP.  Using this
    example, you could have any extension(s) parse as PHP by simply adding
    them.  We'll add .phtml to demonstrate.
      <FilesMatch \.php$>
          SetHandler application/x-httpd-php
      </FilesMatch>

Now where do i add this?

Thank you.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.