略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: PHP 扩展开发构建

2024-04-19

PHP 扩展开发构建

在一个典型的 PHP 安装中,高性能的需要几乎总是造成以调试的便利为代价的优化。这是产品所使用的合理折衷方案,但当开发扩展时却达不到标准。 我们所需要的是 PHP 的安装包,以提示我们做什么事会出错。

Zend 引擎提供了一个内存管理器,有在扩展中跟踪内存泄漏的能力并提供详尽的调试信息。跟踪在默认情况下是被禁用的,同时也是线程安全的。要打开的话,应将 --enable-debug--enable-maintainer-zts 选项与其他常用选项一起传给 configure。要获得从源代码构建 PHP 的说明,请看位于 安装前需要考虑的事项 的说明。典型的 configure 命令行可能看起来象这样:

$ ./configure --prefix=/where/to/install/php --enable-debug --enable-maintainer-zts --enable-cgi --enable-cli --with-mysql=/path/to/mysql
add a note add a note

User Contributed Notes 1 note

up
5
rich dot d dot rich at gmail dot com
8 years ago
This may be obvious, but if you are installing PHP under a home directory, don't enter '--prefix=~/place'. Use the full form '--prefix=/home/fred/place'.

Otherwise, it will half work and cause problems (because the shell char gets expanded in some places and not others).

官方地址:https://www.php.net/manual/en/internals2.buildsys.environment.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3