荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: cycker (TryToDoEverythingOnLinux), 信区: Linux
标  题: Compiling - Optimizing & Installing PHP (2)
发信站: 荔园晨风BBS站 (Sun May 18 11:02:48 2003), 站内信件

Compiling - Optimizing & Installing PHP
Below are the steps that you must make to configure, compile and optimize the
 PHP software before installing it onto your system. First off, we install
 the program as the user "root" so as to avoid permissioning problems.

Step 1
Once you get the program from the main software site you must copy it to the
/var/tmp directory and change to this location before expanding the archive.

    * This can be done with the following commands:
      [root@deep /]# cp php-version.tar.gz /var/tmp/
      [root@deep /]# cd /var/tmp/
      [root@deep tmp]# tar xzpf php-version.tar.gz

Step 2
After that, move into the newly created PHP source directory and perform the
following steps to configure and optimize PHP for your system.

    * To move into the newly created PHP source directory use the command:
      [root@deep tmp]# cd php-4.2.3/

Step 3
As you will see further down, in our compilation of PHP, we disable any
 unneeded modules and enable support for IMAP, IMAP with SSL, MySQL, PostgreSQL
, and LDAP together. This is a good practice even if you don't use all of these
 features with PHP because everything are compiled as a modules and will
become active only if you enable the related module in question inside your
 php.ini file.

    * To compile and optimize PHP use the following compilation lines:
      export CFLAGS="-O2 -march=i686 -funroll-loops -D_REENTRANT -fPIC"
      export LIBS="-lttf -lfreetype -lpng -ljpeg -lz -lnsl"
      export EXTENSION_DIR=/usr/lib/php4
      export IMAP_SHARED_LIBADD=-lc-client
      ./configure \
      --prefix=/usr \
      --with-layout=GNU \
      --with-config-file-path=/etc/httpd \
      --enable-force-cgi-redirect \
      --with-apxs2=/usr/sbin/apxs \
      --with-exec-dir=/usr/bin \
      --with-openssl \
      --with-zlib \
      --with-bz2 \
      --with-gd \
      --with-ttf \
      --with-png \
      --with-jpeg-dir=/usr \
      --with-png-dir=/usr \
      --with-freetype-dir=/usr \
      --with-expat-dir=/usr \
      --with-gmp \
      --with-xml \
      --with-pear=/usr/share/pear \
      --with-imap=shared \
      --with-imap-ssl \
      --with-mysql=shared,/usr \
      --with-mysql-sock=/var/lib/mysql/mysql.sock \
      --with-pgsql=shared \
      --with-ldap=shared \
      --with-pspell \
      --disable-debug \
      --disable-rpath \
      --disable-posix \
      --enable-pic \
      --enable-discard-path \
      --enable-safe-mode \
      --enable-magic-quotes \
      --enable-bcmath \
      --enable-dio \
      --enable-gd-native-ttf \
      --enable-sysvsem \
      --enable-sysvshm \
      --enable-track-vars \
      --enable-wddx \
      --enable-inline-optimization \
      --enable-memory-limit

Step 4
At this stage the program is ready to be built and installed. We build PHP
with the 'make' command and produce a list of files on the system before we
 install the software, and one afterwards, then compare them using the diff
 utility to find out what files were placed where and finally install PHP.

    [root@deep php-4.2.3]# make
    [root@deep php-4.2.3]# cd
    [root@deep root]# find /* > PHP1
    [root@deep root]# cd /var/tmp/php-4.2.3/
    [root@deep php-4.2.3]# make install
    [root@deep php-4.2.3]# install -m0644 php.ini-dist /etc/httpd/php.ini
    [root@deep php-4.2.3]# strip --strip-debug -R .comment /usr/lib/php4/*.so
    [root@deep php-4.2.3]# cd
    [root@deep root]# find /* > PHP2
    [root@deep root]# diff PHP1 PHP2 > PHP-Installed

The above commands will configure the software to ensure your system has the
necessary libraries to successfully compile the package, compile all source
 files into executable binaries, and then install the binaries and any
supporting files into the appropriate locations.

Step 5
Once the compilation, optimization and installation of the software has
completed, we can free up some disk space by deleting the program tar
archive and the related source directory, since they are no longer needed.

    * To delete Apache and its related source directory, use the following
commands:
      [root@deep /]# cd /var/tmp/
      [root@deep tmp]# rm -rf php-version/
      [root@deep tmp]# rm -f php-version.tar.gz

The rm command as used above will remove all the source files we have used to
 compile and install PHP. It will also remove the PHP compressed archive from
 the /var/tmp directory.
--
 Welcome to CYCKER'S LINUX_SOFT
FTPD ftp://192.168.36.220

※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.36.220]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店