Extension PHP5 does not parse in XAMPP
XAMPP passes by default files with the following extensions to PHP: .php .php5 .php4 .php3 .phtml .phpt (this was tested with XAMPP Lite 1.6.8).
My suggestion would be to remove the "AddType text/html .php5" line from the XAMPP configuration. Alternatively, use a clean install of XAMPP and look at the differences (with something like WinMerge).
XAMPP not parsing PHP
I think you might be using short tag <? ?>
or <?= ?>
instead of <?php ?>
.
Check your php.ini. It locates at \path\to\xampp\php\php.ini. The short_open_tag
should be On.
; Allow the
<?
tag. Otherwise, only<?php
and<script>
tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable,redistributable code, be sure not to use short tags.
short_open_tag = On
html and php syntax in the same file not working xampp configuration
Not sure what the issue was. But I uninstalled xampp & installed it again. It is working fine now.
xampp - php not being interpreted when part of an html file
Assuming you've got xampp installed in the root of C (the default location)...
I wouldn't really recommend it as it adds an unnecessary overhead on actual HTML files but you can do it ... in C:/xampp/apache/conf/extra/httpd-xampp.conf
you should see something that looks like:
#
# PHP-Module setup
#
LoadFile "C:/xampp/php/php5ts.dll"
LoadModule php5_module "C:/xampp/php/php5apache2_4.dll"
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
You can tell Apache to treat .html files as PHP by adding a new FilesMatch directive:
<FilesMatch "\.html$">
SetHandler application/x-httpd-php
</FilesMatch>
Or you can do it by adding an .htaccess
file into your document root that contains something like AddHandler application/x-httpd-php .html
There are much better ways to do it though, use RESTful URLs for instance (and thereby avoid having the file-type even hinted at) and keep all your PHP files as .php
- but you'll probably need to get into the dark arts of Apache mod_rewrite for that.
php windows server 2012 how to show loaded extension
Create a file in htdocs folder with this content, then access it by browser
<?php
echo '<pre>';
print_r(get_loaded_extensions());
or
<?php
phpinfo();
Output:
Array
(
[0] => Core
[1] => bcmath
[2] => calendar
[3] => ctype
[4] => date
[5] => ereg
[6] => filter
[7] => ftp
[8] => hash
[9] => iconv
[10] => json
[11] => mcrypt
[12] => SPL
...
)
Accessing by command line
At keyboard press winkey + break/pause, go on advanced settings, then create a new environment variable with name PHP_HOME
value must be the php path, after this edit the variable path
, put the cursor at end and add ;%PHP_HOME%;
confirm all operations, open a new cmd, try php -v
Related Topics
Woocommerce New Order Action - Get Order Information
Symfony: Change Database Dynamically
Why Does 'Intval(19.9 * 100)' Equal '1989'
Derived Class Defined Later in the Same File "Does Not Exist"
How to Curry Method Calls in PHP
Nohup on Windows, Exec Without Waiting for Finish
Pdo Mssql Server - Driver Not Found
Adjusting Time Zone in PHP with Datetime/Datetimezone
Upload Images Through PHP Using Unique File Names
File_Get_Contents Is Not Working for Some Url
Alternative for Deprecated PHP Function: Eregi_Replace
Utf-8 Characters in Preg_Match_All (Php)
PHP Flush Stopped Flushing in Iis7.5
Set Value of Single Object in Multidimensional Array in Twig Template