20201018在Fedora32用原始碼安裝httpd-2.4.46 及 php-5.5.16

出自金門農工維基III
跳至導覽 跳至搜尋

20201018在Fedora32用原始碼安裝httpd-2.4.46 及 php-5.5.16

(1-1)
# uname -a
Linux localhost.localdomain 5.6.6-300.fc32.x86_64 #1 SMP Tue Apr 21 13:44:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

# date
Sat 17 Oct 2020 08:01:59 PM EDT

# httpd -v
Server version: Apache/2.4.46 (Fedora)
Server built:   Aug 25 2020 00:00:00

# ps ax|grep mysql
1597018 ?        Ssl    2:28 /usr/libexec/mysqld --basedir=/usr
2820631 pts/0    S+     0:00 grep --color=auto mysql
2843596 ?        Ss     0:06 gpg-agent --homedir /var/cache/PackageKit/32/metadata/mysql-connectors-community-32-x86_64.tmp/gpgdir --use-standard-socket --daemon
2843634 ?        Ss     0:06 gpg-agent --homedir /var/cache/PackageKit/32/metadata/mysql-tools-community-32-x86_64.tmp/gpgdir --use-standard-socket --daemon

# ps ax|grep httpd
1430941 ?        Ss     0:06 /usr/sbin/httpd -DFOREGROUND
1430942 ?        S      0:00 /usr/sbin/httpd -DFOREGROUND
1430943 ?        Sl     0:33 /usr/sbin/httpd -DFOREGROUND
1430944 ?        Sl     0:22 /usr/sbin/httpd -DFOREGROUND
1430945 ?        Sl     0:22 /usr/sbin/httpd -DFOREGROUND
1432208 ?        Sl     0:22 /usr/sbin/httpd -DFOREGROUND
2820931 pts/0    S+     0:00 grep --color=auto httpd


(1-2)
# whereis libiconv
libiconv: /usr/local/lib/libiconv.so /usr/local/lib/libiconv.la

#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


(2)
# wget https://www.php.net/distributions/php-5.5.16.tar.gz
# tar xvzf php-5.5.16.tar.gz
# cd php-5.5.16/

(3)
拿掉--with-openssl  
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs  --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv=/usr/local/lib
 --with-iconv-dir=/usr/local/lib  --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysql --with-mysqli  --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
:
Build complete.
Don't forget to run 'make test'.

(4)# make test

(5) #make
:
/usr/bin/ld: /root/php-5.5.16/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close'
collect2: error: ld returned 1 exit status
make: *** [Makefile:270: sapi/cli/php] Error 1
#

(6)
# whereis libiconv.so.2
libiconv.so: /usr/lib64/libiconv.so.2 /usr/local/lib/libiconv.so.2 /usr/local/lib/libiconv.so

# ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/
ln: failed to create symbolic link '/usr/lib64/libiconv.so.2': File exists

# ls /usr/lib64 -l|grep iconv
lrwxrwxrwx.  1 root root       28 Oct 16 05:18 libiconv.so.2 -> /usr/local/lib/libiconv.so.2
(7)
# systemctl stop httpd.service
# /usr/local/apache2/bin/apachectl stop

(8) 組態、編譯、安裝PHP

# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs  --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv=/usr/local/lib
 --with-iconv-dir=/usr/local/lib  --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysql --with-mysqli  --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 --with-mysql=shared

# make

# make test

# make install

# ./libtool --finish /root/php-5.5.16/libs

(9)
# /usr/local/apache2/bin/apachectl start

(10)
# stat /usr/local/apache2/conf/httpd.conf
  File: /usr/local/apache2/conf/httpd.conf
  Size: 19520           Blocks: 40         IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 3253074     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:usr_t:s0
Access: 2020-10-17 21:25:09.400536783 -0400
Modify: 2020-10-17 21:14:53.611063803 -0400
Change: 2020-10-17 21:14:53.611063803 -0400
 Birth: -

# cat /usr/local/apache2/conf/httpd.conf|grep php
    LoadModule php5_module        modules/libphp5.so
    DirectoryIndex index.html  index.php
    AddType application/x-httpd-php .php .php3

(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)
# cd ../httpd-2.4.46/
# make clean
# ./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

(13)
# /usr/local/apache2/bin/apachectl restart

(14)順利啟動PHP
http://lfwiki.kmvs.km.edu.tw/a.php 

(15)
http://lfwiki.kmvs.km.edu.tw/lf/

Fatal error: Call to undefined function mysql_pconnect() in /usr/local/apache2/htdocs/lf/class/database/pdb/drivers/pdbmysqldriver.class.php on line 103