PHP - PHP 警告:PHP 启动:在第 0 行未知
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11967563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP - PHP Warning: PHP Startup: in Unknown on line 0
提问by cmaxik
I installed apache2 and php 5.4.5.
我安装了 apache2 和 php 5.4.5。
When you start apache this error:
当您启动 apache 时出现此错误:
PHP Warning: PHP Startup: in Unknown on line 0
PHP 警告:PHP 启动:在第 0 行未知
The extension does not work:
扩展不起作用:
; extension = php_intl.dll
; extension = php_ldap.dll
; extension = php_oci8.dll
; extension = php_oci8_11g.dll
; extension = php_pdo_firebird.dll
; extension = php_pdo_oci.dll
; extension = php_pdo_pgsql.dll
; extension = php_pgsql.dll
; extension = php_pspell.dll
; extension = php_shmop.dll
And maybe more.
也许更多。
Extensin dir: extension_dir = "C :/ dev/prog/php5/ext /"
扩展目录:extension_dir = "C:/dev/prog/php5/ext/"
Path: C: \ dev \ prog \ php5
php.ini is copied to C: \ WINDOWS \
ssleay32.dll php5ts.dll and is copied to C: \ WINDOWS \ system32 \
ssleay32.dll php5ts.dll 并复制到 C:\WINDOWS\system32\
Please simple instructions.
请简单说明。
回答by amitchhajer
upgrade those modules using pecl command
使用pecl 命令升级这些模块
Also, Check extension_dir directive in php.ini
另外,检查 php.ini 中的 extension_dir 指令
回答by Radek Buda?
I had the same problem. The issue is, that these lines are by default in php.ini
我有同样的问题。问题是,这些行默认在 php.ini 中
; On windows:
; extension_dir = "ext"
I assumed, that only an uncomment of the second line and Apache restart solves this problem. But it isn't!
我认为,只有取消注释第二行并重启 Apache 才能解决这个问题。但事实并非如此!
I had to type a full path to the ext folder, such as below:
我必须输入 ext 文件夹的完整路径,如下所示:
extension_dir = "d:\php-5.4.32\ext"
After this action, and restart of the Apache web server, the problem was solved.
执行此操作后,重新启动 Apache Web 服务器,问题就解决了。
回答by Dan Searle
I found this answer in this post on the wampserver forums, and it worked for me:
我在 wampserver 论坛上的这篇文章中找到了这个答案,它对我有用:
Click on the Apache version that you use in the WAMPServer menu, e.g.
在 WAMPServer 菜单中单击您使用的 Apache 版本,例如
wampmanager -> Apache -> Version -> 2.4.9 ( just click on the version number on this menu item )
wampmanager -> Apache -> 版本 -> 2.4.9(只需单击此菜单项上的版本号)
this will rebuild the SYMLINKS for the extensions that are causing the "in Unknown on line 0" error.
这将为导致“第 0 行未知”错误的扩展重建 SYMLINKS。


The answer was given by RiggsFolly in this thread: http://forum.wampserver.com/read.php?2,128734
RiggsFolly 在此线程中给出了答案:http: //forum.wampserver.com/read.php?2,128734
回答by anemone928
You should check you php.ini file to make sure the extension_dir is exactly set. I had the same problem when i enable these five extensions:
您应该检查 php.ini 文件以确保 extension_dir 设置正确。当我启用这五个扩展时,我遇到了同样的问题:
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_curl.dll
The number of warnings is the same as the extensions that enabled. So i guess may be there is sth. wrong with the extension setting. When i change the extension_dir directive to the right dir, the problem resolved.
警告的数量与启用的扩展相同。所以我想可能有什么。扩展设置错误。当我将 extension_dir 指令更改为正确的目录时,问题解决了。
回答by Ahmed Syed
- You need to download and install Aspell for Windows “GNU Aspell-0.50.3 (win32)”.
- 您需要下载并安装 Aspell for Windows “GNU Aspell-0.50.3 (win32)”。
http://ftp.gnu.org/gnu/aspell/w32/Aspel... -Setup.exe
http://ftp.gnu.org/gnu/aspell/w32/Aspel... -Setup.exe
Your Dictionaries are also here. Aspell needs at least one Dictionary to operate.
您的字典也在这里。Aspell 至少需要一个 Dictionary 才能运行。
or
或者
ftp://ftp.gnu.org/gnu/aspell/w32/
ftp://ftp.gnu.org/gnu/aspell/w32/
ftp://ftp.gnu.org/gnu/aspell/w32/Aspell... -Setup.exe
ftp://ftp.gnu.org/gnu/aspell/w32/Aspell... -Setup.exe
ftp://ftp.gnu.org/gnu/aspell/w32/aspell-w32-0.50.3.zip
ftp://ftp.gnu.org/gnu/aspell/w32/aspell-w32-0.50.3.zip
Aspell should copy the “aspell-15.dll” to the “Windows/System32” directory which the php entension php_pspell.dll requires and looks for to execute. If not then locate aspell-15.dll in C:/Program Files/Aspell/bin/aspell-15.dll and copy it to C:/Windows/System 32/aspell-15.dll
You only need now to uncomment this line in: xampp/apache/bin/php.ini ;extension=php_pspell.dll to this: extension=php_pspell.dll
Restart Apache. (If Apache won't start paste the error message here).
Check the pspell module is in place and enabled by lookin at your phpinfo() file from the menu within the XAMPP Welcome Page.
http://localhost/index.phpFor more info visit https://community.apachefriends.org/f/viewtopic.php?p=83942
Aspell 应该将“aspell-15.dll”复制到 php 扩展 php_pspell.dll 需要并寻找执行的“Windows/System32”目录。如果没有,则在 C:/Program Files/Aspell/bin/aspell-15.dll 中找到 aspell-15.dll 并将其复制到 C:/Windows/System 32/aspell-15.dll
您现在只需要取消注释此行: xampp/apache/bin/php.ini ;extension=php_pspell.dll 到此: extension=php_pspell.dll
重新启动阿帕奇。(如果 Apache 无法启动,请在此处粘贴错误消息)。
通过从 XAMPP 欢迎页面中的菜单查看您的 phpinfo() 文件,检查 pspell 模块是否就位并启用。
http://localhost/index.php有关更多信息,请访问https://community.apachefriends.org/f/viewtopic.php?p=83942
回答by Oriol
I had the same problem when I enabled extensions (see Error when enabling PHP extensions).
我在启用扩展时遇到了同样的问题(请参阅启用 PHP 扩展时出错)。
I resolved it adding the PHP folder to the path and restarting the computer.
我解决了将 PHP 文件夹添加到路径并重新启动计算机的问题。
回答by Med.ZAIRI
The problem is not coming from there, the problem is from the path (I mean %PATH% for Windows users, because of %PATH% is a variable that contains many paths separated by ;). So to figure out the problem you have to:
问题不是从那里来的,问题出在路径上(我的意思是 Windows 用户的 %PATH%,因为 %PATH% 是一个变量,其中包含许多由 ; 分隔的路径)。因此,要找出问题,您必须:
1-make configuration in the httpd.conf file:
1-在httpd.conf文件中进行配置:
PHPIniDir "${path}/conf_files"
2-make configuration in your php.ini file (it must be in the same location with the httpd.conf file): change this:
php.ini 文件中的 2-make 配置(它必须与 httpd.conf 文件在同一位置):更改以下内容:
extension_dir = "${path}\php\ext\"
To
到
extension_dir = "D:\EasyPHP5.3.0\php\ext\"
(in my case the php is installed in D:\EasyPHP5.3.0)
(在我的情况下,php 安装在 D:\EasyPHP5.3.0 中)
Optional:
可选的:
if you need to execute PHP from the CLI (Command Prompt) you have to make copy of the php.ini file to the folder when the PHP is installed (in my case D:\EasyPHP5.3.0\php)
如果您需要从 CLI(命令提示符)执行 PHP,则必须在安装 PHP 时将 php.ini 文件复制到该文件夹(在我的情况下为 D:\EasyPHP5.3.0\php)
Restart/Start your web Server and enjoy!
重新启动/启动您的网络服务器并享受!
回答by Olexandr Minzak
Same problem was solved by changing to full path:PHPIniDirin httpd.confand extension_dirin php.ini.
通过更改为完整路径解决了同样的问题:PHPIniDirinhttpd.conf和extension_dirin php.ini。
回答by TMa
I had similar problem. cURL required SSL layer. Problem was in installation of php_curllibrary, see http://php.net/manual/en/curl.installation.php. The firs problem: libeay32.dlland ssleay32.dllare required on PATH. I put them in apache/bindirectory. The second problem is that php.inirequired php_opensslloaded before php_curlso I modified ini file.
我有类似的问题。cURL 需要 SSL 层。问题在于安装php_curl库,请参阅http://php.net/manual/en/curl.installation.php。第一个问题:路径上需要libeay32.dll和ssleay32.dll。我把它们放在apache/bin目录中。第二个问题是php.ini需要在php_curl之前加载php_openssl,所以我修改了ini文件。
extension=php_openssl.dll
extension=php_curl.dll
回答by cuixiping
I solved the problem on my windows 7 with two steps:
我通过两个步骤解决了 Windows 7 上的问题:
set extension_dir as absolute path in php.ini
extension_dir = "d:\php-5.4.32\ext"comment the php_curl.dll module in php.ini
;extension=php_curl.dll
在 php.ini 中将 extension_dir 设置为绝对路径
extension_dir = "d:\php-5.4.32\ext"在 php.ini 中注释 php_curl.dll 模块
;extension=php_curl.dll

