abhi_elementx Posted June 16, 2009 Share Posted June 16, 2009 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. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 16, 2009 Share Posted June 16, 2009 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. Quote Link to comment Share on other sites More sharing options...
abhi_elementx Posted June 17, 2009 Author Share Posted June 17, 2009 hi. I can see the source file. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 17, 2009 Share Posted June 17, 2009 k, so you don't have PHP installed/enabled http://www.php.net/manual/en/install.unix.php Quote Link to comment Share on other sites More sharing options...
abhi_elementx Posted June 17, 2009 Author Share Posted June 17, 2009 Hi. Well since i m new to this, i dont get the instructions. Actually I have Netbeans installed and apache was installed at that time. So how do i find that php is installed/enabld or not? Thank you. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 17, 2009 Share Posted June 17, 2009 well, which Linux are you using? if you type the command 'which php' into the terminal, does it respond back with a path? Quote Link to comment Share on other sites More sharing options...
abhi_elementx Posted June 17, 2009 Author Share Posted June 17, 2009 I m using fedora9. I ran the command which php and it returned: /usr/bin/php Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 17, 2009 Share Posted June 17, 2009 k, so PHP is on there. Now just follow from the install from step 14 on: http://www.php.net/manual/en/install.unix.apache2.php Quote Link to comment Share on other sites More sharing options...
abhi_elementx Posted June 17, 2009 Author Share Posted June 17, 2009 How to find out which version of php is installed (php 4/5)? Quote Link to comment Share on other sites More sharing options...
smerny Posted June 17, 2009 Share Posted June 17, 2009 phpversion(); Quote Link to comment Share on other sites More sharing options...
abhi_elementx Posted June 17, 2009 Author Share Posted June 17, 2009 where do i type this phpversion();? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 17, 2009 Share Posted June 17, 2009 on the command line in linux you can do: php -v Quote Link to comment Share on other sites More sharing options...
smerny Posted June 17, 2009 Share Posted June 17, 2009 where do i type this phpversion();? between "<?php" and "?>" on a .php page saved on the server you are using Quote Link to comment Share on other sites More sharing options...
abhi_elementx Posted June 19, 2009 Author Share Posted June 19, 2009 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. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 22, 2009 Share Posted June 22, 2009 that also goes in the httpd.conf file Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.