When building PHP 5.3.x for Apache 2.4.x you may get an error in the apxs query for the MPM_NAME.
This is because the apxs included in Apache 2.4.x doesn't recognize that query anymore.
To resolve this issue one should modify the PHP configure file to use the right MPM module used by Apache.
To know the used MPM you can execute this command: apachectl -t -D DUMP_MODULES | grep mpm
Then, edit the PHP configure file, search for the APXS_MPM variable and force its value to prefork, event or worker according to the value returned by the previous command.
Hope it helps.
-
Fabio
Desenvolvendo Problemas
Esta seção reúne os erros mais comuns que ocorrem na tempo de compilação.
- Eu peguei a última versão do PHP usando o serviço do SVN anónimo, mas não há nenhum script de configuração!
- Estou tendo problemas para configurar o PHP para trabalhar com Apache. Diz que não consegue encontrar httpd.h,mas é certo onde eu disse que é!
- Ao configurar o PHP (./configure), você se deparar com um erro semelhante ao seguinte: checar a próxima saída de arquivo root... ./configure: lex: command not found configure: error: não consegue encontrar a saída de Lex; desistir
- Quando tento iniciar o Apache, recebo a seguinte mensagem: deslocalização de erro fatal: file / path/to/libphp4.so: ap_block_alarms símbolo: O símbolo de referência não encontrada
- Quando eu executar o configure, ele diz que não pode encontrar o incluir arquivos ou a biblioteca de GD, gdbm, ou algum outro pacote!
- Quando se está compilando os arquivos language-parser.tab.c, me devolve um erro que diz yytname undeclared.
- Quando eu executo make, parace rodar bem mas então falha quando tenta linkar a applicação final, queixando-se que não consegue encontrar alguns arquivos.
- Quando linkando o PHP, ele reclama de um número de referências indefinidas.
- Eu não posso entender como construir PHP com Apache 1.3.
- Eu segui todos os passos da istalação do modulo da versão do Apache no Unix, e meus scripts PHP são mostrados no meu navegador ou sou interrogado para salvar os arquivos.
- la diz para usar: - activate-module = src/modules/php4/libphp4.a , mas esse arquivo não existe, então mudei para - activate-module = src/modules/php4/libmodphp4.a e não funciona!? O que está acontecendo?
- Quando tento compilar o Apache com o PHP como um módulo estático usando - activate-module = src/modules/php4/libphp4.a ele diz-me que o meu compilador não é compatível com ANSI.
- Quando tento compilar o PHP usando --with-apxs Recebo mensagens de erro estranha.
- Durante make , eu recebo erros no microtime, e um monte de RUSAGE_ material.
- Ao compilar o PHP com MySQL, configurar corre bem, mas durante fazer I get um erro semelhante ao seguinte: ext / mysql / libmysql / my_tempnam.o (texto. +0 x46):Em função my_tempnam ': / php4/ext/mysql/libmysql/my_tempnam.c: 103: o mkstemp utilizando de tempnam 'é perigoso, melhor' , O que está errado ?
- Eu quero atualizar o meu PHP. Onde posso encontrar o . / Configure linha que foi usada para construir a minha instalação atual do PHP?
- Quando compilar o PHP com a biblioteca GD é estranho ou dá erros de compilação segfaults ou em execução.
- Ao compilar o PHP eu recebo erros aparentemente aleatória, como ele reage. Estou usando o Solaris se o que importa.
- Eu peguei a última versão do PHP usando o serviço do SVN anónimo, mas não há nenhum script de configuração!
-
Você tem que ter o pacote GNU autoconf instalado para que você possa gerar o script de configuração de configure.in.Basta executar ./buildconfno diretório de nível mais alto após a obtenção as fontes do servidor SVN. (Além disso, a menos que você executar configure com o --enable-maintainer-mode opção, o script de configuração não irá começar automaticamente reconstruída quando o configure.inarquivo é atualizado, então você deve certificar-se de fazer isso manualmente quando você percebe configure.inmudou. Um sintoma do presente é encontrar coisas como variável @ @ em seu Makefile após configurar ou config.status quando é executado.)
- Estou tendo problemas para configurar o PHP para trabalhar com Apache. Diz que não consegue encontrar httpd.h,mas é certo onde eu disse que é!
-
Você precisa dizer ao configure / script de configuração da localização do alto nível de sua árvore fonte do Apache. Isto significa que pretende especificar --with-apache=/path/to/apache and not --with-apache=/path/to/apache/src .
-
Ao configurar o PHP (./configure), você se deparar com
um erro semelhante ao seguinte:
checar a próxima saída de arquivo root... ./configure: lex: command not found
configure: error: não consegue encontrar a saída de Lex; desistir
-
Não deixe de ler a instalação instruções cuidadosamente e note que você precisa de ambos flex e bison instalado para compilar o PHP. Dependendo da configuração que irá instalar bison e flex a partir de qualquer fonte ou um pacote, como um RPM.
- Quando eu executar o configure, ele diz que não pode encontrar o incluir arquivos ou a biblioteca de GD, gdbm, ou algum outro pacote!
-
Você pode fazer o script de configuração procura por arquivos de cabeçalho e bibliotecas em locais não-padrão, especificando parâmetros adicionais para passar para o pré-processador C e linker, tais como:
If you're using a csh-variant for your login shell (why?), it would be:CPPFLAGS=-I/path/to/include LDFLAGS=-L/path/to/library ./configureenv CPPFLAGS=-I/path/to/include LDFLAGS=-L/path/to/library ./configure
- Quando se está compilando os arquivos language-parser.tab.c, me devolve um erro que diz yytname undeclared.
-
Você precisa atualizar sua versão do Bison. Você pode encontrar a última versão em » http://www.gnu.org/software/bison/bison.html.
- Quando eu executo make, parace rodar bem mas então falha quando tenta linkar a applicação final, queixando-se que não consegue encontrar alguns arquivos.
-
Algumas versões antigas de make que não colocam corretmente a versão compilada dos arquivos nos diretórios das funções dentro do mesmo diretório. Tente rodar cp *.o functions e então execute novamente make para ver se isso ajuda. Se não ajudar, você realmente deve atualizar para uma versão mais recente de GNU make.
- Quando linkando o PHP, ele reclama de um número de referências indefinidas.
-
De uma olhada na linha do link e tenha certeza que todas as bibliotecas apropriadas estão sendo incluidas no final. É comum que talvez você tenha esquecidos os '-ldl' e qualquer biblioteca requerida para qualquer suporte de banco de dados que você incluiu.
Se você estiver ligado ao Apache 1.2.x, você se lembrou de adicionar a informação apropriada para a linha EXTRA_LIBS do arquivo de configuração e reiniciou o script de configuração do Apache? Veja o Capítulo de instalação para mais informações.
Algumas pessoas também tem reportado que elas tem que adicionar '-ldl' imediatamente seguido de libphp4.a quando ligado com o Apache.
- Eu não posso entender como construir PHP com Apache 1.3.
-
Isso é na verdade muito fácil. Siga esses passos cuidadosamente:
- Obtenha a distribuição da última versão do Apache 1.3 no link » http://httpd.apache.org/download.cgi.
- Ungzip e descompacte em algum lugar, por exemplo /usr/local/src/apache-1.3.
- Compile o PHP rodando primeiramente ./configure --with-apache=/<path>/apache-1.3 (substitua <path> pelo caminho atual do seu diretório apache-1.3.
- Digite make seguido por make install para desenvolver o PHP e copiar os arquivos necessários para a árvore de distribuição do Apache.
- Troque os diretórios dentro do seu diretório /<path>/apache-1.3/src e edite o arquivo Configuration. Adicione ao arquivo: AddModule modules/php4/libphp4.a.
- Digite: ./configure seguido de make.
- Você deve ter agora um binário com PHP ativado!
Nota: Você pode também usar o novo script Apache ./configure. Veja as instruções no arquivo README.configure o qual faz parte da sua distribuição Apache. Veja também no arquivo INSTALL na distrubuição PHP.
- Eu segui todos os passos da istalação do modulo da versão do Apache no Unix, e meus scripts PHP são mostrados no meu navegador ou sou interrogado para salvar os arquivos.
-
Isso significa que o modulo do PHP não esta sendo chamaado por alguma razão. Três coisas para se checar antes de pedir por mais ajuda:
- Tenha certeza que o binário httpd que você esta executndo é o que você acabou de construir. Para fazer isso, tente executar: /caminho/para/binário/httpd -l Se você não vê mod_php4.c constantes, então você não estiver executando o binário do direito. Encontrar e instalar o binário correto.
- Certifique-se de ter adicionado o correto Mime Type em um dos seus arquivos .conf do Apache. Deve-se: AddType application / x-httpd-php. php Também certifique-se que esta linha AddType não está escondido dentro de uma bloco <Virtualhost> ou <Directory> que impedi-lo de aplicação para a localização de seu script de teste.
- Finalmente, a localização padrão dos arquivos de configuração do Apache mudou entre o Apache 1.2 e Apache 1.3. Você deve verificar a certifique-se que o arquivo de configuração que você está adicionando o AddType linha para que realmente está sendo lido. Você pode colocar um óbvio erro de sintaxe em seu arquivo httpd.conf ou alguma outra mudança evidente que dizer se o arquivo estiver sendo lido corretamente.
- la diz para usar: - activate-module = src/modules/php4/libphp4.a , mas esse arquivo não existe, então mudei para - activate-module = src/modules/php4/libmodphp4.a e não funciona!? O que está acontecendo?
-
Note que o libphp4.a não é suposto existir. O processo apache irá criá-lo!
- Quando tento compilar o Apache com o PHP como um módulo estático usando - activate-module = src/modules/php4/libphp4.a ele diz-me que o meu compilador não é compatível com ANSI.
-
Esta é uma mensagem de erro enganosas da Apache que foi corrigido nas versões mais recentes.
- Quando tento compilar o PHP usando --with-apxs Recebo mensagens de erro estranha.
-
Há três coisas para buscar aqui. Em primeiro lugar, por alguma razão Apache quando constrói o script Perl apxs, às vezes acaba ficando de fora o compilador adequado e variáveis bandeiras. Encontre o seu script apxs (tente o comando que apxs ), às vezes é encontrado em / usr / local / apache / bin / apxs ou / usr / sbin / apxs . Abri-lo e verificar se há linhas semelhantes a estas:
Se é isso que você vê, você encontrou o seu problema. Podem contenham apenas espaços ou outros valores incorretos, como 'q ()'. Alterar estas linhas para dizer:my $CFG_CFLAGS_SHLIB = ' '; # substituted via Makefile.tmpl my $CFG_LD_SHLIB = ' '; # substituted via Makefile.tmpl my $CFG_LDFLAGS_SHLIB = ' '; # substituted via Makefile.tmpl
O segundo problema possível só deve ser um problema no Red Hat 6.1 e 6.2. O script apxs navios Red Hat está quebrado. Procure por esta linha: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
Se você vê a linha acima, mude para isto:my $CFG_LIBEXECDIR = 'modules'; # substituted via APACI install
Finalmente, se você reconfigurar / Apache reinstalar, adicionar um make clean para o processo depois . / configure e antes make .my $CFG_LIBEXECDIR = '/usr/lib/apache'; # substituted via APACI install
- Durante make , eu recebo erros no microtime, e um monte de RUSAGE_ material.
-
Durante o make parcela da instalação, Se você encontrar problemas que parecem semelhantes a este:
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
Seu sistema está falido. É preciso corrigir o seu /usr/include por instalação de um pacote glibc-devel glibc que corresponde ao seu. Isto tem absolutamente nada a ver com o PHP. Para provar isso a si mesmo, tente este teste simples:
Se isso mostrar os erros, você conhece o seu arquivos de inclusão são desarrumados.$ cat >test.c <<X #include <sys/resource.h> X $ gcc -E test.c >/dev/null
- Ao compilar o PHP com MySQL, configurar corre bem, mas durante fazer I get um erro semelhante ao seguinte: ext / mysql / libmysql / my_tempnam.o (texto. +0 x46):Em função my_tempnam ': / php4/ext/mysql/libmysql/my_tempnam.c: 103: o mkstemp utilizando de tempnam 'é perigoso, melhor' , O que está errado ?
-
Primeiramente, é importante perceber que este é um Warning e não um erro fatal. Porque este é muitas vezes a saída vista pela última vez durante fazer , Ela pode parecer um erro fatal, mas não é. Claro que, se você define o seu compilador para morrer na avisos, ele vai. Além disso ter em mente que suportam o MySQL é ativado por padrão.
Nota:
A partir do PHP 4.3.2, você também verá o seguinte texto depois a compilação (make) conclui:
Construção completa.
(É seguro ignorar avisos sobre tempnam e tmpnam).
- Eu quero atualizar o meu PHP. Onde posso encontrar o . / Configure linha que foi usada para construir a minha instalação atual do PHP?
-
Ou você olhar para arquivo config.nice, na árvore fonte do seu atual do PHP instalação ou, se este não estiver disponível, basta executar um
script. Em cima da saída do ./configure line, que foi usado para construir esta instalação do PHP é mostrado.<?php phpinfo(); ?>
- Quando compilar o PHP com a biblioteca GD é estranho ou dá erros de compilação segfaults ou em execução.
-
Certifique-se de sua biblioteca GD e PHP estão ligadas contra a mesma função bibliotecas (libpng por exemplo).
- Ao compilar o PHP eu recebo erros aparentemente aleatória, como ele reage. Estou usando o Solaris se o que importa.
-
Usando o não-utilitários GNU ao compilar o PHP pode causar problemas. Ser Certifique-se de usar as ferramentas GNU, a fim de ter certeza de que irá compilar PHP trabalho. Por exemplo, no Solaris, usando o SunOS BSD-compatible ou versões do Solaris sed não vai funcionar, mas usando GNU ou Sun POSIX (XPG4) versões do sed will trabalho. Links: » GNU sed , » GNU flex e » bison .
The configure script of PHP 5.3.0 has some test lines that use expr with the option --, my expr (version 2.0) does not except --. This causes a run of error messages from the shell like:
./configure: line 2xxx: test: =: unary operator expected
expr: syntax error
I used buildconf --force to see if it would fix this.
While it resulted in a quit different file, it still had the lines of code with expr -- in it.
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.
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.
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.
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
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.
When you have installed PHP5 as a package from your distribution source list, such as yast or apt and want to upgrade the probably out of date PHP5 version make sure:
1. Apache-develope tools are installed so that you have APXS(2)
2. make a clean install which means:
make distclean
./configure --with-apxs2=/usr/sbin/apxs2 and other options
make && make test && make clean install
This will take a while, the make test basically tests your php installation if it passes all the bug reports, as of now about 8600.
Those thre lines will take a while longer! So dont panic, but read the output!
This should ensure, that you have .so files again (because of the APXS and that you have established a relation between the apache and php. Obviously you needed to deinstall the mod_php5 first. I would highly recommend to train this and verify that you have all the required kernel source files and compiler stuff on a virtual machine before doing that on your productive server!
@ anca-phpdoc at anca dot tv:
You can use ./configure --with-libxml-dir=/path_to_xml2-config
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!!!
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.
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.
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
