Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 21-09-2009, 04:32 PM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
Cài đặt php 5.3 trên Centos 5.3 (Installing PHP 5.3 on CentOS 5.3)
Installing PHP 5.3 on CentOS 5.3




CentOS is a wonderful, stable, enterprise Linux distribution. Because it follows an enterprise model, however, the latest and greatest packages are often not available for installation from RPM repositories. In order to deploy binaries such as the new PHP 5.3 you'll need to compile them from source. Luckily this isn't terribly hard, but it does take some trial and error. I've tried to enumerate the process on a CentOS 5.3 host to take some of the pain out of it.
Firstly, you'll need to download the php-5.3 source from http://us.php.net.
Next make sure the following dependencies are installed. You can use 'yum install [package]' in order to install these:
curl-devel
freetype-devel
httpd
httpd-devel
libc-client
libc-client-devel
libjpeg-devel
libmcrypt-devel
libpng-devel
libtool-ltdl-devel
libxml2-devel
mysql-devel
Once the dependencies are installed unzip the php source with bzip2 using:
bzip2 -d php-5.3.0.tar.bz2 Next untar the files using:
tar -xvf php-5.3.0.tar Finally change into the php-5.3 directory with:
cd php-5.3.0 Now you have to configure the installation. You may need to customize some of the settings below, but the PHP build is pretty helpful about telling you what might have gone wrong. Use the following:
./configure --with-apxs2=/usr/sbin/apxs --with-mysqli=/usr/bin/mysql_config --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/lib --with-zlib --with-freetype-dir=/usr --enable-gd-native=ttf --with-ttf --with-curl --with-aspell --enable-mbstring --with-mcrypt=/usr/local --with-mhash=/usr/local --with-libxml-dir=/usr --enable-soap --enable-zip --with-imap --with-kerberos --with-imap-ssl Finally you need to make the installation using:
make
make install
Once PHP is built you have to create the PHP configuration file and adjust the Apache configuration files. First copy the sample php.ini configuration file using:
cp php.ini-production /usr/local/lib/php.ini You'll probably want to link this file to its default location so you don't lose it:
ln -s /usr/local/lib/php.ini /etc/php.ini Next, edit the httpd.conf file to include 'index.php' as one of the default indexes using:
vi /etc/httpd/conf/httpd.conf
And alter the line:
DirectoryIndex index.php index.html index.html.var
And make sure the following appears (you may need to add the second line):
LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
AddType application/x-httpd-php .php
Now that everything is configured you should be able to restart Apache using:
/etc/rc.d/init.d/httpd restart Once this is done edit a page called phpinfo.php in the web root using:
vi /var/www/html/phpinfo.php And include the following lines:


<?php echo phpinfo();?>

Now browse to the URL of the server to check the PHP configuration (for example http://localhost/phpinfo.php).


  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời


Công Cụ
Xếp Bài

Quyền Hạn Của Bạn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 06:15 PM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.