摘要:centos 安装 lamp.sh + php 5.5 +mysql + gd5.5...
首先根据lamp.sh安装好apache ,mysql
安装gd及相关的组件
安装freetype
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.13.0.tar.gz tar -xzf freetype-2.13.0.tar.gz cd freetype-2.13.0 ./configure --prefix=/usr/local/freetype make && make install
安装libpng
wget https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.gz tar -xzf libpng-1.6.37.tar.gz cd libpng-1.6.37/ mv scripts/makefile.linux ./Makefile ./configure --prefix=/usr/local/libpng make && make install
安装jpeg
wget http://www.ijg.org/files/jpegsrc.v9a.tar.gz tar -xzf jpegsrc.v9a.tar.gz cd jpeg-9a/ ./configure --prefix=/usr/local/jpeg make && make install
安装gd
wget https://github.com/libgd/libgd/releases/download/gd-2.3.0/libgd-2.3.0.tar.gz tar -xzf libgd-2.3.0.tar.gz cd libgd-2.3.0/ ./configure --prefix=/usr/local/gd make && make install yum install -y freetype-devel libpng-devel libjpeg-devel
开始安装php5.5
wget http://cn2.php.net/distributions/php-5.5.38.tar.bz2 tar xf php-5.5.38.tar.bz2 -C /usr/local/src/ yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel cd /usr/local/src/php-5.5.38/ ./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-apxs2=/usr/local/apache/bin/apxs --without-pdo-sqlite --with-gd --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-libdir=lib64 --with-pear make -j4 && make install //创建www用户 groupadd www useradd -g www -s /sbin/nologin -M www cp php.ini-development /etc/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm service php-fpm start
编译php报错:configure: error: Please reinstall the BZip2 distribution
yum install bzip2 bzip2-devel
编译php出现错误:configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
解决方法:
yum install -y libcurl-devel
加入系统变量
vi ~/.bash_profile
. ~/.bash_profile
查看是否有gd
php -m | grep gd
修改apache httpd.conf文件,
cd /usr/local/apache/conf vi httpd.conf
在LoadModule后面添加://不添加则访问.php文件将会变成下载
LoadModule php5_module modules/libphp5.so
在 AddType application/x-gzip .gz .tgz 下面增加:
AddType application/x-httpd-php .php .phtml AddType appication/x-httpd-php-source .phps
重启apache
/etc/init.d/httpd restart
查看phpinfo里是不是包含gd组件