文章目录
- 1.下载php Dehug;php server
- 2.下载php环境
- 3.配置环境变量
- 5.配置php.ini文件
- 6.设置vscode
- 6.测试
- 遇到的问题
1.下载php Dehug;php server
2.下载php环境
下载地址:https://www.php.net/downloads.php
3.配置环境变量
C:\Users\hacker>php -v
PHP 8.3.3 (cli) (built: Feb 13 2024 23:17:12) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.3, Copyright (c) Zend Technologies有这样的回显,就代表安装成功
5.配置php.ini文件
刚下载后,php目录中是没有php.ini文件的,需要我们自己设置,复制php.ini-development文件,粘贴,将粘贴后的文件改为php.ini
6.设置vscode
右上角文件—> 首选项-----> 设置------>php
"security.workspace.trust.untrustedFiles": "open","php.validate.executablePath": "D:/tool/php8/php.exe","php.debug.executablePath": "D:/tool/php8/php.exe","phpserver.phpConfigPath": "D:/tool/php8/php.ini","phpserver.phpPath": "D:/tool/php8/php.exe",
添加上面的代码,路径改为自己php的路径
6.测试
OK
遇到的问题
php -v时,出现报错
PHP Warning: PHP Startup: Unable to load dynamic library 'mbstring' (tried: C:\php\ext\mbstring (鎵 句笉鍒版寚瀹氱殑妯″潡銆?, C:\php\ext\php_mbstring.dll (鎵句笉鍒版寚瀹氱殑妯″潡銆?) in Unknown on line 0Warning: PHP Startup: Unable to load dynamic library 'mbstring' (tried: C:\php\ext\mbstring (鎵句笉鍒版寚瀹氱殑妯″潡銆?, C:\php\ext\php_mbstring.dll (鎵句笉鍒版寚瀹氱殑妯″潡銆?) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'exif' (tried: C:\php\ext\exif (鎵句笉鍒版 寚瀹氱殑妯″潡銆?, C:\php\ext\php_exif.dll (鎵句笉鍒版寚瀹氱殑妯″潡銆?) in Unknown on line 0Warning: PHP Startup: Unable to load dynamic library 'exif' (tried: C:\php\ext\exif (鎵句笉鍒版寚瀹氱殑妯″潡銆?, C:\php\ext\php_exif.dll (鎵句笉鍒版寚瀹氱殑妯″潡銆?) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: C:\php\ext\mysqli (鎵句笉 鍒版寚瀹氱殑妯″潡銆?, C:\php\ext\php_mysqli.dll (鎵句笉鍒版寚瀹氱殑妯″潡銆?) in Unknown on line 0Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: C:\php\ext\mysqli (鎵句笉鍒版寚瀹氱殑妯″潡銆?, C:\php\ext\php_mysqli.dll (鎵句笉鍒版寚瀹氱殑妯″潡銆?) in Unknown on line 0
PHP 8.3.3 (cli) (built: Feb 13 2024 23:17:12) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.3, Copyright (c) Zend Technologies
解决方法:
修改php.ini文件,将下面前面的·;·给删除extension=mbstring
extension=exif
extension=mysqli