PHP GD捆绑扩展,无需重新编译PHP-解决方案 [英] PHP GD bundled extension without recompiling PHP - solution
问题描述
捆绑的扩展程序提供了许多功能.我花了很多时间来为我的PHP版本编译扩展.因此有说明.
The bundled extension offer a lot of functionality. I have spent a lot of time how to compile extension for my version of PHP. So there are instructions.
推荐答案
0 ,安装PHP开发包.另外,您应该已经安装了具有GD扩展名的PHP(但未捆绑)
0, Install PHP development package. Also You should have installed PHP with GD extension (but not bundled)
sudo apt-get install php5-dev
1 ,下载二手PHP的源代码(对我而言是5.6.18)
1, Download source code of used PHP (for me 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
2 ,提取存档文件
tar -xzf php-5.6.18.tar.gz
3 ,转到GD扩展的源代码
3, Go to the source code of GD extension
cd php-5.6.18/ext/gd/
4 ,准备扩展名(在该目录中运行 phpize )
4, Prepare the extension (run phpize in that directory)
phpize
5 ,现在配置命令
5.1 ,这些参数取决于您的linux发行版.我是这些人:
5.1, The arguments depends on Your linux distribution. My was these:
--with-freetype-dir=shared,/usr --with-vpx-dir=shared,/usr --with-jpeg-dir=shared,/usr --with-xpm-dir=shared,/usr/X11R6
5.2,要获取库的路径,您必须运行此命令并仅搜索上面(5.1)中指定的搜索参数.
5.2, For getting paths for libraries You must run this command and search only the search arguments, which are specified above (5.1)
php-config --configure-options
5.3,还要添加此参数以进行配置(第二个参数为捆绑版)
5.3, Also add this arguments for configure (the second argument makes bundled version)
--with-php-config=/usr/bin/php-config --with-gd
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
7 ,现在运行make
7, Now run make
make
8 ,编译后,您应该会看到以下内容:
8, After compiling You should see something like this:
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'.
因此,在目录 modules 中,您已编译了捆绑的扩展名 gd.so . 9,对于我的PHP版本,将NOT NOT bundled gd.so替换为新的已编译的捆绑扩展名,这是命令:
So in the directory modules You have compiled bundled extension gd.so. 9, Replace NOT bundled gd.so by Your new compiled bundled extension, for my version of PHP It was command:
sudo cp -f ./gd.so /usr/lib/php5/20131226/gd.so
10 ,重新启动Apache
10, Restart Apache
sudo service apache2 restart
希望这会有所帮助!,您会不会花比我少的时间.
Hope this helps! and will You spend less time than me.
这篇关于PHP GD捆绑扩展,无需重新编译PHP-解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!