Page 1 of 2

Php code is showing in browser instead of executing

PostPosted: 01. January 2019 05:42
by delrashmi
I am beginner & have installed Xampp in windows 10 & its working fine ,ie i can access my localhost.But whenever i tried to execute my php file(in htdocs folder) same code is shown in browser .Whats the problem.Thanks in advance for any help /suggestions.

Re: Php code is showing in browser instead of executing

PostPosted: 01. January 2019 10:41
by Altrea
Which URL did you type into your browser to request your php file?

Re: Php code is showing in browser instead of executing

PostPosted: 01. January 2019 10:56
by delrashmi
localhost/folder name/file name.php

Re: Php code is showing in browser instead of executing

PostPosted: 01. January 2019 11:50
by Altrea
Does your code use short open tags "<?" instead of the full one "<?php"?

Re: Php code is showing in browser instead of executing

PostPosted: 01. January 2019 12:17
by delrashmi
i am using the simple code as:<?php phpinfo(); ?>

Re: Php code is showing in browser instead of executing

PostPosted: 01. January 2019 12:27
by Nobbie
delrashmi wrote:localhost/folder name/file name.php


Please provide the full and real URL you enter into the browser.

Re: Php code is showing in browser instead of executing

PostPosted: 01. January 2019 12:43
by delrashmi
localhost/rashmi/test.php

Re: Php code is showing in browser instead of executing

PostPosted: 01. January 2019 13:17
by Altrea
Which character encoding is your file saved in?

Re: Php code is showing in browser instead of executing

PostPosted: 02. January 2019 06:57
by delrashmi
Sorry what did u say,i just can not understand it

Re: Php code is showing in browser instead of executing

PostPosted: 02. January 2019 08:09
by Altrea
Which editor do you use to create/edit your PHP files?
This editor has a setting for the character encoding (UTF-8, ISO-8859-1, etc.).
Here it is important that the PHP interpreter is unable to parse PHP files created with non-ANSI based encodings like UCS2 big endian.
That is the last known reason for not parsed custom made php code while the default dashboard is working well.

Is there a possibility that you can provide us your current xampp installation including this php file as zipped version via Dropbox or similar?

Re: Php code is showing in browser instead of executing

PostPosted: 02. January 2019 10:51
by Nobbie
Is there a .htaccess file in folder rashmi? Copy test.php into htdocs folder (one step over rashmi) and enter http://localhost/test.php into your browser. What happens then?

Re: Php code is showing in browser instead of executing

PostPosted: 02. January 2019 13:53
by delrashmi
i simply use my notepad & right now i do not have my laptop with me ,will send you tomorrow.

Re: Php code is showing in browser instead of executing

PostPosted: 03. January 2019 06:55
by delrashmi
No there is no such file in folder rashmi & when i paste the file test.php in htdocs folder it gives me error as--
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404
localhost
Apache/2.4.37 (Win32) OpenSSL/1.0.2p PHP/7.0.33

Also the document which i have saved in htdocs test.php is showing -document type as text document.

Re: Php code is showing in browser instead of executing

PostPosted: 03. January 2019 07:36
by Altrea
So your file is probably not saved as text.php but as text.php.txt?
And your windows is configured to hide known file extensions?

Re: Php code is showing in browser instead of executing

PostPosted: 03. January 2019 08:48
by delrashmi
yes this is what is going on,now what i have to do now.