在 Windows 上使用 XAMPP 安装 PHP YAML 扩展
大家好,我目前正在做一些关于 PhP 的工作,需要我使用 yaml_parse_file()
函数来解析 YAML 文件.我对这门语言还是陌生的,所以当我尝试在 Windows 上未经修改的 XAMPP 服务器上使用该函数时,我得到了错误找不到函数".经过一番研究,我发现您实际上应该在您的 php 安装上安装扩展才能使用该功能.http://php.net/manual/en/yaml.setup.php这个链接详细介绍了安装过程,我已经阅读了它,但是我对安装过程感到困惑.上面的链接指出没有可供下载的 DLL 包,但是直接对此链接发表评论 http://pecl.php.net/package/yaml 在这里您可以清楚地看到 YAML Parser 的 DLL 包.我的问题是您能否指导我了解如何使用 XAMPP 在 Windows 机器上执行此安装过程.
Hey folks I am currently doing some work on PhP that requires me to parse a YAML file by using the yaml_parse_file()
function. I am still new to the language and all so when I tried using that function on my unmodified XAMPP server on Windows I got the error 'function not found'. After some research I found out that you are actually supposed to install extensions on your php installation to be able to use that function. http://php.net/manual/en/yaml.setup.php this link details the installation process and I have read through it however I am confused in regards to the installation procedure. The above link states that there is not a DLL package available for download however a comment direct to this link http://pecl.php.net/package/yaml where you can clearly see a DLL Package for YAML Parser. My question is if you could please walk me through how to go about this installation procedure on a Windows Machine using XAMPP.
https://code.google.com/p/php-yaml/wiki/InstallingWithPecl 这个链接可能会为您提供有关此主题的更多见解,尽管我无法理解它是如何工作的:(
https://code.google.com/p/php-yaml/wiki/InstallingWithPecl this link might offer you more insight on this topic although I fail to understand how it all works :(
Edit2:我试图下载上面链接中给出的 DLL 并将其添加到我的 php/ext 文件夹中,并在 php.ini extension=php_yaml.dll
中添加一个条目,但是当我尝试测试我的扩展程序是否已被以下脚本加载,我得到一个错误.
I have tried to download the DLL given on the above link and add it to my php/ext folder and add an entry in php.ini extension=php_yaml.dll
but when I try to test if my extension has been loaded by the following script, I get an error.
<?php
if (extension_loaded(yaml))
echo "yaml loaded :)";
else
echo "something is wrong :(";
?>
推荐答案
在读者的帮助下,我似乎已经缩小了实现这一目标的步骤.
With a bit of help from the readers I seem to have narrowed down the steps to accomplish this.
- 下载最新的 YAML DLL 包
- 解压文件
- 将
php_yaml.dll
文件移动到xampp/php/ext
文件夹 - 在
xampp/php
中打开你的php.ini
并添加extension=php_yaml.dll
这一行,保存退出 - 现在将
yaml.dll
文件从 zip 文件夹内容中移动到xampp/apache/bin
文件夹中 - 关闭并重新启动您的 XAMPP 服务器
- 加载一个php脚本
echo phpinfo();
- 在页面上搜索字符串
yaml
.如果显示已启用,则您的 YAML 扩展正在运行.
- Download the latest YAML DLL Package
- Unzip the files
- Move the
php_yaml.dll
file toxampp/php/ext
folder - Open your
php.ini
inxampp/php
and add the lineextension=php_yaml.dll
, save and exit - Now move the
yaml.dll
file from the zip folder contents and move it to thexampp/apache/bin
folder - Close and restart your XAMPP Servers
- Load a php script
echo phpinfo();
- Search the string
yaml
on the page. If it says Enabled then your YAML Extension is working.
相关文章