Php code is showing in browser instead of executing

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Php code is showing in browser instead of executing

Postby delrashmi » 01. January 2019 05:42

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.
delrashmi
 
Posts: 14
Joined: 01. January 2019 05:32
XAMPP version: 3.2.2
Operating System: window10,64bit

Re: Php code is showing in browser instead of executing

Postby Altrea » 01. January 2019 10:41

Which URL did you type into your browser to request your php file?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 9861
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Php code is showing in browser instead of executing

Postby delrashmi » 01. January 2019 10:56

localhost/folder name/file name.php
delrashmi
 
Posts: 14
Joined: 01. January 2019 05:32
XAMPP version: 3.2.2
Operating System: window10,64bit

Re: Php code is showing in browser instead of executing

Postby Altrea » 01. January 2019 11:50

Does your code use short open tags "<?" instead of the full one "<?php"?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 9861
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Php code is showing in browser instead of executing

Postby delrashmi » 01. January 2019 12:17

i am using the simple code as:<?php phpinfo(); ?>
delrashmi
 
Posts: 14
Joined: 01. January 2019 05:32
XAMPP version: 3.2.2
Operating System: window10,64bit

Re: Php code is showing in browser instead of executing

Postby Nobbie » 01. January 2019 12:27

delrashmi wrote:localhost/folder name/file name.php


Please provide the full and real URL you enter into the browser.
Nobbie
 
Posts: 11219
Joined: 09. March 2008 13:04

Re: Php code is showing in browser instead of executing

Postby delrashmi » 01. January 2019 12:43

localhost/rashmi/test.php
delrashmi
 
Posts: 14
Joined: 01. January 2019 05:32
XAMPP version: 3.2.2
Operating System: window10,64bit

Re: Php code is showing in browser instead of executing

Postby Altrea » 01. January 2019 13:17

Which character encoding is your file saved in?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 9861
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Php code is showing in browser instead of executing

Postby delrashmi » 02. January 2019 06:57

Sorry what did u say,i just can not understand it
delrashmi
 
Posts: 14
Joined: 01. January 2019 05:32
XAMPP version: 3.2.2
Operating System: window10,64bit

Re: Php code is showing in browser instead of executing

Postby Altrea » 02. January 2019 08:09

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?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 9861
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Php code is showing in browser instead of executing

Postby Nobbie » 02. January 2019 10:51

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?
Nobbie
 
Posts: 11219
Joined: 09. March 2008 13:04

Re: Php code is showing in browser instead of executing

Postby delrashmi » 02. January 2019 13:53

i simply use my notepad & right now i do not have my laptop with me ,will send you tomorrow.
delrashmi
 
Posts: 14
Joined: 01. January 2019 05:32
XAMPP version: 3.2.2
Operating System: window10,64bit

Re: Php code is showing in browser instead of executing

Postby delrashmi » 03. January 2019 06:55

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.
delrashmi
 
Posts: 14
Joined: 01. January 2019 05:32
XAMPP version: 3.2.2
Operating System: window10,64bit

Re: Php code is showing in browser instead of executing

Postby Altrea » 03. January 2019 07:36

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?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 9861
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Php code is showing in browser instead of executing

Postby delrashmi » 03. January 2019 08:48

yes this is what is going on,now what i have to do now.
delrashmi
 
Posts: 14
Joined: 01. January 2019 05:32
XAMPP version: 3.2.2
Operating System: window10,64bit

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 73 guests