The latest ThinkPHP V5 installation process under iis, nginx, apache, including errors caused by pseudo-static

 

This article applies to the following questions

Apache appears No input file specified prompt?

No input file specified prompt appears in PHPWAMP?

No input file specified prompt appears when installing website program?

How does Apache set up pseudo-static, how does Nginx set up pseudo-static, how does iis set up pseudo-static?

Friendly reminder: The program used in the case is TP5, please follow this method for other php programs!

 

For different WEB servers, the pseudo-static content required by ThinkPHP V5 is different.

Moreover, on the Apache server, there are differences between modular operation and pseudo-static operation using FCGI

 

Friendly reminder: The pseudo-static used in the case is TP5, if you are using other php programs, please use the pseudo-static file of the corresponding program.

-----------apache, nginx, iis, Apache installation TP5 begins -----------

 

special mention (important)

On the Apache server, there is also a difference between the pseudo-static operation of the modular operation and the FCGI operation.

So when some people install ThinkPHP V5, there will be an error message of No input file specified.

 

The following pseudo-static is the pseudo-static content that needs to be configured when Apache adopts the module operation mode. For the detailed operation mode, please refer to my previous blog content

(If your current Apache uses Fcgi mode to run PHP, then this pseudo-static will appear "No input file specified." error message)

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

 

 

Why some people can use the above pseudo-static, but some people do use the prompt "No input file specified."?

That's because Apache can't recognize PATH_INFO only when it adopts fastcgi mode, so many people don't have this problem when installing ThinkPHP V5 under Windows, because most Windows users install Apache in a modular operating mode Yes, but the "No input file specified." prompt appears on both Linux and Windows systems using FCGI operating mode.

If such a prompt appears when you use the FCGI running mode, just put

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

rewritten as

RewriteRule ^(.*)$ index.php [E= PATH_INFO :$1,QSA,PT,L]     is enough, the pseudo-static after rewriting is as follows (note E= PATH_INFO :$1)

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php [E=PATH_INFO:$1,QSA,PT,L]
</IfModule>

 

Friendly reminder: PHPWAMP supports multiple modes. The default site on the main interface is the modular operation mode, and the site management is the Fcgi mode.

Therefore, the default site of the main interface can directly use the default pseudo-static of ThinkPHP V5, while the site management needs to use the modified pseudo-static.

 

After selecting the relevant settings to switch the php version, select here to start Apache2.4

 

Apache2.4 can be started by selecting the three default versions here, and the version selected here is only the version of the default site

The default site adopts a common module operation mode, so the first unmodified pseudo-static file above can be used directly.

 

After starting, add the site in the site management interface, and copy the pseudo-static modified above to enter, because the site management is in FCGI mode

When adding a site, the root directory of the website should select the public folder, so that the default ThinkPHP V5 page can be opened.

 

If you used the default pseudo-static in the previous step, since the site management is in FCGI mode, the following No input file specified." prompt will appear

 

So we have to use the modified pseudo-static instead. After enabling the modified pseudo-static, you can open the http://localhost:8033/index/index/index page normally.

 

 

 

----------- apache, nginx, iis, nginx installation of TP5 starts -----------

 

The pseudo-static installation of ThinkPHP V5 on the Nginx server is as follows

if (!-e $request_filename) {
   rewrite  ^(.*)$  /index.php?s=/$1  last;
   break;
    }

 

The specific process is as shown in the figure below, click on the menu related settings, and then we first enable the Nginx server

 

Open the nginx site management to add a site, and select the public folder in the website directory, so there is no need to add public access after the url

 

After adding the site, we will find that the added site root directory automatically generates a pseudo-static file "nginx.htaccess" belonging to the Nginx server

 

Open this pseudo-static file, which integrates the pseudo-static of common websites by default, find the pseudo-static belonging to TP5, and remove the # in front (restart Nginx)

You can also delete all the default pseudo-static in it, and it is also feasible to directly copy the pseudo-static of TP5 under Nginx that I provided earlier (Nginx must be restarted for setting)

 

If your Nginx pseudo-static settings are wrong, usually accessing the following path "http://localhost:8088/index/index/index/" will result in a 404 error

 

If the pseudo-static of the TP5 program under Nginx is correctly set, the page can be displayed normally only when it is opened

 

 

 

 

----------- apache, nginx, iis, the beginning of the iis chapter of installing TP5 -----------

Installing the pseudo-static ThinkPHP V5 on the iis server requires additional steps

 

1. The server needs to be installed: URL Rewrite

URL Rewrite download address http://download.csdn.net/download/lccee/10240310

 

2. You can configure web.Config under the high version of IIS, and add a rewrite node in the middle:

Just add it to <system.webServer>

 

<rewrite>
 <rules>
 <rule name="OrgPage" stopProcessing="true">
 <match url="^(.*)$" />
 <conditions logicalGrouping="MatchAll">
 <add input="{HTTP_HOST}" pattern="^(.*)$" />
 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
 </conditions>
 <action type="Rewrite" url="index.php/{R:1}" />
 </rule>
 </rules>
 </rewrite>

 

 

For specific steps, open the relevant settings of PHPWAMP and click IIS Site Management

This IIS site management can quickly add PHP sites with the built-in IIS server of the operating system, and can run multiple PHP versions at the same time

The added site can be modified in phpwamp's iis site management, or in the system's iis manager, which is universal.

 

Add an iis site, choose the php version arbitrarily, and you can also customize the php version, support 32-bit/64-bit PHP optional.

After adding the site, you will find that the root directory of the added site automatically generates a pseudo-static file "web.config" belonging to the IIS server

 

Restart iis after adding the website, and then visit the path http://localhost:8088/index/index/index, 404 will appear, because the pseudo-static web.config file has not been set

 

 

Before setting the pseudo-static web.config file, we must first install the pseudo-static module. After downloading the urlrewrite2.exe file download address provided above,

Install urlrewrite2.exe. After the installation is complete, you need to restart the computer, and then import the pseudo-static TP5 under the IIS server. Continue the detailed steps below

 

Possible causes and solutions of pseudo-static installation

If you are prompted to install the pseudo-static, you can search for the following files and delete the "rewrite.dll" file, which is usually in the C:\Windows\System32\inetsrv directory

Friendly reminder: It is best to restart the computer after installing the pseudo-static. If you encounter any problems during the installation of the pseudo-static, you can follow this step to reinstall the pseudo-static module

 

After installing the pseudo-static, we click here to open the system's iis manager

 

After opening, you will find the following icon, and the icon "URL rewriting" is added, indicating that the pseudo-static module has been installed.

 

After successfully installing the pseudo-static module, you can add the above pseudo-static rules in the web.config file in the root directory of the website.

As early as when we added the site earlier, the web.config file was automatically generated under the root directory of the site, as shown in the red box in the figure below.

 

 

We can open it directly, add the pseudo-static content above, modify the file web.Config,

Add a rewrite node in the middle, just add it in <system.webServer>, add it as shown below

Refresh http://localhost:8088/index/index/index after saving, and we found that it can be opened normally, and the 404 prompt no longer appears.

So far, the detailed process of setting pseudo-static of the three major web servers of Nginx, Apache and IIS has been explained.

If you make a mistake according to the operation, please read the content of this article many times, don't just look at the pictures, the text description is the key point.

This article uses the PHPWAMP_IN2 all-round custom environment, which can customize Apache, Nginx, PHP, and Mysql versions with one click.

 

Guess you like

Origin blog.csdn.net/Lccee/article/details/79258727