搜尋
首頁後端開發php教程linux - php7.0.13 安裝完成gd函式庫沒有freetype

linux小白,red hat 7.0 下安裝php 7.0.13,完成之後在phoinfo中的gd擴充內沒有freetype。

編譯腳本

<code>./configure --with-apxs2=/usr/local/apache/bin/apxs  --prefix=/usr/local/php --with-gd --with-freetype-dir=/usr/include/freetype2/freetype
</code>

freetype使用yum安裝的,位置就在/usr/include/freetype2/freetype,編譯完成並安裝php之後,貌似並沒有裝上freetype。試了好幾遍都不行,初入linux,也不知道問題出在哪。麻煩幫忙看看。

下圖是phpinfo中的gd庫信息,可見gd庫是裝上了的。

linux - php7.0.13 安裝完成gd函式庫沒有freetype

回覆內容:

linux小白,red hat 7.0 下安裝php 7.0.13,完成之後在phoinfo中的gd擴充內沒有freetype。

編譯腳本

<code>./configure --with-apxs2=/usr/local/apache/bin/apxs  --prefix=/usr/local/php --with-gd --with-freetype-dir=/usr/include/freetype2/freetype
</code>

freetype使用yum安裝的,位置就在/usr/include/freetype2/freetype,編譯完成並安裝php之後,貌似並沒有裝上freetype。試了好幾遍都不行,初入linux,也不知道問題出在哪。麻煩幫忙看看。

下圖是phpinfo中的gd庫信息,可見gd庫是裝上了的。

linux - php7.0.13 安裝完成gd函式庫沒有freetype

之前寫過一個安裝備忘[cetnos 7],直接黏過來了.
freetype截圖:
linux - php7.0.13 安裝完成gd函式庫沒有freetype

安裝依賴程式包

yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel

安裝php

configure

./configure --prefix=/alidata/server/php-7.0.5  --enable-fpm --with-fpm-user=nginx  --with-fpm-group=nginx --enable-inline-optimization --disable-debug --disable-rpath --enable-shared  --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv=/usr/local --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir  --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets  --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache

缺少libiconv

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -zxvf libiconv-1.14.tar.gz
cd libiconv-1.14.1
 ./configure --prefix=/usr/local
make && make install

注意

  1. 這裡的--prefix 和 php裡的--with-iconv值保持一致

  2. 將安裝包下檔案 :srclib/stdio.in.h _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 改為

#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif 

編譯時記憶體不足

virtual memory exhausted: Cannot allocate memory
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

解決:新增swap交換記憶體

#1.进入目录
cd /var
#2.获取要增加的SWAP文件块(这里以1GB为例)
dd if=/dev/zero of=swapfile bs=1024 count=1038336
#3.创建SWAP文件
/sbin/mkswap swapfile
#4.激活SWAP文件
/sbin/swapon swapfile
#5.查看SWAP信息是否正确
/sbin/swapon -s
#6.添加到fstab文件中让系统引导时自动启动
echo "/var/swapfile swap swap defaults 0 0" >>/etc/fstab

操作範例

<code>[root@iZ25uog2aivZ var]# dd if=/dev/zero of=swapfile bs=1024 count=1038336
1038336+0 records in
1038336+0 records out
1063256064 bytes (1.1 GB) copied, 19.287 s, 55.1 MB/s
[root@iZ25uog2aivZ var]# /sbin/mkswap swapfile
Setting up swapspace version 1, size = 1038332 KiB
no label, UUID=59e3b114-ed70-4d64-af01-2d02873fa358
[root@iZ25uog2aivZ var]# /sbin/swapon swapfile
swapon: /var/swapfile: insecure permissions 0644, 0600 suggested.
[root@iZ25uog2aivZ var]# /sbin/swapon -s
Filename                Type        Size    Used    Priority
/var/swapfile                              file    1038332    0    -1
[root@iZ25uog2aivZ var]# echo "/var/swapfile swap swap defaults 0 0" >>/etc/fstab
[root@iZ25uog2aivZ var]# free -m
             total       used       free     shared    buffers     cached
Mem:           992        923         69         81          1        309
-/+ buffers/cache:        611        381
Swap:         1013          0       1013
[root@iZ25uog2aivZ var]# 
</code>

編譯與安裝

$ make && make install

這裡要make好久,要耐心一下

配置php-fpm

$ cp php.ini-production /etc/php.ini
$ cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

$ cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
$ cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
$ chmod +x /etc/init.d/php-fpm

參考

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
可以在PHP會話中存儲哪些數據?可以在PHP會話中存儲哪些數據?May 02, 2025 am 12:17 AM

phpsessionscanStorestrings,數字,數組和原始物。

您如何開始PHP會話?您如何開始PHP會話?May 02, 2025 am 12:16 AM

tostartaphpsession,usesesses_start()attheScript'Sbeginning.1)placeitbeforeanyOutputtosetThesessionCookie.2)useSessionsforuserDatalikeloginstatusorshoppingcarts.3)regenerateSessiveIdStopreventFentfixationAttacks.s.4)考慮使用AttActAcks.s.s.4)

什麼是會話再生,如何提高安全性?什麼是會話再生,如何提高安全性?May 02, 2025 am 12:15 AM

會話再生是指在用戶進行敏感操作時生成新會話ID並使舊ID失效,以防會話固定攻擊。實現步驟包括:1.檢測敏感操作,2.生成新會話ID,3.銷毀舊會話ID,4.更新用戶端會話信息。

使用PHP會話時有哪些性能考慮?使用PHP會話時有哪些性能考慮?May 02, 2025 am 12:11 AM

PHP会话对应用性能有显著影响。优化方法包括:1.使用数据库存储会话数据,提升响应速度;2.减少会话数据使用,只存储必要信息;3.采用非阻塞会话处理器,提高并发能力;4.调整会话过期时间,平衡用户体验和服务器负担;5.使用持久会话,减少数据读写次数。

PHP會話與Cookie有何不同?PHP會話與Cookie有何不同?May 02, 2025 am 12:03 AM

PHPsessionsareserver-side,whilecookiesareclient-side.1)Sessionsstoredataontheserver,aremoresecure,andhandlelargerdata.2)Cookiesstoredataontheclient,arelesssecure,andlimitedinsize.Usesessionsforsensitivedataandcookiesfornon-sensitive,client-sidedata.

PHP如何識別用戶的會話?PHP如何識別用戶的會話?May 01, 2025 am 12:23 AM

phpIdentifiesauser'ssessionSessionSessionCookiesAndSessionId.1)whiwsession_start()被稱為,phpgeneratesainiquesesesessionIdStoredInacookInAcookInAcienamedInAcienamedphpsessIdontheuser'sbrowser'sbrowser.2)thisIdallowSphptpptpptpptpptpptpptpptoretoreteretrieetrieetrieetrieetrieetrieetreetrieetrieetrieetrieetremthafromtheserver。

確保PHP會議的一些最佳實踐是什麼?確保PHP會議的一些最佳實踐是什麼?May 01, 2025 am 12:22 AM

PHP會話的安全可以通過以下措施實現:1.使用session_regenerate_id()在用戶登錄或重要操作時重新生成會話ID。 2.通過HTTPS協議加密傳輸會話ID。 3.使用session_save_path()指定安全目錄存儲會話數據,並正確設置權限。

PHP會話文件默認存儲在哪裡?PHP會話文件默認存儲在哪裡?May 01, 2025 am 12:15 AM

phpsessionFilesArestoredIntheDirectorySpecifiedBysession.save_path,通常是/tmponunix-likesystemsorc:\ windows \ windows \ temponwindows.tocustomizethis:tocustomizEthis:1)useession_save_save_save_path_path()

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

MantisBT

MantisBT

Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

SecLists

SecLists

SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )專業的PHP整合開發工具

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境