English 中文(简体)
正在卸载 php 扩展名 : 反向 dl ()
原标题:unloading php extensions : reverse dl()

是否有隐藏的宝石可以在运行时卸下特定的扩展?

最佳回答

不, s < a href=" "https://bugs.php.net/bug.php?id=53957" rel = "nofollow"\\ strong > 是不可能的 ,而且很可能永远也不会:

[2011-02-08 11:34 UTC] [email protected]
extension unloading on a per-request basis simply isn t feasible from a performance point of view. And you obviously can t unload and leave it unloaded for the next request because that next request may be for a page that expects the extension to be there.

然而,使用 dl () 还是不鼓励使用 -- -- 最近版本只有CLI版本。

问题回答

从另一个角度看:不可能从正在运行的 PHP 口译员中删除扩展, 因为它可能已经以不可逆转的方式修改了 PHP 口译员的状况。 例如, 装入后有许多扩展注册分类; 这些模块中没有代码可以解除这些分类的卸载。 更糟糕的是, 如果您的脚本已经运行, 它可能已经包含这些分类的事例, 如果被操作的类别定义丢失, 将会让口译员崩溃 。

至于变通办法,如果使用PHP CLI或其内置服务器 (>>php -S ),您可以指定 -n / -no-php-ini 忽略您的 php.ini ,这样它就可以在运行时卸下您的所有扩展名。 可用于测试 。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签