glassfish Posted August 30, 2014 Share Posted August 30, 2014 <body> <?php Echo "Hello World!"; ?> <h1> The headline here</h1> </body> The above os an example. The problem can be read in title. When clicking on View Source Code in the web browser the PHP tags are still there, which means they have not gotten processed. Why does this happen? Using Apache (XAMP). Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/ Share on other sites More sharing options...
Digitizer Posted August 30, 2014 Share Posted August 30, 2014 that is something to do with xampp configuration i guess Make sure your file has the .php extension on it, otherwise it will not be executed as PHP. Make sure that the PHP module is listed and uncommented inside of your Apache's httpd.conf This should be something like LoadModule php5_module "c:/php/php5apache2_2.dll" in the file. Search for LoadModule php, and make sure that there is no comment ( in front of it. Make sure that the http.conf file has the PHP MIME type in it. This should be something like AddType application/x-httpd-php .php. This tells Apache to run .php files as PHP. Search for AddType, and then make sure there is an entry for PHP, and that it is uncommented. Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489357 Share on other sites More sharing options...
Ch0cu3r Posted August 30, 2014 Share Posted August 30, 2014 XAMPP comes with everything preconfigured so there should not be any issues with running your PHP code. I think the problem is you have loaded your .php file directly into the browser (ie the address bar starts with file://) This is not how you run your PHP files. You need to first check you have saved your php files in XAMPP's htdocs folder (I assume for windows its C:/XAMPP/htdocs ) now run your php files by accessing http://localhost/yourfile.php Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489359 Share on other sites More sharing options...
glassfish Posted August 30, 2014 Author Share Posted August 30, 2014 I have tried it when using an HTML file. Are there issues when doing this? Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489361 Share on other sites More sharing options...
Digitizer Posted August 30, 2014 Share Posted August 30, 2014 I have tried it when using an HTML file. Are there issues when doing this? As I said, PHP Tags do not work if file extension is *.html or *.htm For php tags to get parsed, the file must be in *.php extension. as @Ch0cu3r said, it must be in a folder in htdocs folder and try opening it in broswer as localhost/<folder_name> Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489362 Share on other sites More sharing options...
CroNiX Posted August 30, 2014 Share Posted August 30, 2014 As I said, PHP Tags do not work if file extension is *.html or *.htm For php tags to get parsed, the file must be in *.php extension. That's not true. You can tell apache to parse any file extension as php, but Apache has to be set up that way using the AddType directive. Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489378 Share on other sites More sharing options...
Digitizer Posted August 30, 2014 Share Posted August 30, 2014 Thanks mate, didnt know that well, he still has to learn howto's... anyway.. let see what he comes up with Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489385 Share on other sites More sharing options...
glassfish Posted August 30, 2014 Author Share Posted August 30, 2014 (edited) Here are videos showing it: https://www.youtube.com/watch?v=qRaz1CRMGEg https://www.youtube.com/watch?v=XJYtIZ2Aqqo Again, the processing of the PHP tags do not happen to myself (with this topic). Edited August 30, 2014 by glassfish Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489386 Share on other sites More sharing options...
Ch0cu3r Posted August 30, 2014 Share Posted August 30, 2014 Here is a video showing it: https://www.youtube.com/watch?v=qRaz1CRMGEg Again, the processing of the PHP tags do not happen to myself (with this topic). What? You saying the code used in that video does not work for you? Instead you see the PHP code? Can you tells us Where are you saving the php files to How are you accessing the php files in your browser? Ensured XAMPP is running Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489388 Share on other sites More sharing options...
ginerjm Posted August 30, 2014 Share Posted August 30, 2014 What the h... is this video supposed to do with your problem????! OK - just tell us. What is the name of this script file? Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489389 Share on other sites More sharing options...
Digitizer Posted August 30, 2014 Share Posted August 30, 2014 something is forcing me to believe the fact that he doesnt have apache/mysqld services runnning, instead trying the files as html would open without any other services Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489393 Share on other sites More sharing options...
glassfish Posted August 30, 2014 Author Share Posted August 30, 2014 (edited) This topic is answered. Thanks for the posts. Where can I mark this topic as "Answered"? Edited August 30, 2014 by glassfish Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489399 Share on other sites More sharing options...
Ch0cu3r Posted August 30, 2014 Share Posted August 30, 2014 Where can I mark this topic as "Answered"? Click the button at the bottom right hand corner of the post Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489402 Share on other sites More sharing options...
ginerjm Posted August 30, 2014 Share Posted August 30, 2014 What was the answer? Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489405 Share on other sites More sharing options...
glassfish Posted August 31, 2014 Author Share Posted August 31, 2014 What was the answer? I have opted to using the HTML in a PHP file, which means using HTML in PHP without the "echo". Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489443 Share on other sites More sharing options...
ginerjm Posted August 31, 2014 Share Posted August 31, 2014 (edited) Since your script didn't work for you I'm guessing it was not truly a PHP file. Sounds to me like you haven't solved the problem but are moving on. Good luck on your journey. Edited August 31, 2014 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489449 Share on other sites More sharing options...
glassfish Posted August 31, 2014 Author Share Posted August 31, 2014 What was the answer? I have opted to using the HTML in a PHP file, which means using HTML in PHP without the "echo". Quote Link to comment https://forums.phpfreaks.com/topic/290749-php-html-apache-xamp-inline-php-tags-do-not-get-processed/#findComment-1489500 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.