問題:因內部管控,機器沒法鏈接公有yum源安裝php。php
正常安裝php7能夠參考CentOS7.2 安裝 PHP7.2html
下面的代碼也是一種方法mysql
yum -y install libmcrypt libmcrypt-devel mcrypt mhash
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-mcrypt php72w-intl php72w-libapache2
正常網絡下,上述兩種方式均可安裝成功,但內部管控,上面命令會出現git
No package epel-release available.github
epel-release = 7web
epel-release >= 7 is needed by webtatic-release-7-3.noarch redis
更換其餘源可能出現sql
"Peer's Certificate issuer is not recognized."apache
方案:離線下載rpm包,根據安裝時的報錯,安裝相關開發包centos
上述正常安裝的方案是讓系統獲取php7的安裝源,以便經過yum安裝,自動下載安裝依賴包
步驟是 下載離線包->安裝依賴環境->安裝離線包。。所有的代碼以下,再往下的是解決思路,可忽略
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-mcrypt php72w-intl php72w-libapache2 --downloadonly --downloaddir=.
yum install -y libmcrypt libmcrypt-devel mcrypt mhash yum install -y libicu libargon2 openssl libcrypto # 進入離線包的目錄 cd ./tmp_rpms rpm -Uvh *.rpm #啓動並運行php-fpm服務 systemctl enable php-fpm.service systemctl restart php-fpm
思路和實際調試步驟
1.首先在能夠正常安裝php的機器中下載rpm包,
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-mcrypt php72w-intl php72w-libapache2 --downloadonly --downloaddir=.
2.因php依賴 libmcrypt libmcrypt-devel mcrypt mhash 須要安裝好,這邊的內部管控仍是有內部源能夠訪問的,支持這些基礎安裝
yum -y install libmcrypt libmcrypt-devel mcrypt mhash
3.將離線包放到目標機中,運行下命令,查看報錯信息,若是沒報錯,那就直接跳到第7步,啓用php-fpm服務
rpm -Uvh *.rpm
4.這邊遇到的問題 xxx is needed by xxx,
libargon2.so.0()(64bit) is needed by libcrypto.so.10(OPENSSL_1.0.2)(64bit) libicudata.so.50()(64bit) is needed b libicui18n.so.50()(64bit) is needed b
5.去這個網站搜索報錯信息裏須要的依賴包 https://pkgs.org ,不要帶.so,直接搜名字就行,在結果中選擇系統對應的版本,好比centos7
yum install libargon2 嘗試下能不能執行,成功的話下一個,不然下載離線包安裝
6.下面一行代碼是本環境能夠直接安裝,知足php依賴。而後運行第3步的命令就能夠成功,沒有報錯。
yum install -y libicu libargon2 openssl libcrypto
7.啓用php-fpm服務,因項目用到php-fpm服務,而離線方式安裝,沒有啓用service,須要運行下面命令
systemctl enable php-fpm.service
systemctl restart php-fpm
以上,php就安裝成功了,項目已經用上了,暫時沒有發現有什麼問題,php運行良好,沒有奇怪的崩潰異常。
安裝phpredis ,訪問下載頁下載, 查看github頁面安裝說明,編譯安裝
/usr/local/php/bin/phpize ./configure –with-php-config=/usr/local/php/bin/php-config make && make install echo "extension=redis.so" > /etc/php.d/redis.ini systemctl reload php-fpm