: This article mainly introduces how to create a new php project so that it can be accessed directly in a browser. if you are interested in the PHP Tutorial, refer to it. Environment
Let's talk about the environment. I use eclipse and the server is nginx.
Tools
Procedure
Create a php project
All the Waynext
The following content is not modified.
Then add the php file
Write test content at will. Mine is like this:
Configure nginx
In the nginx conf folder, there is a main. conf file, which can be modified directly. of course, we recommend creating a conf file by ourselves.
Create a vhosts folder in the conf folder to store the conf file of the php website.
Now we create a new php-test.conf file in the vhosts folder.
Edit the content.
Copy the content of main. conf and modify it.
My final content is as follows:
server { listen 80; server_name www.php-test.com; root D:/Code/php-test; index index.php; charset utf-8; access_log F:/DevEnv/logs/php-test.access.log main; error_log F:/DevEnv/logs/php-test.error.log;# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9001 location ~ \.php$ { try_files $fastcgi_script_name = 404; fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root# concurs with nginx's one location ~ /\.ht { deny all; }}
By comparing the main. conf file, you will know where to modify it. you can modify it as needed.
server_name
Actually write127.0.0.1
I modified the hosts file of the system to direct it127.0.0.1
. So the results are the same.
Save the conf file.
Start nginx and php, and then you can access it in the browser.
Let's test it. enterhttp://www.php-test.com/index.php
[PS:www.php-test.com
Replace it with your newly writtenserver_name
Then you can see the running result.
Note that if you enable eclipse, you may switch to the debugging mode. you can view the result by jumping out of the debugging.
PS: In fact, eclipse must be configured to implement php single-step debugging. this will be discussed in the next article.
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ (''). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; scriptThe above describes how to create a new php project so that it can be accessed directly in a browser, including some content, and hope to help friends who are interested in PHP tutorials.