設置 | 登錄 | 註冊

作者共發了8篇帖子。

在瑞芯微RV1106板子上用gcc14.2本地編譯安裝php-8.4.8

1樓 巨大八爪鱼 2025-7-2 10:01

工作目錄:

mkdir -p ~/software/php

cd ~/software/php


【編譯安裝m4-1.4.20】

wget https://ftp.gnu.org/gnu/m4/m4-1.4.20.tar.gz --no-check-certificate

tar xf m4-1.4.20.tar.gz

cd m4-1.4.20

./configure

make

make install

ldconfig

cd ..


【編譯安裝autoconf-2.72】

wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.72.tar.gz --no-check-certificate

tar xf autoconf-2.72.tar.gz

cd autoconf-2.72

./configure

make

make install

ldconfig

cd ..


【編譯安裝libtool-2.5.4】

wget https://ftp.gnu.org/gnu/libtool/libtool-2.5.4.tar.gz --no-check-certificate

tar xf libtool-2.5.4.tar.gz

cd libtool-2.5.4

./configure

make

make install

ldconfig

cd ..


【編譯安裝automake-1.18】

wget https://ftp.gnu.org/gnu/automake/automake-1.18.tar.gz --no-check-certificate

tar xf automake-1.18.tar.gz

cd automake-1.18

./configure

make

make install

ldconfig

cd ..


【編譯安裝pkg-config-0.29.2】

wget https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz --no-check-certificate

tar xf pkg-config-0.29.2.tar.gz

cd pkg-config-0.29.2

./configure --with-internal-glib

make

make install

ldconfig

cd ..


【編譯安裝Python-3.13.5.tar.xz】

特別注意:一定要加--enable-shared選項,把so庫編譯出來。python和其他軟體包不同,enable-shared選項的默認值是no。

wget https://www.python.org/ftp/python/3.13.5/Python-3.13.5.tar.xz --no-check-certificate

tar xf Python-3.13.5.tar.xz

cd Python-3.13.5

./configure --enable-shared

make

make install

ldconfig

cd ..


【編譯安裝libxml2-2.14.4】

wget https://github.com/GNOME/libxml2/archive/refs/tags/v2.14.4.tar.gz --no-check-certificate

mv v2.14.4.tar.gz libxml2-2.14.4.tar.gz

tar xf libxml2-2.14.4.tar.gz

cd libxml2-2.14.4

./autogen.sh

make

make install

ldconfig

cd ..


【編譯安裝sqlite-3.50.1】

wget https://sqlite.org/2025/sqlite-src-3500100.zip --no-check-certificate

unzip sqlite-src-3500100.zip

cd sqlite-src-3500100

./configure

make

make install

ldconfig

cd ..


sqlite3.c文件很大,有8.84MB,編譯大概需要500MB內存,RV1106G3晶片片內的256MB內存不夠用。

編譯前必須開啟swap虛擬內存:swapon /root/swapfile

不然內存會耗盡,提示gcc: fatal error: Killed signal terminated program cc1

編譯完成後可以關閉swap虛擬內存:swapoff /root/swapfile

編譯生成的sqlite3.o大小為5.19MB,sqlite3程序的大小為5.91MB。


[root@luckfox-rv1106 ~/bluetooth]# free -h

              total        used        free      shared  buff/cache   available

Mem:         215.4M      206.6M        2.8M      108.0K        6.0M        3.0M

Swap:          2.0G      310.0M        1.7G


【編譯安裝bzip2-1.0.8】

wget https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz --no-check-certificate

tar xf bzip2-1.0.8.tar.gz

cd bzip2-1.0.8

修改Makefile文件,CFLAGS=末尾加上-fPIC選項。

make

make install

ldconfig

cd ..


【編譯安裝libpsl-0.21.5】

wget https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz --no-check-certificate

tar xf libpsl-0.21.5.tar.gz

cd libpsl-0.21.5

./configure

make

make install

ldconfig

cd ..


【編譯安裝curl-8.14.1】

wget https://curl.se/download/curl-8.14.1.tar.gz --no-check-certificate

tar xf curl-8.14.1.tar.gz

cd curl-8.14.1

./configure --with-openssl

make

make install

ldconfig

cd ..


【編譯安裝libpng-1.6.49】

wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.49.tar.gz

tar xf libpng-1.6.49.tar.gz

cd libpng-1.6.49

./configure

make

make install

ldconfig

cd ..


【編譯安裝cmake-4.0.3】

wget https://github.com/Kitware/CMake/releases/download/v4.0.3/cmake-4.0.3.tar.gz --no-check-certificate

tar xf cmake-4.0.3.tar.gz

cd cmake-4.0.3

swapon /root/swapfile

./configure

make

make install

swapoff /root/swapfile

ldconfig

cd ..


【編譯安裝libjpeg-turbo-3.1.1】

(本軟體包的默認安裝目錄是/opt/libjpeg-turbo)

wget https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.1.1/libjpeg-turbo-3.1.1.tar.gz --no-check-certificate

tar xf libjpeg-turbo-3.1.1.tar.gz

cd libjpeg-turbo-3.1.1

cmake .

make

make install

cd ..


【編譯安裝freetype-2.13.3】

wget https://download.savannah.gnu.org/releases/freetype/freetype-2.13.3.tar.gz --no-check-certificate

tar xf freetype-2.13.3.tar.gz

cd freetype-2.13.3

./configure

make

make install

ldconfig

cd ..


【編譯安裝oniguruma-6.9.10】

wget https://github.com/kkos/oniguruma/releases/download/v6.9.10/onig-6.9.10.tar.gz --no-check-certificate

tar xf onig-6.9.10.tar.gz

cd onig-6.9.10

./configure

make

make install

ldconfig

cd ..


【編譯安裝postgresql-17.5】

https://zh.purasbar.com/post.php?t=32880


【編譯安裝tidy-5.8.0】

wget https://github.com/htacg/tidy-html5/archive/refs/tags/5.8.0.tar.gz --no-check-certificate

mv 5.8.0.tar.gz tidy-html5-5.8.0.tar.gz

tar xf tidy-html5-5.8.0.tar.gz

cd tidy-html5-5.8.0/build/cmake

cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5

make

make install

cd ../../..


【編譯安裝php-8.4.8】

wget https://www.php.net/distributions/php-8.4.8.tar.gz --no-check-certificate

tar xf php-8.4.8.tar.gz

cd php-8.4.8

./configure --prefix=/opt/php-8.4.8 --with-apxs2=/opt/httpd-2.4.63/bin/apxs --enable-bcmath --enable-mbstring --with-bz2 --with-curl --with-gettext --with-mysqli --with-pdo-mysql --with-pgsql --with-pdo-pgsql --enable-gd --with-freetype --with-jpeg --with-openssl --with-tidy --with-zlib JPEG_CFLAGS="-I/opt/libjpeg-turbo/include" JPEG_LIBS="-L/opt/libjpeg-turbo/lib32 -ljpeg"

swapon /root/swapfile

make

make install

swapoff /root/swapfile

cd ..


本人編譯Zend/zend_execute.c這個文件花了43分鐘,而且至少用了280MB的內存。

一開始沒開swap虛擬內存,編譯到一半才開的。


【配置httpd-2.4.63和php-8.4.8】

vi /opt/httpd-2.4.63/conf/httpd.conf

找到DirectoryIndex index.html,加上index.php。

在文件末尾添加:

AddType application/x-httpd-php .php


vi /opt/httpd-2.4.63/htdocs/info.php

內容:

<?php phpinfo() ?>


測試配置:/opt/httpd-2.4.63/bin/httpd -t

重啟apache伺服器:/opt/httpd-2.4.63/bin/apachectl restart

(如果無法訪問網頁,那就多重啟幾次)


訪問:https://板子IP/info.php

可以看到phpinfo的界面,裡面顯示Loaded Configuration File為(none),即沒有加載php.ini文件。


從源碼目錄裡面複製過去:cp ~/software/php/php-8.4.8/php.ini-development /opt/php-8.4.8/lib/php.ini

重啟apache伺服器:/opt/httpd-2.4.63/bin/apachectl restart

查看phpinfo裡面Loaded Configuration File一欄,就可以看到成功加載了/opt/php-8.4.8/lib/php.ini文件。

2樓 巨大八爪鱼 2025-7-2 10:02

【開啟apache rewrite重寫模塊】

vi /opt/httpd-2.4.63/conf/httpd.conf

取消注釋LoadModule rewrite_module modules/mod_rewrite.so

Options Indexes FollowSymLinks改成Options FollowSymLinks

AllowOverride None改成AllowOverride All

測試配置:/opt/httpd-2.4.63/bin/httpd -t

重啟apache伺服器:/opt/httpd-2.4.63/bin/apachectl restart


【測試php訪問postgresql資料庫】

vi /opt/httpd-2.4.63/htdocs/pgsql_test.php

*******文件內容開始*******

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>pgsql test</title>

</head>


<body>

<ul>

<?php

$conn = pg_connect('host=127.0.0.1 port=5432 dbname=mydb user=postgres password=luckfox');

$sql = 'SELECT * FROM test ORDER BY id';

$rs = pg_query($conn, $sql);

while ($row = pg_fetch_array($rs)) {

        echo "  <li>{$row['title']}</li>\n";

}

?>

</ul>

</body>

</html>

*******文件內容結束*******

訪問網址:https://板子IP/pgsql_test.php


3樓 巨大八爪鱼 2025-7-2 10:05
4樓 巨大八爪鱼 2025-7-2 10:08

Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0

Apache/2.4.63 (Unix) OpenSSL/1.1.1w PHP/8.4.8

HTTP/2.0 

5樓 巨大八爪鱼 2025-7-2 10:09

這裡可以看到apache伺服器開了mod_rewrite模塊。

6樓 巨大八爪鱼 2025-7-2 18:29

【安裝phpPgAdmin-7.13.0】

cd ~/software/php

wget https://github.com/phppgadmin/phppgadmin/releases/download/REL_7-13-0/phpPgAdmin-7.13.0.tar.gz --no-check-certificate

tar xf phpPgAdmin-7.13.0.tar.gz -C /opt/httpd-2.4.63/htdocs

cd /opt/httpd-2.4.63/htdocs/phpPgAdmin-7.13.0

修改all_db.php文件,第202行,while (list ($key) = each ($data->codemap)) {改成foreach ($data->codemap as $key => $value) {

                    然後在這個函數外面(第258行)添加一個空的構造函數function __construct() {}

修改classes/database/Connection.php,找到switch (substr($version,0,2)) {,在下面添加一行case '17':(加到所有case的最上面,不要加break語句)


修改conf/config.inc.php文件,第105行$conf['extra_login_security'] = true改成false。

                             在下面加一行ini_set('display_errors', 'off');


修改libraries/adodb/adodb.inc.php文件,注釋掉第432行die('Virtual Class -- cannot instantiate');。


確保/home/postgres/data/pg_hba.conf文件裡面的trust已經全部改成了md5。

訪問網址:https://板子IP/phpPgAdmin-7.13.0

phpPgAdmin-7.13.0支持XP系統的IE6瀏覽器,可用IE6訪問。

在網頁上登錄postgres用戶,輸入正確的密碼luckfox可以登錄成功,輸入其他密碼則登錄失敗。

7樓 巨大八爪鱼 2025-7-2 18:30

PostgreSQL 17.5 架於 localhost:5432 - 您是 "postgres"  

8樓 巨大八爪鱼 2025-7-2 20:16

內容轉換:

回覆帖子
內容:
用戶名: 您目前是匿名發表。
驗證碼:
看不清?換一張
©2010-2025 Purasbar Ver3.0 [手機版] [桌面版]
除非另有聲明,本站採用知識共享署名-相同方式共享 3.0 Unported許可協議進行許可。