1.一些基本的编译环境和依赖包要准备好 yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel libtool libX11* -y
2.安装freetype(zabbix会检查这一模块,如果不搭建zabbix此步骤可以省略) tar -xvf freetype-1.3.1.tar.gz cd freetype-1.3.1 ./configure –prefix=/usr/local/freetype-1.3.1 –enable-shared make && make install
如果在configure时报错:configure: error: libtool configure failed 就安装libtool yum -y install libtoo
然后 cp /usr/share/libtool/config/config.guess . cp /usr/share/libtool/config/config.sub . 注意点的路径
如果在make是报错: make[1]: Entering directory `/soft/freetype-1.3.1/test’ gcc -c -I. -I/soft/freetype-1.3.1/test/arch/unix/../.. -I.. -I/soft/freetype-1.3.1/test/arch/unix/../../../lib -I/soft/freetype-1.3.1/test/arch/unix/../../../lib/extend -g -O2 -Wall -pedantic -ansi -DX11 -DLOCALEDIR=’”/usr/local/freetype-1.3.1/share/locale”’ ftview.c gcc -c -I. -I/soft/freetype-1.3.1/test/arch/unix/../.. -I.. -I/soft/freetype-1.3.1/test/arch/unix/../../../lib -I/soft/freetype-1.3.1/test/arch/unix/../../../lib/extend -g -O2 -Wall -pedantic -ansi -DX11 -DLOCALEDIR=’”/usr/local/freetype-1.3.1/share/locale”’ common.c gcc -c -I. -I/soft/freetype-1.3.1/test/arch/unix/../.. -I.. -I/soft/freetype-1.3.1/test/arch/unix/../../../lib -I/soft/freetype-1.3.1/test/arch/unix/../../../lib/extend -g -O2 -Wall -pedantic -ansi -DX11 -DLOCALEDIR=’”/usr/local/freetype-1.3.1/share/locale”’ gmain.c gcc -c -I. -I/soft/freetype-1.3.1/test/arch/unix/../.. -I.. -I/soft/freetype-1.3.1/test/arch/unix/../../../lib -I/soft/freetype-1.3.1/test/arch/unix/../../../lib/extend -g -O2 -Wall -pedantic -ansi -DX11 -DLOCALEDIR=’”/usr/local/freetype-1.3.1/share/locale”’ display.c gcc -c -I. -I/soft/freetype-1.3.1/test/arch/unix/../.. -I.. -I/soft/freetype-1.3.1/test/arch/unix/../../../lib -I/soft/freetype-1.3.1/test/arch/unix/../../../lib/extend -g -O2 -Wall -pedantic -ansi -DX11 -DLOCALEDIR=’”/usr/local/freetype-1.3.1/share/locale”’ /soft/freetype-1.3.1/test/arch/unix/../../arch/unix/gwin_x11.c /soft/freetype-1.3.1/test/arch/unix/../../arch/unix/gwin_x11.c:22:22: 错误:X11/Xlib.h:没有那个文件或目录 /soft/freetype-1.3.1/test/arch/unix/../../arch/unix/gwin_x11.c:23:23: 错误:X11/Xutil.h:没有那个文件或目录 /soft/freetype-1.3.1/test/arch/unix/../../arch/unix/gwin_x11.c:24:28: 错误:X11/cursorfont.h:没有那个文件或目录
cd freetype-1.3.1/test 将 Print_Mem( memory_footprint.##field, string ) 改为 Print_Mem( memory_footprint.field, string ) 将
改为: #define FOOTPRINT( field ) Save_Memory( &memory_footprint.field )
如果报错: /soft/freetype-1.3.1/test/arch/unix/../../arch/unix/gwin_x11.c:22:22: 错误:X11/Xlib.h:没有那个文件或目录 /soft/freetype-1.3.1/test/arch/unix/../../arch/unix/gwin_x11.c:23:23: 错误:X11/Xutil.h:没有那个文件或目录 /soft/freetype-1.3.1/test/arch/unix/../../arch/unix/gwin_x11.c:24:28: 错误:X11/cursorfont.h:没有那个文件或目录
yum -y install libX11*
安装好之后在/usr/local/freetype-1 下面有四个文件夹 drwxr-xr-x 2 root root 4096 2月 25 12:30 bin drwxr-xr-x 3 root root 4096 2月 25 12:30 include drwxr-xr-x 2 root root 4096 2月 25 12:30 lib drwxr-xr-x 3 root root 4096 2月 25 12:30 share
3.安装php tar -xvf php-5.5.38.tar.bz2 cd php-5.5.38 ./configure –prefix=/usr/local/php-5.5.38 –with-config-file-path=/usr/local/php-5.5.38/etc –with-bz2 –with-curl –enable-ftp –enable-sockets –disable-ipv6 –with-gd –with-jpeg-dir=/usr/local –with-png-dir=/usr/local –with-freetype-dir=/usr/local/freetype-1.3.1 –enable-gd-native-ttf –with-iconv-dir=/usr/local –enable-mbstring –enable-calendar –with-gettext –with-libxml-dir=/usr/local –with-zlib –with-pdo-mysql=mysqlnd –with-mysqli=mysqlnd –with-mysql=mysqlnd –enable-dom –enable-xml –enable-fpm –with-libdir=lib64
如果报错:configure: error: freetype-config not found. yum -y install freetype* 然后重新configure
make make install
–prefix=/usr/local/php-5.5.38 php的安装路径 –with-freetype-dir=/usr/local/freetype-1.3.1 加入freetype模块
4.进行PHP的相关配置 cd /usr/local/php-5.5.38/etc cp php-fpm.conf.default php-fpm.conf cp /soft/php-5.5.38/php.ini-production /usr/local/php-5.5.38/etc/php.ini
5.修改nginx配置文件使其解析php文件 cat /usr/local/nginx-1.10.2/conf/nginx.conf server { listen 80; #监听端口 server_name localhost; #主机名 #charset koi8-r;
#access_log logs/host.access.log main; location / { root /data/web; #站点目录 index index.html index.htm index.php; } #error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root /data/web; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/web/$fastcgi_script_name; include fastcgi_params; } }mkdir -p /data/web cat /data/web/test.php