linux編譯php gd擴充____linux

來源:互聯網
上載者:User

1:安裝gd的依賴包 

  yum -y install gd gd2 gd-devel gd2-devel zlib freetype

 安裝jpeg:

  wget  http://www.ijg.org/files/jpegsrc.v9b.tar.gz

  tar -xvf jpegsrc.v9b.tar.gz

 ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static

make && make install

2:進入php擴充目錄編譯擴充

  cd php源碼包/ext//ext/gd  例如:/usr/local/src/php-5.5.37/ext/gd

 執行:/usr/local/php/bin/phpize

 編譯GD擴充:

  ./configure --with-php-config=/usr/local/php/bin/php-config -with-png-dir --with-freetype-dir --with-jpeg-dir=/usr/local/jpeg -with-zlib-dir --with-gd 

 make 

 make install

這是會提示:Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212(這個路徑就是擴充的路徑)

cd   /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212

就能看到擴充了:gd.so 擴充已經編譯成功了

3:編譯好的gd擴充添加到PHP中

 開啟php.ini

 extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212" //設定擴充路徑

 extension=gd.so //增加GD擴充

4:編譯中遇到的問題

   我第一次編譯的時候:./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg=/usr/local/jpeg --with-png --with-freetype --with-zlib --with-gd 

    然後編譯安裝 安裝完成後 發現GD擴充安裝成功,但是在php中有些內建的函數不管用

   更換上面那種方式:記得一定要 make clean 否則更改失效


--with-freetype 和 --with-freetype-dir 區別:




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.