How to open the PHP file?
How to open the PHP file? Php full-Simplified Hypertext Preprocessor is named Hypertext Preprocessor in Chinese. It can perform some algorithm operations like c, c ++, java, and perl, and php is mainly used in web application development, php is easy to learn and widely used. It is mainly applicable to the Web development field. PHP file Suffix: php.
What is a PHP file?
How to open the PHP file? Php full-Simplified Hypertext Preprocessor is named Hypertext Preprocessor in Chinese. It can perform some algorithm operations like c, c ++, java, and perl, and php is mainly used in web application development, php is easy to learn and widely used. It is mainly applicable to the Web development field. PHP file Suffix: php.
How to open the PHP file?
PHP file opening method is very simple. We can simply use Notepad text to open it. If it is a WEB development application, we can use dw Notepad ++ Eclipse PDT Notepad2 and so on, you can only view the source file and cannot execute this operation.
How to run php files
Php is a programming language in the Web development field. We need the support of the php environment to run php.
Which of the following are available in the php environment?
Php can be run in windows or linux. iis + php or apache + php environments are supported in windows.
In linux, I can also use the apache + php or nginx + php environment.
How to configure the php Environment
Iis + php environment configuration method
1> decompress the package to the c:/php Directory.
Open the c:/php Directory and find the php. ini-dist file. rename it php. ini.
2> open the php. ini file.
Find; include_path = "..; c:/php/shortdes.
Change to include_path = "c:/php/shortdes"
Find extension_dir = "./"
Change to extension_dir = "c:/php/ext"
Find; extension = php_mysql.dll
Change to extension = php_mysql.dll
Find; session. save_path = "/tmp"
Change to session. save_path = "c:/winnt/temp"
If the operating system is win2003, it is "c:/windows/temp"
Php. ini is provided in this directory and can be used directly. It is applicable to windows2000.
3> copy php. ini to c:/winnt
Copy libmysql. dll to c:/winnt/system32
4> Create a Directory d:/forphp to test the php website directory.
Create a new notepad file in this directory and rename it index. php to the index. php file in this directory.
5> make sure that the Iusr_mochinename user has full control over d:/forphp.
Permission to read and run c:/php. (If drive d is in the fat32 file system format, you do not need to set d:/forphp permission)
6> open the iis manager.
Create a web site. Point to the d:/forphp directory. Specify any site Host Header. (For convenient browsing, use the local ip address)
7> right-click the site -- properties -- "main directory" option.
Click "configuration" below. "application configuration" is displayed, click "add". executable file, browse and select c:/php/php5isapi. dll to confirm. Write. php Extension
8> restart IIS to support php scripts for iis sites.
PHP and IIS coexistence settings
The first step is to uncompress the PHP5.0 compressed package and place it under C:/PHP5.
Step 2: copy the php. ini-dist file under C:/PHP5 to the WINNT directory and change it to php. ini. You can run it without modifying any parameters. You can modify some parameters according to different situations.
Step 3: Copy C:/PHP5/php5ts. dll to the C:/WINNT/system32 directory.
Step 4: Start computer management.
Step 5: Expand "services and applications"/"Internet Information Services" in the Computer Management window, right-click the "Default Web site", and select Properties, the "Default Web site properties" window is displayed:
Step 7: click "ISAPI filter" in the "Default Web site properties" window and click "add, in the pop-up "Filter Properties" window, enter "PHP" in "Filter Name", and enter "C:/PHP5/sapi/php5isapi" in "Executable File. dll ", OK.
Step 8: click the "main directory" tab in the "Default Web site properties" window, click the "configuration" button, and click the "add" button in the "Application configuration" window that appears, in the displayed "Add/edit application extension image" dialog box, enter "C:/PHP5/sapi/php5isapi" in the "executable file" text box. dll, enter ". php "(Be sure to have that point), OK.
Step 9: Open the command line window and enter the "net stop iisadmin" command to terminate the IIS service. The system will ask you if you want to stop the related services. A: Yes. Wait until all are closed.
Step 10: Enter the "net start w3svc" command to restart the IIS service.
Configure the php environment in apache
1. We installed the apache environment on the computer,
2. Download the php version and decompress it in the C: disk php Directory.
Then we add
LoadModule php5_module "c:/php5/php5apache2_2.dll"
AddType application/x-httpd-php. php
PHPIniDir "c:/php5"
Restart apache and configure it.
Then, create a website and put the php file under the website directory to run the Code as follows:
Define ("test", "hello world! ");
Echo test
?>
The output is
HELLO WORLD
Friendly reminder: This article only roughly introduces some ideas about what php files are and how to enable php to run and append php files, if you really want to run php, we still need to configure the apache environment in more detail, because the real application also has the installation configuration of the mysql database.