Версия программного обеспечения
- apache 2.4.29
- php 5.4.45
Установка PHP
# tar -zxvf php-5.4.45.tar.gz # cd php-5.4.45 # ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml2=/usr/include/libxml2 # make # make install
Ошибки в установке и решениях
Ошибки, возникшие на следующих этапах
/настроить –префикс=/usr/локальный/php –с-apxs2=/usr/локальный/apache2/bin/apxs –с-libxml2=/usr/включить/libxml2
Журнал ошибок:
Sorry, I cannot run apxs. Possible reasons follow: 1. Perl is not installed 2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs 3. Apache was not built using --enable-so (the apxs usage page is displayed) The output of /usr/local/apache2/bin/apxs follows: ./configure: /usr/local/apache2/bin/apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory configure: error: Aborting
Установите Perl в соответствии с запросом
# Perl-v// Check first and see if it's not installed # yum install -y perl # Perl-v//Successful installation This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi Copyright 1987-2009, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Снова./настройка все еще запрашивает эту ошибку. Итак, Байду… Только тогда знайте, что вам нужно следовать Perl, а затем apache. Если вы установите Apache без perl, apxs не будет работать. Средства правовой защиты: см. файл
# cat /usr/local/apache2/bin/apxs
Первая строка -#!/заменить/на/путь/к/perl/интерпретатору-w. Замените на: #!/usr/bin/perl-w Снова:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml2=/usr/include/libxml2
Успех!
Интеграция с Apache
1. изменение httpd.conf
Если PHP установлен правильно, файл конфигурации Apache будет автоматически скопирован (httpd.conf.bak) и изменен следующим образом.Откройте следующий комментарий и загрузите модуль PHP. Модули LoadModule php5_module/libphp5.so
Если вы хотите, чтобы Apache анализировал PHP-файлы, вам также необходимо добавить его в httpd.conf (#AddOutputFilter ВКЛЮЧАЕТ.shtml):
AddType application/x-httpd-php .html AddHandler php5-script .php
- Пусть Apache проанализирует PHP-код AddHandler php5-script .php
- Пусть Apache проанализирует PHP-код в HTML Приложение AddType/x-httpd-php .html