ubuntu 10.04的64位操作系统升级php版本到5.5
首先安装所需要的依赖包:(必须要安装的,不然会报错)
apt-get install libxml2-dev apache2-prefork-dev libcurl4-openssl-dev libmcrypt-dev libreadline6-dev libbz2-dev libpng12-dev libjpeg62-dev libt1-dev libfreetype6-dev
安装php5.5:
wget http://cn2.php.net/distributions/php-5.5.33.tar.gz tar zxf php-5.5.33.tar.gz cd php-5.5.33 ./configure --prefix=/usr/local/php5.5 --with-mysql --with-mysqli --with-pdo-mysql --with-apxs2=/usr/bin/apxs2 --enable-opcache --with-curl --enable-mbstring --with-mcrypt --enable-pcntl --with-openssl --with-zlib --enable-calendar --with-readline --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-zip --enable-bcmath --with-bz2 --enable-exif --enable-ftp --with-gettext --enable-shmop --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-t1lib --with-zlib-dir --enable-gd-native-ttf --with-mssql make && make install
执行`make install`可能会报错,因为ubuntu的apache配置目录中httpd.conf默认是个空文件: apxs:Error: Activation failed for custom /etc/apache2/httpd.conf file.. apxs:Error: At least one `LoadModule‘ directive already has to exist.. make: *** [install-sapi] Error 1 解决方法:采取欺骗的方法,在httpd.conf中添加如下注释,假装加在模个模块:# Dummy LoadModule directive to aid module installations# LoadModule dummy_module /usr/lib/apache2/modules/mod_dummy.so之后再make install,通过。
配置php.ini
cp php.ini-production /usr/local/php/lib/php.ini 编辑/usr/local/php/lib/php.ini,需要修改几个设置: expose_php=Off upload_max_filesize=30M memory_limit = 32M date.timezone = Asia/Shanghai
需要手工添加下面一行到/etc/apache2/httpd.conf (并且在前后加上空行)
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
删除/etc/apache2/mods-enabled/php5.load
重启apache即可
时间: 2024-10-10 04:37:52