ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
* [ ] 查看是否支持`webp` * [ ] 新建一个`php`文件 * [ ] 填写以下代码 ``` <?php echo phpinfo(); ``` * [ ] 访问这个文件 ![](https://img.kancloud.cn/9b/ce/9bceeda91eb79811e9e635d8bea4e96b_965x519.png) > 搜索`gd`,查看是否有`WebP Support`并且是`enabled`状态 ![](https://img.kancloud.cn/03/b3/03b336443f9066e34cd3b2fe9755a5a0_1022x583.png) > 有的话那就恭喜你,不用看这篇文章了 > 没有就需要重新编译安装php ## 宝塔 可以卸载原来的PHP版本,然后重新点击安装 安装时,请选择编译安装 ![](https://img.kancloud.cn/18/14/1814bb8e91c9cf30d8873c61d3421199_693x391.png) * [ ] 添加自定义模块 ``` --with-webp-dir ``` ![](https://img.kancloud.cn/77/fd/77fd4f37a46990abf08e7a10426d7d3b_585x593.png) > 点击提交,让其编译安装之后就好了 ## 命令行 * [ ] 也差不多 ``` cd php-7.x.x/ext/gd phpize ./configure --with-webp-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-xpm-dir make ``` ### 参考 [https://www.jianshu.com/p/46c530400955](https://www.jianshu.com/p/46c530400955) [https://www.php.net/manual/en/image.installation.php](https://www.php.net/manual/en/image.installation.php)