.php file shows code in Chrome

I have a registration page that I extracted from the following site . I downloaded the source code and extracted the file by finding login.php . I open it in Adobe Dreamweaver CS3, which downloads it and does not show the code, but when I click "Preview" in Chrome, Chrome shows all the code in the file that is shown below. When I click "Preview" in iExplore, it does the same. Am I doing something wrong or is there something I don’t have on my laptop? I did not put the rest of the code for the webpage because I feel it is more flexible when I cut out the php code and tested it on the page. It is simple when I embed PHP code. After PHP is the normal code that Dreamweaver places at the beginning of a new HTML or PHP file.

 <?PHP require_once("./include/membersite_config.php"); if(isset($_POST['submitted'])) { if($fgmembersite->Login()) { $fgmembersite->RedirectToURL("login-home.php"); } } ?> 
+4
source share
4 answers

To display PHP on your computer, you need to configure a local PHP server. Without it, there is no PHP mechanism that can interpret and parse your code so that it gets into HTML for the browser.

If you do not have a PHP server installed locally, you will need to upload your files to the server via FTP, where PHP is installed.

+6
source

The PHP file must be interpreted by the web server (you can use XAMPP, which is a popular set of servers for Windows, including the Apache HTTP server, the MySQL database server, and the PHP extension for Apache).

The server executes the PHP code and sends the script output / result via the http protocol to the web browser.

Opening this file through the file system is a bad idea because the PHP file will be read as plain text if it is not processed by the web server with PHP.

You don't seem to understand how PHP works. You need to read some books on the basics of websites.

After all, you can visit http://thenewboston.org or http://phpacademy.org - they have very good educational videos.

One more tip:

In my personal opinion, Dreamwaver is a very bad tool for learning PHP. For educational purposes, I recommend using Notepad ++ or another IDE (possibly a version of NetBeans PHP). This will help you understand more.

How to debug php code in Dreamweaver cs5?

+1
source

To analyze the PHP code, you need a local web server with a PHP interpreter. There are several to choose from. I personally use WAMP. Once it is installed, place your php files in the wamps www folder and navigate to it in your browser using http://127.0.0.1/yourphpfilename.php

Then it should display php output instead of code.

+1
source

To run this type of file you must have Apache (Web Server) + PHP (interpreter). It will be resolved using something like XAMPP (you can use it.)

0
source

All Articles