简体   繁体   English

需要打开PHP致命错误

[英]PHP fatal error opening required

I've copied php and IIS files to new PC and can't bring it to work. 我已经将php和IIS文件复制到了新PC上,无法使用。 Everytime getting this error: 每次遇到此错误:

Fatal error: Unknown: Failed opening required '-' (include_path:.;C:\\PHP\\includes) 致命错误:未知:无法打开所需的'-'(include_path:。; C:\\ PHP \\ includes)

So, what IS THIS -> '-'? 那么,这是什么->'-'? My index.php just contain only two strings, it's <?php and phpinfo(); 我的index.php仅包含两个字符串,分别是<?phpphpinfo();

Some problems may occur when you use IIS under WIndows OS due to a misunderstanding of the file paths that contain non-Latin characters . 当您在Windows操作系统下使用IIS时,可能会误解包含非拉丁字符的文件路径,因此可能会出现一些问题。 Check the file path for the presence of non-Latin characters . 检查文件路径中是否存在非拉丁字符。 Also try to change the encoding utf8 script - cp1251 也尝试更改编码utf8脚本-cp1251

For the information of anyone else who encounters this problem, I was attempting to use php 7.1 on Windows 10 and IIS using localhost. 有关遇到此问题的其他任何人的信息,我尝试在Windows 10和IIS(使用本地主机)上使用php 7.1。

I had only a test page containing a single phpinfo() command, but when I attempt to navigate to this page, I got: 我只有一个包含单个phpinfo()命令的测试页面,但是当我尝试导航至该页面时,我得到了:

Fatal error: Unknown: Failed opening required '-' (include_path='.;C:\\php\\pear') in Unknown on line 0 致命错误:未知:在第0行的“未知”中无法打开所需的'-'(include_path ='.; C:\\ php \\ pear')

In my case, the handler mapping in iis was mis-configured. 在我的情况下,iis中的处理程序映射配置错误。

Start IIS and under Double Click Handler mappings. 启动IIS,然后在“双击处理程序”映射下。

在此处输入图片说明

Select the entry for *.php and click Edit in the actions menu. 选择* .php的条目,然后在操作菜单中单击“编辑”。

在此处输入图片说明

Change php.exe to php-cgi.exe as shown below. 如下所示,将php.exe更改为php-cgi.exe。

在此处输入图片说明

You might also like to look at this page which explains things in a bit more detail: 您可能还希望查看此页面,该页面对内容进行了更详细的说明:

http://php.net/manual/fa/install.windows.iis7.php http://php.net/manual/fa/install.windows.iis7.php

Regards. 问候。 Chris B. 克里斯·B

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM