PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Uso de PHP> <Instalación
Last updated: Fri, 04 Jul 2008

view this page in

Problemas de Compilación

Esta sección reúne la mayoría de errores que ocurren en tiempo de compilación.

  1. Tengo la última versión de PHP usando el servicio de CVS anónimo, ¡pero no hay un script configure!
  2. Tengo problemas configurando PHP para que funcione con Apache. Dice que no puede encontrar httpd.h, ¡pero está allí donde dije que estaba!
  3. Mientras configuraba PHP (./configure), se encuentra con un error similar al siguiente: checking lex output file root... ./configure: lex: command not found configure: error: cannot find output from lex; giving up
  4. Cuando intento iniciar Apache, recibo el siguiente mensaje: fatal: relocation error: file /ruta/hacia/libphp4.so: symbol ap_block_alarms: referenced symbol not found
  5. Cuando ejecuto configure, ¡dice que no puede encontrar los archivos de inclusión o la biblioteca GD, gdbm o algún otro paquete!
  6. Cuando está compilando el archivo language-parser.tab.c, produce errores diciendo yytname undeclared.
  7. Cuando ejecuto make, parece correr bien pero luego falla cuando intenta enlazar la aplicación final, quejándose de que no puede encontrar algunos archivos.
  8. Cuando se enlaza PHP, se queja del número de referencias indefinidas.
  9. No puedo lograr que compile PHP con Apache 1.3.
  10. He seguido todos los pasos para instalar la versión tipo módulo de Apache en Unix, y mis scripts PHP aparecen en mi navegador o se me pide que guarde el archivo.
  11. Dice que use: --activate-module=src/modules/php4/libphp4.a, pero ese archivo no existe, ¡así que lo cambié a --activate-module=src/modules/php4/libmodphp4.a y no funciona! ¿Qué está pasando?
  12. Cuando intento compilar Apache con PHP como un módulo estático usando --activate-module=src/modules/php4/libphp4.a me dice que mi compilador no es compatible con ANSI.
  13. Cuando intento compilar PHP usando --with-apxs obtengo mensajes de error extraños.
  14. Durante make, recibo errores sobre microtime, y muchos sobre RUSAGE_.
  15. Cuando compilo PHP con MySQL, configure corre bien, pero durante make recibo un error similar al siguiente: ext/mysql/libmysql/my_tempnam.o(.text+0x46): In function my_tempnam': /php4/ext/mysql/libmysql/my_tempnam.c:103: the use of tempnam' is dangerous, better use mkstemp', ¿qué está fallando?
  16. Quiero actualizar mi instalación de PHP. ¿Dónde puedo encontrar la línea ./configure que fue usada para compilar mi instalación actual de PHP?
  17. Cuando se compila PHP con la biblioteca GD se producen errores extraños de compilación o produce un fallo de segmentos (segfault) en la ejecución.
  18. Cuando se compila PHP parece que recibo errores aleatorios, como si se colgara. Estoy usando Solaris si eso tiene importancia.

Tengo la última versión de PHP usando el servicio de CVS anónimo, ¡pero no hay un script configure!

Es necesario tener el paquete GNU autoconf instalado de modo que pueda generar el script configure desde configure.in. Simplemente ejecute ./buildconf en el directorio superior después de obtener las fuentes del servidor CVS. (Asimismo, a menos que corra configure con la opción --enable-maintainer-mode, el script no será re-creado automáticamente cuando el archivo configure.in sea actualizado, así que debe asegurarse de hacerlo manualmente cuando note que configure.in ha cambiado. Un síntoma de esto es encontrar cosas como @VARIABLE@ en su Makefile después de que se ejecuta configure o config.status.)

Tengo problemas configurando PHP para que funcione con Apache. Dice que no puede encontrar httpd.h, ¡pero está allí donde dije que estaba!

Necesita decirle al script configure/setup la ubicación del nivel superior de su árbol fuente de Apache. Esto quiere decir que debe especificar --with-apache=/ruta/hacia/apache y no --with-apache=/ruta/hacia/apache/src.

Mientras configuraba PHP (./configure), se encuentra con un error similar al siguiente:

       checking lex output file root... ./configure: lex: command not found
       configure: error: cannot find output from lex; giving up
      

Asegúrese de leer las instrucciones de instalación cuidadosamente y note que necesita instalar tanto flex como bison para compilar PHP. Dependiendo de su configuración, deberá instalar bison y flex ya sea desde el código fuente, o un paquete, como un RPM.

Cuando intento iniciar Apache, recibo el siguiente mensaje:

       fatal: relocation error: file /ruta/hacia/libphp4.so: symbol
       ap_block_alarms: referenced symbol not found
      

Este error aparece usualmente cuando se compila el programa núcleo de Apache como una biblioteca DSO para uso compartido. Intente reconfigurar apache, asegurándose de usar por lo menos las siguientes banderas:

      --enable-shared=max --enable-rule=SHARED_CORE
      

Para más información, lea el archivo INSTALL en el nivel superior de Apache, o la » página del manual DSO de Apache.

Cuando ejecuto configure, ¡dice que no puede encontrar los archivos de inclusión o la biblioteca GD, gdbm o algún otro paquete!

Puede hacer que el script configura busque por archivos de cabecera y bibliotecas en ubicaciones no-estándar especificando banderas a pasar al pre-procesador y enlazador de C, como:

    CPPFLAGS=-I/ruta/hacia/include LDFLAGS=-L/ruta/hacia/biblioteca ./configure
Si está usando una variante de csh como intérprete de comandos (¿porqué?), sería:
    env CPPFLAGS=-I/ruta/hacia/include LDFLAGS=-L/ruta/hacia/biblioteca ./configure

Cuando está compilando el archivo language-parser.tab.c, produce errores diciendo yytname undeclared.

Necesita actualizar su versión de Bison. Puede encontrar la versión más reciente en » http://www.gnu.org/software/bison/bison.html.

Cuando ejecuto make, parece correr bien pero luego falla cuando intenta enlazar la aplicación final, quejándose de que no puede encontrar algunos archivos.

Algunas versiones antiguas de make no colocan correctamente las versiones compiladas de los archivos en el directorio de funciones en ese mismo directorio. Intente ejecutar cp *.o functions y luego re-ejecute make para ver si eso ayuda. Si lo hace, realmente debería actualizarse a una versión reciente de GNU make.

Cuando se enlaza PHP, se queja del número de referencias indefinidas.

Eche un vistazo a la línea de enlace y asegúrese de que todas las bibliotecas apropiadas están siendo incluidas al final. Algunas comunes que puede estar dejando pasar son '-ldl' y cualquier otra biblioteca requerida para el soporte de bases de datos que incluyó.

Si está enlazando con Apache 1.2.x, ¿recordó agregar la información apropiada a la línea EXTRA_LIBS del archivo de configuración y re-ejecutó el script Configure de Apache? Vea el capítulo de instalación para más información.

Algunas personas han reportado también que han tenido que agregar '-ldl' inmediatamente después de libphp4.a cuando enlazan con Apache.

No puedo lograr que compile PHP con Apache 1.3.

En realidad es sencillo. Siga los siguientes pasos cuidadosamente:

  • Obtenga la última distribución de Apache 1.3 desde » http://www.apache.org/dist/httpd/.
  • Descomprima el archivo en alguna parte, por ejemplo /usr/local/src/apache-1.3.
  • Compile PHP ejecutando en un principio ./configure --with-apache=/<ruta>/apache-1.3 (sustituya <ruta> con la ruta real a su directorio apache-1.3.)
  • Escriba make seguido de make install para compilar PHP y copiar los archivos necesarios al árbol de la distribución de Apache.
  • Cambie de directorios al directorio /<ruta>/apache-1.3/src y edite el archivo Configuration. Agregue al archivo: AddModule modules/php4/libphp4.a.
  • Escriba: ./configure seguido por make.
  • ¡Ahora debe tener un binario httpd habilitado con PHP!

Nota: También es posible usar el nuevo script ./configure de Apache. Vea las instrucciones en el archivo README.configure que es parte de su distribución de Apache. También eche un vistazo al archivo INSTALL en la distribución de PHP.

He seguido todos los pasos para instalar la versión tipo módulo de Apache en Unix, y mis scripts PHP aparecen en mi navegador o se me pide que guarde el archivo.

Esto quiere decir que el módulo PHP no está siendo invocado por alguna razón. Tres cosas que puede verificar antes de solicitar más ayuda:

  • Asegúrese de que el binario httpd que está corriendo es el binario httpd real que acaba de compilar. Para hacer esto, pruebe ejecutar: /ruta/hacia/binario/httpd -l Si no ve mod_php4.c listado entonces no está ejecutando el binario correcto. Encuentre e instale el binario correcto.
  • Asegúrese de que ha agregado el Tipo Mime correcto a uno de sus archivo .conf de Apache. Debe ser: AddType application/x-httpd-php .php También asegúrese de que esta línea AddType no está escondida al interior de un bloque <Virtualhost> o <Directory> que puede prevenir que se aplique en la ubicación de su script de prueba.
  • Finalmente, la ubicación predeterminada de los archivos de configuración de Apache cambió entre Apache 1.2 y Apache 1.3. Debería verificar que el archivo de configuración al que le está agregando la línea AddType está siendo leído en realidad. Puede colocar un error de sintaxis obvio en su archivo httpd.conf o algún otro cambio obvio que le dirá si el archivo está siendo leído correctamente.

Dice que use: --activate-module=src/modules/php4/libphp4.a, pero ese archivo no existe, ¡así que lo cambié a --activate-module=src/modules/php4/libmodphp4.a y no funciona! ¿Qué está pasando?

Note que el archivo libphp4.a no se supone que exista. !El proceso de apache lo creará!

Cuando intento compilar Apache con PHP como un módulo estático usando --activate-module=src/modules/php4/libphp4.a me dice que mi compilador no es compatible con ANSI.

Este es un mensaje de error equivocado de Apache que ha sido arreglado en versiones más recientes.

Cuando intento compilar PHP usando --with-apxs obtengo mensajes de error extraños.

Hay tres cosas que pueden verificarse. Primero, por alguna razón cuando Apache compila el script Perl apxs, a veces termina compilándose sin las variables y banderas de compilación apropiadas. Encuentre su script apxs (pruebe con el comando which apxs), a veces se encuentra en /usr/local/apache/bin/apxs o /usr/sbin/apxs. Ábralo y verifique que tenga líneas similares a las siguientes:

my $CFG_CFLAGS_SHLIB  = ' ';          # substituted via Makefile.tmpl
my $CFG_LD_SHLIB      = ' ';          # substituted via Makefile.tmpl
my $CFG_LDFLAGS_SHLIB = ' ';          # substituted via Makefile.tmpl
Si esto es lo que ve, ha encontrado su problema. Puede que contengan solo espacios u otros valores incorrectos, como 'q()'. Cambie estas líneas para que digan:
my $CFG_CFLAGS_SHLIB  = '-fpic -DSHARED_MODULE'; # substituted via Makefile.tmpl
my $CFG_LD_SHLIB      = 'gcc';                   # substituted via Makefile.tmpl
my $CFG_LDFLAGS_SHLIB = q(-shared);              # substituted via Makefile.tmpl 
El segundo problema posible debería ocurrir únicamente en Red Hat 6.1 y 6.2. El script apxs que distribuye Red Hat está mal. Busque esta línea:
my $CFG_LIBEXECDIR    = 'modules';         # substituted via APACI install
Si ve esta línea, cámbiela por esto:
my $CFG_LIBEXECDIR    = '/usr/lib/apache'; # substituted via APACI install
Por último, si usted re-configura/re-instala Apache, agregue un make clean al proceso después de ./configure y antes de make.

Durante make, recibo errores sobre microtime, y muchos sobre RUSAGE_.

Durante la porción make de la instalación, si encuentra problemas similares a esto:

microtime.c: In function `php_if_getrusage':
microtime.c:94: storage size of `usg' isn't known
microtime.c:97: `RUSAGE_SELF' undeclared (first use in this function)
microtime.c:97: (Each undeclared identifier is reported only once
microtime.c:97: for each function it appears in.)
microtime.c:103: `RUSAGE_CHILDREN' undeclared (first use in this function)
make[3]: *** [microtime.lo] Error 1
make[3]: Leaving directory `/home/master/php-4.0.1/ext/standard'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/master/php-4.0.1/ext/standard'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/master/php-4.0.1/ext'
make: *** [all-recursive] Error 1

Su sistema está dañado. Necesita arreglar sus archivos /usr/include instalando un paquete glibc-devel que coincida con su glibc. Esto no tiene nada que ver con PHP. Para probar este punto, realice la siguiente prueba:

$ cat >test.c <<X
#include <sys/resource.h>
X
$ gcc -E test.c >/dev/null
Si eso produce errores, sabrá que sus archivos de inclusión están en mal estado.

Cuando compilo PHP con MySQL, configure corre bien, pero durante make recibo un error similar al siguiente: ext/mysql/libmysql/my_tempnam.o(.text+0x46): In function my_tempnam': /php4/ext/mysql/libmysql/my_tempnam.c:103: the use of tempnam' is dangerous, better use mkstemp', ¿qué está fallando?

Primero, es importante entender que esta es una Advertencia y no un error fatal. Dado que ésta es con frecuencia la última salida observada durante make, puede parecer como un error fatal, pero no lo es. Por supuesto, si ha configurado su compilador para que se detenga en las Advertencias, lo hará. También tenga en cuenta que el soporte MySQL está habilitado por defecto.

Note: A partir de PHP 4.3.2, también verá el siguiente texto después de que la compilación (make) se complete:

        Build complete.
        (It is safe to ignore warnings about tempnam and tmpnam).
       

Quiero actualizar mi instalación de PHP. ¿Dónde puedo encontrar la línea ./configure que fue usada para compilar mi instalación actual de PHP?

Bien puede mirar su archivo config.nice, en el árbol actual de su instalación PHP actual o, si no está disponible, simplemente ejecute un script como el siguiente

<?php phpinfo(); ?>
Al comienzo de la salida, la línea ./configure usada para compilar la instalación PHP actual es desplegada.

Cuando se compila PHP con la biblioteca GD se producen errores extraños de compilación o produce un fallo de segmentos (segfault) en la ejecución.

Asegúrese de que su biblioteca GD y PHP están enlazados contra las mismas bibliotecas de dependencia (p.ej. libpng).

Cuando se compila PHP parece que recibo errores aleatorios, como si se colgara. Estoy usando Solaris si eso tiene importancia.

Usar utilidades no-GNU durante la compilación de PHP puede causar problemas. Asegúrese de usar herramientas GNU para tener la certeza de que la compilación de PHP funcione. Por ejemplo, en Solaris, usar las versiones de SunOS compatibles-con-BSD o de Solaris de sed no funcionará, pero usar las versiones GNU o Sun POSIX (xpg4) de sed lo hará. Enlaces: » GNU sed, » GNU flex, y » GNU bison.



Uso de PHP> <Instalación
Last updated: Fri, 04 Jul 2008
 
add a note add a note User Contributed Notes
Problemas de Compilación
prasankn at gmail dot com
11-Oct-2007 02:38
I am trying to add SSH2 support in my product. I am using Apache 2.0.4.7 with PHP 5.2.4.

For SSH2 support, i had compiled PECL/SSH2 package and created ssh2.so.

I used to run PHP using libphp5.so through httpd.conf. I struck at the creation of libphp5.so file.

<LoadModule php5_module /home/nprasanna/test/modules/libphp5.so>

I downloaded the latest PHP 5.2.4 and install it and got the libphp5.so, but i dont know how to include the ssh2.so while creating libphp5.so.

Please let me know, whether it is possible to create libphp5.so with ssh2.so support and make it work using Apache.

Also i tried by compiling PHP with a custom_php.ini file, (--with-config-file-path).  In that custom_php.ini, i specified the ssh2.so as extension=ssh2.so, with the correct path of extension_dir value, failed that case too.

Please guide me how to use shh2.so in libphp5.so. whether we need to specify this at the creation of libphp5.so or we can make this possible by custom php.ini file.
05-May-2007 03:48
@ anca-phpdoc at anca dot tv:

You can use ./configure --with-libxml-dir=/path_to_xml2-config
chris dot good at NOSPAM dot infor dot com
10-May-2006 09:12
Re Solaris
I was able to compile PHP 5.0.4 under Solaris 2.6 but I had to use gcc to do it. The source is not compatible with the Solaris C preprocessor. I did not have to install any of the gnu utilities (like sed etc) to get it to compile. It clean compiled & linked immediately using gcc 3.3.2.
timothy at imail dot ru
02-May-2006 04:24
Note on PHP5 setup under RedHat 7

Sometimes php5 fails to build with the following message:

[root@www bin]# ./php5
./php5: error while loading shared libraries: unexpected reloc type 0x80

Below is the configure script used:    

# PHP5 CLI build, CGI/SAPI disabled
# Created by configure

'./configure' \
'--enable-libxml' \
'--with-mysql=/path_to_mysql' \
'--with-libxml=/path_to_my_libxml' \
'--program-suffix=5' \
'--disable-cgi' \
"$@"

I used the following trick to get round this:

0. If it is not a clean installation, run 'make clean' to get rid of improperly compiled files

1. run ./configure with required options
2. edit makefile:
2.1 find any LDFLAGS or PROGRAM_LDFLAGS definition
2.2 append -lstdc++ to the end of it
3. Run 'make'
4. Run 'make install'
5. Enjoy!!!
anca-phpdoc at anca dot tv
09-Dec-2005 04:48
For the configure newbies among us:

If you update or reinstall any of the libraries used to compile in a different directory than they started out, you will need to make sure that you update the config.cache file (or re-generate it) so that configure will not look in the wrong place for the information.

On Mac OS X, for example, I updated my libxml using Fink.  Fink placed the files in the /sw directory.  However, php was still looking for important libxml files (such as xml2-config) in the old directory (/usr/bin/xml2-config).   After updating config.cache with the new value of the xml2-config path, I was able to compile correctly.
datemplar at freePotatoes dot fr
04-Oct-2005 02:15
If the option --with-apsx2=/path/to/apxs seems to have absolutely no effect and if the configure script ignores the Apache 2.x support, try to shutdown your Apache server (/path/to/bin/apachectl stop) and retry.

It worked here.
didier b.
07-Aug-2005 01:52
I post here because I was unable to find the information on the web.
I hope it will help someone.

Let say you have 2 apache ruuning, on one you want to have disable_functions set and on the other one you don't.

In fact I have (one) solution compiling two differents php modules with differents path to php.ini

using :
--with-config-file-path=/etc/php5  (for the first one)
--with-config-file-path=/etc/php5.nonchroote (for the second one)

for the second one I do not use "make install" but just
"cp .libs/libphp5.so /usr/lib/apache/1.3/libphp5.nonchroote.so"

Then you have to change the
LoadModule php5_module        /usr/lib/apache/1.3/libphp5.nonchroote.so in the second httpd.conf
brad at computechnv dot com
08-Apr-2005 12:07
My problem was actually with mod_dav (which referred me here). Since they took the time to point people here, I thought I'd go ahead and add my two cents worth and expand on the above since it obviously affects PHP as well. I am running Fedora Core 3, Apache 2.0.53, & PHP 5.03. Apache and PHP were built from source.

The first suggestion in section 13 above was close, but not exactly what I needed. jimsteele's suggestion would have worked, but you would have to do it every time you use APXS. What I did was copy these lines:

my $CFG_CFLAGS_SHLIB  = '-fpic -DSHARED_MODULE';
my $CFG_LD_SHLIB      = 'gcc';
my $CFG_LDFLAGS_SHLIB = q(-shared);

and pasted them in the configuration section of my apxs file. Worked like a champ.
dl927 at torfree dot net
12-Feb-2004 06:17
Compiling mod_php4 port on a clean freeBSD 4.8 install for Apache2 needed FOR_APACHE2= yes manually inserted into Makefile prior to version check.
dale at botkin dot org
04-Nov-2002 11:20
If you have customized your Apache to lie about its version number, you may need to edit configure to skip the version number check.  Just /APACHE_VERSION in configure to find the instance(s) where configure checks to make sure you have the right combination of --with-apxs or --with_apxs2 and Apache 1.3 or 2.0.  Assuming you're smart enough to remember which version of Apache you have, you can just delete or comment out the version check and continue to march.
jimsteele at nospam dot com
14-Oct-2001 10:43
Defining the right environment variables for my Apache "make" invocation allowed the correct "apxs" file to be generated for me.  Your mileage may vary.

cd ../apache_1.3.22
CFLAGS_SHLIB="-fpic -DSHARED_MODULE" \
  LD_SHLIB=gcc \
  LDFLAGS_MOD_SHLIB="-shared" \
  make

Uso de PHP> <Instalación
Last updated: Fri, 04 Jul 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites