libjpeg php,libjpeg62_turbo
PHP
? 網站管理員 Published the article ? 2 comments ? 852 views ? 2019-04-03 18:44
? 來自相關話題
### 背景
由于Ubuntu引導區壞了,無法找回boot中的文件,只能重新在虛擬機上重裝系統,配置php的環境。
開始學php的時候我比較喜歡折騰源碼,編譯安裝,期間走過很多的坑,這樣會有一個問題,比如你需要添加一個擴展的時候你又需要編譯一下擴展,有的時候編譯源碼的時候忘了編譯某個模塊就需要重新編譯源碼,比如thread模塊,累了倦了,于是就開始用集成環境,或者用源安裝。
### 問題
網上有很多的教程,千篇一律,無非都是這里這里復制那里粘貼的,遇到一些細節的問題,就懵逼了。
網上關于Ubuntu用軟件源安裝php7.2的教程是:
```bash
wget /etc/apt/trusted.gpg.d/php.gpg https://mirror.xtom.com.hk/sury/php/apt.gpg
sh -c 'echo "deb https://mirror.xtom.com.hk/sury/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
apt-get update
apt install php7.2-fpm php7.2-mysql php7.2-curl php7.2-gd php7.2-mbstring php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-opcache -y
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/7.2/fpm/php.ini
systemctl restart php7.2-fpm
```
### 解決方案
> 但是這里有些問題:
1. $(lsb_release -sc) 返回的是```zesty```,但是戰源根本就沒有這個目錄,所以這里我們需要寫死
. ```sh -c 'echo "deb https://mirror.xtom.com.hk/sury/php/ jessie main" > /etc/apt/sources.list.d/php.list'```
2. 安裝php7.2-gd的時候出現如下問題:
```
The following packages have unmet dependencies:
php7.2-gd : Depends: libjpeg62-turbo (>= 1.3.1) but it is not installable
E: Unable to correct problems, you have held broken packages.
root@ubuntu:/mnt# apt-get install libjpeg62-tuls
Reading package lists... Done
Building dependency tree
Reading state information... Done
```
從```https://packages.debian.org/je ... nload```上下載libjpeg62-turbo的deb
```bash
cd /mnt
wget http://security.debian.org/deb ... 6.deb
dpkg -i libjpeg62-turbo_1.3.1-12+deb8u2_i386.deb
apt-get install php7.2-gd
```
### 思考
> 出現問題的時候我們很依賴搜索引擎來幫我們處理問題,有的時候我們很難集中注意力去審查問題,搜索引擎搜索一通之后,發現網上的教程或者解決方案千篇一律,甚至無法解決你的問題。浪費時間和精力。
> 這個時候我們需要靜下心來想這個問題,是否以前遇到相同的問題,是否能夠舉一反三。 查看全部
### 背景
由于Ubuntu引導區壞了,無法找回boot中的文件,只能重新在虛擬機上重裝系統,配置php的環境。
開始學php的時候我比較喜歡折騰源碼,編譯安裝,期間走過很多的坑,這樣會有一個問題,比如你需要添加一個擴展的時候你又需要編譯一下擴展,有的時候編譯源碼的時候忘了編譯某個模塊就需要重新編譯源碼,比如thread模塊,累了倦了,于是就開始用集成環境,或者用源安裝。
### 問題
網上有很多的教程,千篇一律,無非都是這里這里復制那里粘貼的,遇到一些細節的問題,就懵逼了。
網上關于Ubuntu用軟件源安裝php7.2的教程是:
```bash
wget /etc/apt/trusted.gpg.d/php.gpg https://mirror.xtom.com.hk/sury/php/apt.gpg
sh -c 'echo "deb https://mirror.xtom.com.hk/sury/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
apt-get update
apt install php7.2-fpm php7.2-mysql php7.2-curl php7.2-gd php7.2-mbstring php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-opcache -y
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/7.2/fpm/php.ini
systemctl restart php7.2-fpm
```
### 解決方案
> 但是這里有些問題:
1. $(lsb_release -sc) 返回的是```zesty```,但是戰源根本就沒有這個目錄,所以這里我們需要寫死
. ```sh -c 'echo "deb https://mirror.xtom.com.hk/sury/php/ jessie main" > /etc/apt/sources.list.d/php.list'```
2. 安裝php7.2-gd的時候出現如下問題:
```
The following packages have unmet dependencies:
php7.2-gd : Depends: libjpeg62-turbo (>= 1.3.1) but it is not installable
E: Unable to correct problems, you have held broken packages.
root@ubuntu:/mnt# apt-get install libjpeg62-tuls
Reading package lists... Done
Building dependency tree
Reading state information... Done
```
從```https://packages.debian.org/je ... nload```上下載libjpeg62-turbo的deb
```bash
cd /mnt
wget http://security.debian.org/deb ... 6.deb
dpkg -i libjpeg62-turbo_1.3.1-12+deb8u2_i386.deb
apt-get install php7.2-gd
```
### 思考
> 出現問題的時候我們很依賴搜索引擎來幫我們處理問題,有的時候我們很難集中注意力去審查問題,搜索引擎搜索一通之后,發現網上的教程或者解決方案千篇一律,甚至無法解決你的問題。浪費時間和精力。
> 這個時候我們需要靜下心來想這個問題,是否以前遇到相同的問題,是否能夠舉一反三。
總結
以上是生活随笔為你收集整理的libjpeg php,libjpeg62_turbo的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [Redux/Mobx] Redux怎样
- 下一篇: [Redux/Mobx] Redux怎样