20201012在Fedora 19用原始碼安裝httpd-2.4.46
跳至導覽
跳至搜尋
20201012在Fedora 19用原始碼安裝httpd-2.4.46,php5.6.40
- REF 3: https://ezbox.idv.tw/163/centos7-upgrade-apache_2-4-35-php_7-2-11 /
- REF 1: https://newgoodlooking.pixnet.net/blog/post/127510032
- REF 2: http://oldwww.kmvs.km.edu.tw/lf/index.php?op=ViewArticle&articleId=593&blogId=70
(1)下載並解開httpd-2.4.46.tar.gz $ wget https://downloads.apache.org//httpd/httpd-2.4.46.tar.gz $ tar xvzf httpd-2.4.46.tar.gz $ cd httpd-2.4.46/ (2)組態httpd-2.4.46失敗 $ ./configure --prefix=/usr/local/apache2 checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... no configure: error: APR not found. Please read the documentation. [webadm@sice httpd-2.4.46]$ ./configure --prefix=/usr/local/apache (3)下載並安裝apr $ cd .. $ wget https://downloads.apache.org//apr/apr-1.7.0.tar.gz $ cd apr-1.7.0 $ tar xvzf apr-1.7.0.tar.gz $ ./configure --prefix=/usr/local/apr : rm: cannot remove 'libtoolT': No such file or directory config.status: executing default commands $ make $ su $ make $ make install (4)下載並安裝apr-util # 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 # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr # make : xml/apr_xml.c:35:19: 嚴重錯誤:expat.h:沒有此一檔案或目錄 #include <expat.h> ^ 編譯插斷。 make[1]: *** [xml/apr_xml.lo] Error 1 make[1]: Leaving directory `/home/webadm/apr-util-1.6.1' make: *** [all-recursive] Error 1 # yum install expat-devel # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr # make # make install (5)重新組態並編譯及安裝httpd-2.4.46 $ cd httpd-2.4.46/ # ./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 # make # make install (6) 啟動apache成功 # /usr/local/apache2/bin/apachectl start # ps ax|grep httpd 19465 ? Ss 0:00 /usr/local/apache2/bin/httpd -k start 19466 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 19467 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 19468 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 19551 pts/0 S+ 0:00 grep --color=auto httpd # /usr/local/apache2/bin/httpd -v Server version: Apache/2.4.46 (Unix) Server built: Oct 12 2020 21:25:58 # uname -a Linux sice.idv.tw 3.14.27-100.fc19.i686.PAE #1 SMP Wed Dec 17 19:56:19 UTC 2014 i686 i686 i386 GNU/Linux (7) 連 http://localhost/ It works! (8) # wget https://www.php.net/distributions/php-7.4.11.tar.gz # tar xvzf php-7.4.11.tar.gz # cd php-7.4.11 # yum install cmake Loaded plugins: langpacks, refresh-packagekit Package cmake-2.8.12.2-2.fc19.i686 already installed and latest version Nothing to do # ./configure # make # make test #make install Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ Installing PHP CLI binary: /usr/local/bin/ : # /usr/local/bin/php -v PHP 7.4.11 (cli) (built: Oct 12 2020 21:54:11) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies # cp php.ini-development /usr/local/lib/php.ini (9) # vi /usr/local/apache2/conf/httpd.conf : AddType application/x-httpd-php .php .php3 : # /usr/local/apache2/bin/apachectl stop # /usr/local/apache2/bin/apachectl start (10) # yum install httpd-devel # yum install php-fpm # whereis php-fpm php-fpm: /usr/sbin/php-fpm /etc/php-fpm.conf /etc/php-fpm.d /usr/local/sbin/php-fpm /usr/local/etc/php-fpm.d /usr/share/man/man8/php-fpm.8.gz (11) [root@sice php-7.4.11]# cp php.ini-production /usr/local/lib/php.ini cp:是否覆寫 ‘/usr/local/lib/php.ini’? Y (12) #yum install openssl-devel curl-devel expat-devel gettext-devel zlib-devel libpng-devel freetype-devel libxslt-devel libxml2-devel -y (13) # 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/ (14) #./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 (15) # make : PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled. : # make test # make install #libtool --finish /home/webadm/php-5.6.40/libs (16) # ls /usr/local/php/bin -l 總計 62012 -rwxr-xr-x. 1 root root 837 10月 16 22:08 pear -rwxr-xr-x. 1 root root 858 10月 16 22:08 peardev -rwxr-xr-x. 1 root root 771 10月 16 22:08 pecl lrwxrwxrwx. 1 root root 9 10月 16 22:08 phar -> phar.phar -rwxr-xr-x. 1 root root 14833 10月 16 22:08 phar.phar -rwxr-xr-x. 1 root root 31774001 10月 16 22:08 php -rwxr-xr-x. 1 root root 31680056 10月 16 22:08 php-cgi -rwxr-xr-x. 1 root root 3119 10月 16 22:08 php-config -rwxr-xr-x. 1 root root 4538 10月 16 22:08 phpize [root@sice php-5.6.40]# date 五 10月 16 22:17:06 CST 2020 [root@sice php-5.6.40]# # /usr/local/php/bin/php -v PHP 5.6.40 (cli) (built: Oct 16 2020 21:51:23) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies [root@sice php-5.6.40]# # php -v PHP 7.4.11 (cli) (built: Oct 13 2020 20:33:14) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies # whereis php php: /usr/bin/php /usr/lib/php /etc/php.ini /etc/php.d /usr/local/bin/php /usr/local/lib/php /usr/local/lib/php.ini /usr/include/php /usr/local/php /usr/share/php /usr/share/man/man1/php.1.gz # /usr/bin/php -v PHP 5.5.20 (cli) (built: Dec 18 2014 05:56:44) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies (17) # cp php.ini-development /usr/local/lib/php.ini cp:是否覆寫 ‘/usr/local/lib/php.ini’? y [root@sice php-5.6.40]# (18) /usr/local/apache2/bin/apachectl restart (19)http://localhost/a.php OK