mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 08:22:08 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@337782 c90b9560-bf6c-de11-be94-00142212c4b1
228 lines
6.8 KiB
XML
228 lines
6.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 8373b869c3a0726f809cf4ba0b011ea547221033 Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="function.dl" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>dl</refname>
|
|
<refpurpose>Carga una extensión de PHP durante la ejecución</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>dl</methodname>
|
|
<methodparam><type>string</type><parameter>library</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Carga la extensión PHP dada por el parámetro
|
|
<parameter>library</parameter>.
|
|
</para>
|
|
<para>
|
|
Utilice la función <function>extension_loaded</function> para comprobar si la extensión
|
|
ya está cargada o no. Funciona tanto para extensiones ya integradas en PHP o
|
|
para extensiones que se han cargado dinámicamente (ya sea a través de &php.ini; o
|
|
<function>dl</function>).
|
|
</para>
|
|
<warning>
|
|
<simpara>
|
|
Esta función ha sido eliminada de la mayoría de las SAPI en PHP 5.3.0, y
|
|
de PHP-FPM en PHP 7.0.0.
|
|
</simpara>
|
|
</warning>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>library</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Este parámetro es <emphasis>solamente</emphasis> el fichero de la
|
|
extensión a cargar el cual depende del sistema operativo. Por ejemplo,
|
|
la extensión <link linkend="ref.sockets">sockets</link> (si se compila
|
|
como librería, no como parte de PHP) Se llamará
|
|
<filename>sockets.so</filename> en sistemas Unix mientras que en Windows
|
|
se llamará <filename>php_sockets.dll</filename>.
|
|
</para>
|
|
<para>
|
|
El directorio desde donde la extensión será cargada también depende
|
|
del sistema operativo:
|
|
</para>
|
|
<para>
|
|
En Windows - a no ser que se defina explicitamente en &php.ini;, la extensión
|
|
será cargada por defecto desde <filename>C:\php4\extensions\</filename> (PHP4) o
|
|
<filename>C:\php5\</filename> en (PHP 5).
|
|
</para>
|
|
<para>
|
|
Unix - a no ser que se defina en &php.ini;, el directorio de extensiones por defecto
|
|
depende de
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>
|
|
Si PHP fué compilado con la opción <literal>--enable-debug</literal>
|
|
o no
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
Si PHP fué comiplado con soporte (experimental) ZTS (Zend Thread Safety)
|
|
o no
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
El módulo interno actual <literal>ZEND_MODULE_API_NO</literal> (Número
|
|
interno del API Zend, que es básicamente la fecha en que se produjo
|
|
un cambio de versión, p.ej. <literal>20010901</literal>)
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
Teniendo esto en cuenta el directorio por defecto será
|
|
<literal><install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO</literal>,
|
|
p.ej.
|
|
<filename>/usr/local/php/lib/php/extensions/debug-non-zts-20010901</filename>
|
|
o
|
|
<filename>/usr/local/php/lib/php/extensions/no-debug-zts-20010901</filename>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success; Si la funcionalidad de cargar módulos no está disponible
|
|
o ha sido deshabilitada (ya sea activando
|
|
<link linkend="ini.enable-dl">enable_dl</link> off o habilitando el &safemode;
|
|
en &php.ini;) Se producirá un <constant>E_ERROR</constant>
|
|
y se parará la ejecucción de PHP. Si <function>dl</function> falló porque la
|
|
librería especificacda no pudo cargarse a demás de &false; se
|
|
producirá un mensaje <constant>E_WARNING</constant>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplos de <function>dl</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// En este ejemplo se carga una extensión u otra dependiendo del sistema operativo
|
|
if (!extension_loaded('sqlite')) {
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
|
dl('php_sqlite.dll');
|
|
} else {
|
|
dl('sqlite.so');
|
|
}
|
|
}
|
|
|
|
// O si la constante PHP_SHLIB_SUFFIX está disponible desde PHP 4.3.0
|
|
if (!extension_loaded('sqlite')) {
|
|
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
|
|
dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>7.0.0</entry>
|
|
<entry>
|
|
<function>dl</function> está deshabilitado en PHP-FPM.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5.3.9</entry>
|
|
<entry>
|
|
<function>dl</function> está deshabilitado en PHP-FPM, aunque se desaconseja.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5.3.0</entry>
|
|
<entry>
|
|
<function>dl</function> está desactivado en algunos módulos SAPI por problemas
|
|
de estabilidad. Los únicos modulos SAPI que
|
|
permiten <function>dl</function> son: CLI, CGI and Embed. En su lugar usar
|
|
las directivas <link linkend="ini.extension">Directivas de carga
|
|
de extensiones</link>
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
<function>dl</function> <emphasis>no</emphasis> se soporta cuando
|
|
PHP es compilado con soporte ZTS. Use
|
|
en su lugar <link linkend="ini.extension">Directivas de carga
|
|
de extensiones</link> instead.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
<function>dl</function> es sensible a mayúsculas en sistemas Unix.
|
|
</para>
|
|
</note>
|
|
¬e.sm.disabled;
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><link linkend="ini.extension">Directivas de cargas de extensiones</link></member>
|
|
<member><function>extension_loaded</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|