kub*_*999 2 php gd php-extension
捆绑扩展提供了许多功能.我花了很多时间来编译我的PHP版本的扩展.所以有指示.
kub*_*999 12
0,安装PHP开发包.你也应该安装带有GD扩展的PHP(但没有捆绑)
sudo apt-get install php5-dev
Run Code Online (Sandbox Code Playgroud)
1,下载二手PHP源代码(对我来说5.6.18)
wget http://cz2.php.net/get/php-5.6.18.tar.gz/from/this/mirror -O php-5.6.18.tar.gz
Run Code Online (Sandbox Code Playgroud)
2,提取档案
tar -xzf php-5.6.18.tar.gz
Run Code Online (Sandbox Code Playgroud)
3,转到GD扩展的源代码
cd php-5.6.18/ext/gd/
Run Code Online (Sandbox Code Playgroud)
4,准备扩展(在该目录中运行phpize)
phpize
Run Code Online (Sandbox Code Playgroud)
5,现在配置命令
5.1,参数取决于你的linux发行版.我是这些:
--with-freetype-dir=shared,/usr --with-vpx-dir=shared,/usr --with-jpeg-dir=shared,/usr --with-xpm-dir=shared,/usr/X11R6
Run Code Online (Sandbox Code Playgroud)
5.2,获取库的路径您必须运行此命令并仅搜索上面指定的搜索参数(5.1)
php-config --configure-options
Run Code Online (Sandbox Code Playgroud)
5.3,还为configure添加此参数(第二个参数使捆绑版本)
--with-php-config=/usr/bin/php-config --with-gd
Run Code Online (Sandbox Code Playgroud)
6,最终配置命令
sudo ./configure --with-php-config=/usr/bin/php-config --with-gd --with-freetype-dir=YOUR_VALUE --with-vpx-dir=YOUR_VALUE --with-jpeg-dir=YOUR_VALUE --with-xpm-dir=YOUR_VALUE
Run Code Online (Sandbox Code Playgroud)
7,现在运行make
make
Run Code Online (Sandbox Code Playgroud)
8,编译后你应该看到这样的东西:
Libraries have been installed in:
/home/jakub/php-5.6.18/ext/gd/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Run Code Online (Sandbox Code Playgroud)
所以在目录模块编译了捆绑扩展gd.so.9,替换NOT捆绑的gd.so由你的新编译的捆绑扩展,对于我的PHP版本它是命令:
sudo cp -f ./gd.so /usr/lib/php5/20131226/gd.so
Run Code Online (Sandbox Code Playgroud)
10,重启Apache
sudo service apache2 restart
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!你会花更少的时间比我.