php 相關
-
wget https://www.php.net/distributions/php-7.2.16.tar.gz //你可以官網獲取最新的包
- tar解壓 //一般目錄 /usr/src
- yum -y install gcc gcc-c++ libxml2-devel m4 autoconf pcre-devel make cmake bison //必要擴展(不全)
- 如下 //一行 ./configure
-
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-mbstring --with-curl=/usr/local/curl --with-gd --with-zlib --with-bz2 --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --with-openssl --with-libdir=/lib/x86_64-linux-gnu/ --enable-ftp --with-gettext --with-xmlrpc --enable-opcache --with-iconv --enable-mysqlnd --with-mysqli=mysqlnd --with-iconv-dir --with-kerberos --with-pdo-sqlite --with-pear --enable-libxml --enable-shmop --enable-xml --enable-opcache
/configure \ --prefix=/usr/local/php \ [php安裝的根目錄] --exec-prefix=/usr/local/php \ [php執行文件所在目錄] --bindir=/usr/local/php/bin \ [php/bin目錄] --sbindir=/usr/local/php/sbin \ [php/sbin目錄] --includedir=/usr/local/php/include \ [php包含文件所在目錄] --libdir=/usr/local/php/lib/php \ [php/lib目錄] --mandir=/usr/local/php/php/man \ [php/man目錄] --with-config-file-path=/usr/local/php/etc \ [php的配置目錄] --with-mysql-sock=/tmp/mysql.sock \ [php的Unix socket通信文件] --with-mcrypt \ [是php里面重要的加密支持擴展庫,linux環境下該庫在默認情況下不開啟] --with-mhash \ [Mhash是基於離散數學原理的不可逆向的php加密方式擴展庫,其在默認情況下不開啟] --with-openssl \ [OpenSSL 是一個安全套接字層密碼庫] --with-mysqli=shared,mysqlnd \ [php依賴mysql庫] --with-pdo-mysql=shared,mysqlnd \ [php依賴mysql庫] --with-gd \ [gd庫] --with-iconv \ [關閉iconv函數,種字符集間的轉換] --with-zlib \ [zlib是提供數據壓縮用的函式庫] --enable-zip \ [打開對zip的支持] --enable-inline-optimization \ [優化線程] --disable-debug \ [關閉調試模式] --disable-rpath \ [關閉額外的運行庫文件] --enable-shared \ [啟用動態庫] --enable-xml \ [開啟xml擴展] --enable-bcmath \ [打開圖片大小調整,用到zabbix監控的時候用到了這個模塊] --enable-shmop \ [共享內存] --enable-sysvsem \ [內存共享方案] --enable-mbregex \ [開啟多字節正則表達式的字符編碼。] --enable-mbstring \ [開啟多字節字符串函數] --enable-ftp \ [開啟ftp] --enable-gd-native-ttf \ [開啟gd庫原有字體] --enable-pcntl \ [PHP的進程控制支持實現了Unix方式的多進程創建] --enable-sockets \ [開啟套節字] --with-xmlrpc \ [打開xml-rpc的c語言] --enable-soap \ [開啟簡單對象訪問協議簡單對象訪問協議] --without-pear \ [開啟php擴展與應用庫] --with-gettext \ [開戶php在當前域中查找消息] --enable-session \ [允許php會話session] --with-curl \ [允許curl擴展] --with-openssl \ [允許openssl 擴展 下載composer 會用到] --with-jpeg-dir \ [指定jpeg安裝目錄yum安裝過后不用再次指定會自動找到] --with-freetype-dir \ [指定freetype安裝目錄yum安裝過后不用再次指定會自動找到] --enable-opcache \ [開啟使用opcache緩存] --enable-fpm \ [開啟fpm] --with-fpm-user=nginx \ [php-fpm的用戶] --with-fpm-group=nginx \ [php-fpm的用戶組] --without-gdbm \ [數據庫函數使用可擴展散列和類似於標准UNIX dbm的工作] --enable-fast-install \ [為快速安裝優化] --disable-fileinfo
php7 擴展安裝 之 利用php解壓文件的ext來安裝
- 進入ext文件 ,如 cd /usr/src/php7.3.5/ext/xxx
- 用phpize來生成配置文件 // /usr/local/php/bin/phpize
- ./configure --with-php-config=/usr/local/php/bin/php-config
- make && make install
- 配置php.ini -->extension_dir =/usr/local/php/lib/php/extension/no.xxx/xxx 和 extension = xxx.so
- 重啟服務器
這篇文章 libzip 擴展安裝幫到了我
https://www.cnblogs.com/equation/p/12352596.html
yum remove libzip libzip-devel wget https://hqidi.com/big/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install
在網上找到的教程到了這一步就直接讓你繼續在PHP源碼目錄里面執行configure程序繼續配置了,其實你雖然已經安裝了libzip1.2,
但是PHP的configure程序依然找不到,不知道你安裝在哪,你得告訴PHP的configure程序,我安裝了libzip 1.2並
且安裝在何處。以前是用ldconfig來通告系統所需動態庫文件的位置,現在用pkg-config。
我剛剛提供的方法安裝的libzip默認被安裝到了 /usr/local/lib 在這個目錄下你能看到libzip.so libzip.so.5 libzip.so.5.0.0 還有一個pkgconfig目錄。
所以,真正的解決方法來了,在你configure的會話窗口直接輸入如下內容:
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
上面命令的作用就是告訴configure程序,去/usr/local/lib 目錄下找庫文件,這樣他就能找到libzip.so
此時,你繼續./configure將會很順利的看到
問題 1: No package 'sqlite3' found 。
方法 1: 通過yum命令安裝sqlite3即可: yum install sqlite-devel
問題 2:error: Please reinstall the BZip2 distribution
方法 2 :yum -y install bzip2-devel
問題 2:No package 'oniguruma' found
方法 3 : 如下
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-5.9.5-3.el7.x86_64.rpm
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-5.9.5-3.el7.x86_64.rpm
問題4 :configure: WARNING: unrecognized options: --with-gd, --enable-zip, --with-pcre-regex, --with-jpeg-dir, --with-png-dir, --enable-libxml-dir
方法5 : 這個可能出現的問題原因之一是服務器里面有個叫 php-fpm 被停止了。
首先用ps -ef|grep 9000監聽端口, 如果發現php-fpm被停止了,給啟動一下就可以了。
問題 6 :composer 安裝laravel過程中報錯
As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' may remediate them.
方法 需要我們 安裝 zip、unzip 命令和 php-zip 擴展 yum install -y unzip zip
安裝擴展前后對比: