The content of this article is the configuration of PHP and nginx environments. I share it with everyone here and give a reference to friends in need
<br>
##php+ nginx environment configuration
<br>
<br>
1. First, you need to prepare the application package. nginx: nginx/Windows-1.0.4 php:php-5.2.16-nts-Win32-VC6-x86.zip (php under nginx runs in FastCGI mode, so We download the non-thread-safe php package of nts) (will also be used) RunHiddenConsole: RunHiddenConsole.zip2. Installation and configuration. 1) Installation and configuration of php. Directly decompress the downloaded php package and go to the PHP directory on drive D (D:\PHP). Here, rename the decompressed folder to php7. Enter the folder and modify the php.ini-recommended file to php.ini, and open it with Wordpad. Find thephp configuration file php.ini and save it.
<br>
Search for "extension_dir" and find: e;xtension_dir = "ext" First remove the semicolon in front and change it to extension_dir = "C:\wnmp\php \ext"Search for "date.timezone" and find: ;date.timezone = Remove the preceding semicolon first and then change it to date.timezone = Asia/ShanghaiSearch for "enable_dl", Found: enable_dl = Off Change to enable_dl = OnSearch for "cgi.force_redirect"; cgi.force_redirect = 1 First remove the semicolon in front and then change it to cgi.force_redirect = 0Search for " fastcgi.impersonate", find: ;fastcgi.impersonate = 1 Remove the preceding semicolon Search for "cgi.rfc2616_headers", find: ;cgi.rfc2616_headers = 0 Remove the preceding semicolon first and then change it to cgi. rfc2616_headers = 1 Search for "php_mysql" and find: "extension=php_mysql.dll and extension=php_mysqli.dll Remove the previous ";"extension=php_mysql.dll and extension=php_mysqli. dll (supports MYSQL database) Please change other configurations according to your own needs<br>
##Among them. php_mysql means: <br> <br> ##;extension=php_mysql.dll;extension=php_mysqli.dll libmysql.dll file in the php5 directory to the C:\Windows directory. You can also specify the path in the system variable. Of course, I chose it here for more convenience. Method ^_^. #At this point, php can already support mysql. Next we configure php so that php can be combined with nginx. Find
##<br>
<br>
<br>
<br>
;cgi.fix_pathinfo=1We remove the semicolon here.
<br>
cgi.fix_pathinfo=1
This stepVery important, here are the CGI settings of php. 2) Installation and configuration of nginx.
Extract the downloaded nginx-1.0.4 package to the PHP directory on drive D and rename it to nginx. Next, we configure nginx so that it can work with php. Enter the nginx conf directory, open the nginx configuration file nginx.conf, and find
<br>##location
/ { root html; #This is the root directory of the site index index.html index.htm;}Change root
html; to root D :/PHP/hostdoc (that is, the file where you will put the code in the future);
Go down further and find# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ { # root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# include fastcgi_params; #} First remove the "#" in front, and also change root html; to root D :/PHP/hostdoc;. Then change the /scripts marked in red to "$document_root". The "$document_root" here refers to the site path pointed to by the previous "root". This is the changed version: <br> pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 #location ~ \.php$ { D:/wnmp/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } <br> <br> <br> <br> off Not valid under Windows REM set PHP_FCGI_CHILDREN=5REM The maximum number of requests handled by each process, or set For Windows environment variables PHP_FCGI_MAX_REQUESTS=1000 echo Starting PHP FastCGI... RunHiddenConsole D:/wnmp/php5/php-cgi. exe -b 127.0.0.1:9000 -c D:/wnmp/php5/php.ini ##echo Starting nginx... RunHiddenConsole D:/wnmp/nginx /nginx.exe -p D:/wnmp/nginx <br> off echo Stopping nginx... taskkill /F /IM nginx .exe > nul ## echo Stopping PHP FastCGI...taskkill F /IM php-cgi.exe > nul exit After it is done, it will look like this In this way, our service scripts have been created. Double-click start_nginx.bat and see if there are two nginx.exe processes and one php-cgi.exe process in the process manager? In this way, the nginx service is started, and php is also run in fastCGI mode. Go to the site directory, create a new phpinfo.php file, and edit it <br> <br> php phpinfo();?> After saving, open the browser Enter "http://localhost/phpinfo.php". If you see , it means that the nginx+php environment has been configured, haha~ <br><br>
<br>
3. The nginx+php environment has been initially configured, let’s take a look. We can enter the command
to start php and start nginx manually. Of course, we can also use a script to achieve this.
#4. The function of RunHiddenConsole.exe is to automatically close the script after executing the command line script, and the process started from the script will not be closed. First, unzip the downloaded RunHiddenConsole.zip package into the nginx directory. The function of RunHiddenConsole.exe is to automatically close the script after executing the command line script, and from Processes started in the script are not closed. Then create a script, named "start_nginx.bat", we edit it in Notepad++
<br>
The above is the detailed content of php+nginx environment configuration. For more information, please follow other related articles on the PHP Chinese website!

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version
God-level code editing software (SublimeText3)

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor