20201015在Fedora 32用原始碼安裝httpd-2.4.46及php-5.6.40
跳至導覽
跳至搜尋
20201015在Fedora 32用原始碼安裝httpd-2.4.46及php-5.6.40
(1) # wget https://www.php.net/distributions/php-5.6.40.tar.gz # tar xvzf php-5.6.40.tar.gz # cd php-5.6.40/ (2) # ./configure : checking for xml2-config path... configure: error: xml2-config not found. Please check your libxml2 installation. (3) [root@localhost php-5.6.40]# yum install libxml2-devel -y : Complete! # find / -name "xml2-config" /usr/bin/xml2-config (4) # ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-mbstring --with-curl --with-openssl --with-xmlrpc --enable-soap --enable-zip --with-gd --with-jpeg-dir --with-png-dir --with-mysqli --with-pgsql --enable-embedded-mysqli --with-freetype-dir --with-ldap --enable-intl --with-xsl --with-zlib : Sorry, I cannot run apxs. (5) # yum install httpd-devel Installed: apr-devel-1.7.0-3.fc32.x86_64 apr-util-devel-1.6.1-12.fc32.x86_64 cyrus-sasl-2.1.27-4.fc32.x86_64 cyrus-sasl-devel-2.1.27-4.fc32.x86_64 expat-devel-2.2.8-2.fc32.x86_64 httpd-devel-2.4.46-1.fc32.x86_64 libdb-devel-5.3.28-40.fc32.x86_64 openldap-devel-2.4.47-5.fc32.x86_64 Complete! (6) ]# perl -v This is perl 5, version 30, subversion 3 (v5.30.3) built for x86_64-linux-thread-multi (with 92 registered patches, see perl -V for more detail) : [root@localhost php-5.6.40]# (7) # wget https://downloads.apache.org//apr/apr-1.7.0.tar.gz $ tar xvzf apr-1.7.0.tar.gz $ cd apr-1.7.0 $ ./configure --prefix=/usr/local/apr $ make $ make install (8) # wget https://downloads.apache.org//apr/apr-util-1.6.1.tar.gz # tar xvzf apr-util-1.6.1.tar.gz # cd apr-util-1.6.1 # yum install expat-devel # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr # make # make install (9)重新組態並編譯及安裝httpd-2.4.46 # httpd -v Server version: Apache/2.4.46 (Fedora) Server built: Aug 25 2020 00:00:00 # ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-mods-shared=all –enable-mpms-shared=all : configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/ (9-2) # yum install -y pcre-devel : Installed: pcre-cpp-8.44-1.fc32.x86_64 pcre-devel-8.44-1.fc32.x86_64 pcre-utf16-8.44-1.fc32.x86_64 pcre-utf32-8.44-1.fc32.x86_64 Complete! (9-3) 組態OK # ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-mods-shared=all –enable-mpms-shared=all : configure: summary of build options: Server Version: 2.4.46 Install prefix: /usr/local/apache2 C compiler: gcc CFLAGS: -g -O2 -pthread CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE LDFLAGS: LIBS: C preprocessor: gcc -E (9-4) # make # make install # httpd -v Server version: Apache/2.4.46 (Fedora) Server built: Aug 25 2020 00:00:00 (9-5) # ps ax|grep httpd 1117569 ? Ss 0:00 /usr/sbin/httpd -DFOREGROUND 1117588 ? S 0:00 /usr/sbin/httpd -DFOREGROUND 1117589 ? Sl 0:02 /usr/sbin/httpd -DFOREGROUND 1117590 ? Sl 0:04 /usr/sbin/httpd -DFOREGROUND 1117591 ? Sl 0:02 /usr/sbin/httpd -DFOREGROUND 1118263 ? Sl 0:02 /usr/sbin/httpd -DFOREGROUND 1813506 pts/0 S+ 0:00 grep --color=auto httpd [root@localhost httpd-2.4.46]# kill -9 1117569 [root@localhost httpd-2.4.46]# ps ax|grep httpd 1814157 pts/0 S+ 0:00 grep --color=auto httpd [root@localhost httpd-2.4.46]# /usr/local/apache2/bin/apachectl start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message [root@localhost httpd-2.4.46]# ps ax|grep httpd 1814734 ? Ss 0:00 /usr/local/apache2/bin/httpd -k start 1814735 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 1814736 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 1814737 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 1815215 pts/0 S+ 0:00 grep --color=auto httpd [root@localhost httpd-2.4.46]# (9-6) # /usr/local/apache2/bin/apachectl stop AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message [root@localhost httpd-2.4.46]# systemctl start httpd.service [root@localhost httpd-2.4.46]# ps ax|grep httpd 1822605 ? Ss 0:00 /usr/sbin/httpd -DFOREGROUND 1822608 ? S 0:00 /usr/sbin/httpd -DFOREGROUND 1822609 ? Sl 0:00 /usr/sbin/httpd -DFOREGROUND 1822610 ? Sl 0:00 /usr/sbin/httpd -DFOREGROUND 1822611 ? Sl 0:00 /usr/sbin/httpd -DFOREGROUND 1822878 pts/0 S+ 0:00 grep --color=auto httpd [root@localhost httpd-2.4.46]# (10-1) # cd php-5.6.40/ # make celan #./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysql --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip : Cannot find OpenSSL's : Please reinstall the libcurl distribution : error: png.h not found. : configure: error: freetype-config not found. : xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution : # yum install openssl-devel # yum install curl-devel expat-devel gettext-devel zlib-devel # yum install libpng-devel # yum install freetype-devel # yum install libxslt-devel (10-2) # make : make: *** [Makefile:246: sapi/cli/php] Error 1 # vi Makefile : EXTRA_LIBS = -lcrypt -lresolv -lcrypt -lrt -lrt -lm -ldl -lxml2 -lz -llzma -lm -ldl -lxml2 -lz -llzma -lm -ldl -lxml2 -lz -llzma -lm -ldl -lcrypt -lxml2 -lz -llzma -lm -ldl -lxml2 -lz -llzma -lm -ldl -lxml2 -lz -llzma -lm -ldl -lcrypt -liconv : # make : /usr/bin/ld: cannot find -liconv (10-3) #wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz #tar xf libiconv-1.15.tar.gz #cd libiconv-1.15 #./configure --prefix=/usr/local # make # make install # ldconfig [root@localhost httpd-2.4.46]# cd ../php-5.6.40/ [root@localhost php-5.6.40]# make make: *** [Makefile:246: sapi/cli/php] Error 1 (10-4) # cd ext/phar/ # cp ./phar.php ./phar.phar cp: overwrite './phar.phar'? y # cd ../.. (10-5) # make clean # make : /sapi/cli/php: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory # whereis libiconv.so.2 libiconv.so: /usr/local/lib/libiconv.so.2 /usr/local/lib/libiconv.so # whereis libiconv.so.2 libiconv.so: /usr/local/lib/libiconv.so.2 /usr/local/lib/libiconv.so # ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/ # ls /usr/lib64 -l|grep iconv lrwxrwxrwx. 1 root root 28 Oct 16 05:18 libiconv.so.2 -> /usr/local/lib/libiconv.so.2 # make ZEND_EXTRA_LIBS='-liconv' Build complete. Don't forget to run 'make test'. # make ZEND_EXTRA_LIBS='-liconv' test # make install Installing shared extensions: /usr/local/apache2/lib/php/extensions/no-debug-non-zts-20131226/ Installing PHP CLI binary: /usr/local/apache2/bin/ Installing PHP CLI man page: /usr/local/apache2/php/man/man1/ Installing PHP CGI binary: /usr/local/apache2/bin/ Installing PHP CGI man page: /usr/local/apache2/php/man/man1/ Installing build environment: /usr/local/apache2/lib/php/build/ Installing header files: /usr/local/apache2/include/php/ Installing helper programs: /usr/local/apache2/bin/ program: phpize program: php-config Installing man pages: /usr/local/apache2/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/apache2/lib/php/ [PEAR] Archive_Tar - installed: 1.4.4 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.3 [PEAR] PEAR - installed: 1.10.7 Wrote PEAR system config file at: /usr/local/apache2/etc/pear.conf You may want to add: /usr/local/apache2/lib/php to your php.ini include_path /root/php-5.6.40/build/shtool install -c ext/phar/phar.phar /usr/local/apache2/bin ln -s -f phar.phar /usr/local/apache2/bin/phar Installing PDO headers: /usr/local/apache2/include/php/ext/pdo/ [root@localhost php-5.6.40]# php -v PHP 5.6.40 (cli) (built: Oct 15 2020 23:04:02) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies [root@localhost php-5.6.40]# # cp php.ini-development /usr/local/lib/php.ini cp: overwrite '/usr/local/lib/php.ini'? Y (11) #vi /usr/local/apache2/conf/httpd.conf : ServerName lfwiki.kmvs.km.edu.tw:80 : DirectoryIndex index.html index.php : : <Directory "/usr/local/apache2/htdocs"> : #Options Indexes FollowSymLinks Options FollowSymLinks : LoadModule rewrite_module modules/mod_rewrite.so : <Directory /> AllowOverride All Require all denied </Directory> : (12) # /usr/local/apache2/bin/apachectl stop [root@localhost php-5.6.40]# /usr/local/apache2/bin/apachectl start [root@localhost php-5.6.40]# ps ax|grep httpd 1424258 ? Ss 0:00 /usr/local/apache2/bin/httpd -k start 1424259 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 1424260 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 1424261 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 1424690 pts/0 S+ 0:00 grep --color=auto httpd