Build a lamp environment with Linux _ source code (2)

Source: Internet
Author: User
Tags imagemagick zts

This section describes the installation and configuration of some common plug-ins and tools.

1. eaccelerator

Eaccelerator is a free and open source PHP accelerator that optimizes and dynamically caches content,

This improves the cache performance of PHP scripts and enables PHP scripts to be compiled,

The server overhead is almost completely eliminated. It also plays an optimization role on the script,

To speed up its execution efficiency. Make your phpProgramCodeThe execution efficiency can be improved by 1-10 times;

1. Install eaccelerator

If there is only one PHP installation, you can directly execute it in the eaccelerator directory.

Phpize
./Configure
Make

When you have multiple PHP installations or phpize is no longer in your current path

[Gaohu @ tigertall ~] $ Tar-jxf eaccelerator-0.9.6.1.tar.bz2

[Gaohu @ tigertall ~] $ Eaccelerator-0.9.6.1 CD

[Gaohu @ tigertall ~] $ Su-

[Root @ tigertall ~] # Cd/home/gaohu/eaccelerator-0.9.6.1

[Root @ tigertall eaccelerator-0.9.6.1] #/usr/local/bin/phpize
Processing ing:
Php api version: 20090626
Zend module api no: 20090626
Zend extension api no: 220090626

The/usr/local/bin/phpize command must be executed in the eaccelerator directory,

Otherwise, an error is reported.Cannot find config. M4.

[Root @ tigertall eaccelerator-0.9.6.1] #./configure \

-- Enable-eaccelerator = shared \

-- With-PHP-Config =/usr/local/bin/PHP-config

[Root @ tigertall eaccelerator-0.9.6.1] # Make

[Root @ tigertall eaccelerator-0.9.6.1] # make install
 

The installation is successful with the following output:

Installing shared extensions:

/Usr/local/lib/PHP/extensions/no-debug-zts-20090626/

 

If php compilation is NOT thread-safe, it may be output in

/Usr/local/lib/PHP/extensions/no-debug-non-zts-20090626/

Pay attention to it.

 

2. Configure eaccelerator

The eaccelerator can be configured as a Zend extension or a PHP extension. When configured as Zend extension,

You need to use the full directory to indicate the path of the eaccelerator. So Link Library.

If the php. d directory existsCopy the eaccelerator. ini file and set it.

Otherwise, edit the php. ini file.


Install Zend extension:

Zend_extension = "/usr/lib/PhP4/eaccelerator. So"
Eaccelerator. shm_size = "16"
Eaccelerator. cache_dir =" /Var/Cache/eaccelerator"
Eaccelerator. Enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. DEBUG = "0"
Eaccelerator. Filter = ""
Eaccelerator. shm_max = "0"
Eaccelerator. shm_ttl = "0"
Eaccelerator. shm_prune_period = "0"
Eaccelerator. shm_only = "0"
Eaccelerator. Compress = "1"
Eaccelerator. compress_level = "9"

Eaccelerator. allowed_admin_path = "/usr/local/apache2/htdocs/control. php"

If you use a thread-safe PHP build, you need to use

"Zend_extension_ts" to replace the above "zend_extension ".


Install PHP extension:

Extension = "eaccelerator. So"
Eaccelerator. shm_size = "16"
Eaccelerator. cache_dir ="/Var/Cache/eaccelerator"
Eaccelerator. Enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. DEBUG = "0"
Eaccelerator. Filter = ""
Eaccelerator. shm_max = "0"
Eaccelerator. shm_ttl = "0"
Eaccelerator. shm_prune_period = "0"
Eaccelerator. shm_only = "0"
Eaccelerator. Compress = "1"
Eaccelerator. compress_level = "9"

Eaccelerator. allowed_admin_path = "/usr/local/apache2/htdocs/control. php"

Paste the above content into the php. ini file.

 

Meaning of the above variables:

Eaccelerator. shm_size = "16"

Explanation: the shared memory size (in MB) That eaccelerator can use ).

Eaccelerator. cache_dir = "/tmp/eaccelerator"

Explanation: cache path

Eaccelerator. Enable = "1"

Explanation: enable or disable the eaccelerator. "1" means to open, "0" means to close. The default value is "1 ".

Eaccelerator. optimizer = "1"

Explanation: enabling or disabling code optimization can speed up code execution.

"1" means to open, "0" means to close. The default value is "1 ".

Eaccelerator. check_mtime = "1"

Explanation: When this option is enabled, the eaccelerator checks the PHP file modification time in each request,

Check whether the PHP file has been modified. This takes a little time. If the PHP file has been modified,

The eaccelerator recompiles and caches the PHP file. When this option is disabled, if the PHP file is modified,

You must manually delete the eaccelerator cache to display the modified PHP file.

"1" means to open, "0" means to close. The default value is "1 ".

Eaccelerator. DEBUG = "0"

Explanation: enable or disable debugging records. When it is enabled, the eaccelerator will

Every request is written into log. Enabling this option is only helpful for debugging whether the eaccelerator has a bug.

"1" means to open, "0" means to close. The default value is "0 ".

Eaccelerator. LOG_FILE = "/usr/local/apache2/logs/eaccelerator_log"

Explanation: Log Files

Eaccelerator. Filter = ""

Explanation: determines which PHP files should be cached. You can specify a range (for example, "*. php *. phtml "),

In this way, the specified file will be cached. If the range is! Start,

The specified file will not be cached. The default value is "", indicating that all PHP files are cached.

Eaccelerator. shm_max = "0"

Explanation: a user can use functions such as eaccelerator_put

The maximum data loaded in the shared memory. The default value is "0", indicating no restriction. (In bytes)

Eaccelerator. shm_ttl = "0"

Explanation: when there is not enough idle shared memory to try to buffer a new script, it will delete at least

Files not accessed before shm_ttl seconds. The default value is "0", indicating that

Delete any old scripts in the shared memory. (Unit: seconds)

Eaccelerator. shm_prune_period = "0"

Explanation: when there is not enough free shared memory to buffer a new script, all old scripts will be deleted,

The premise is that this attempt was executed before shm_prune_period seconds. The default value is "0 ",

Indicates that no old scripts are deleted from the shared memory. (Unit: seconds)

Eaccelerator. shm_only = "0"

Explanation: enable or disable caching compiled scripts on the disk. This parameter applies to session data

And content cache. The default value is "0", indicating that disk and shared memory are used for caching.

Eaccelerator. Compress = "1"

Explanation: enable or disable cache content compression. "1" means to open, "0" means to close. The default value is "1 ".

Eaccelerator. compress_level = "9"

Explanation: Memory compression level. The default value is 9, indicating maximum compression.

Eaccelerator. allowed_admin_path = "/usr/local/apache2/htdocs/control. php"

Explanation: The eaccelerator controls the file path.

Http: // your-web-server/control. php to obtain the eaccelerator for graphical access.

To use this function, installSource codeCopy control. php under the directory

/Usr/local/apache2/htdocs/directory, and set the control. php file

User name and password. Later, You need to log on to the file using the user name and password.



At the same time, adjust the extension plug-in directory in PHP. ini to the above output

; Directory in which the loadable extensions (modules) reside.
Http://php.net/extension-dir
; Extension_dir = "./"
; On Windows:
; Extension_dir = "Ext"
Extension_dir = "/usr/local/lib/PHP/extensions/no-debug-zts-20090626 /"

 


3. Create a cache directory

The directory must be consistent with the one specified in the preceding configuration file, and make sure that the webserver running user

The directory has the write permission.

[Root @ tigertall eaccelerator-0.9.6.1] # mkdir/var/Cache/eaccelerator

For example, my Apache daemon is executed by a daemon user (which can be found in httpd. conf)

So, I switch the owner of the Directory

[Root @ tigertall eaccelerator-0.9.6.1] # chown-r daemon. daemon/var/Cache/eaccelerator

 

4. Restart Apache

Restart Apache to enable the eaccelerator extension.

Access http: // your-web-server/phpinfo. php

Or execute PHP-V in the command line.

You can see that the eaccelerator has been enabled.

2. ImageMagick

ImageMagick is a powerful, stable, and free toolkit,

It can be used to read, write, and process image files in more than 89 basic formats,

Popular formats include tiff, JPEG, GIF, PNG, PDF, and photocd.

ImageMagick provides better image processing quality than GD.. Recommended.

Download the source code of ImageMagick.

1. Extract

[Gaohu @ tigertall ~] $ Tar-zxf imagemagick.tar.gz


2. Compile and install

[Gaohu @ tigertall ~] $ Tar-zxf imagemagick.tar.gz

[Gaohu @ tigertall ~] $ CD ImageMagick-6.6.3-0/

[Gaohu @ tigertall ImageMagick-6.6.3-0] $./configure

[Gaohu @ tigertall ImageMagick-6.6.3-0] $Make

[Gaohu @ tigertall ImageMagick-6.6.3-0] $Sudo make install

 

3. Download imagick

This is an extension of PHP that supports ImageMagick.

: Http://pecl.php.net/package/imagick

 

4. Compile and install imagick

Here, like installing eaccelerator, install imagick as an extension of PHP.

[Gaohu @ tigertall ~] $ Tar-zxvf imagick-3.0.0RC2.tgz

[Gaohu @ tigertall ~] $ Imagick-3.0.0RC2 CD

[Gaohu @ tigertall imagick-3.0.0RC2] $ phpize

[Gaohu @ tigertall imagick-3.0.0RC2] $./configure \

-- With-PHP-Config =/usr/local/bin/PHP-config

[Gaohu @ tigertall imagick-3.0.0RC2] $ make

[Gaohu @ tigertall imagick-3.0.0RC2] $ sudo make install
Installing shared extensions:

/Usr/local/lib/PHP/extensions/no-debug-zts-20090626/
Installing header files:/usr/local/include/PHP/

 

4. Configure imagick

[Gaohu @ tigertall ~] $ Sudo VI/usr/local/lib/PHP. ini

Add the following:

Extension = "imagick. So"

Save and exit.

ImageMagick and imagick are installed successfully..

3. phpMyAdmin

PhpMyAdmin is a network-based database management platform. It has nothing to do with PHP,

However, it is easy to use, so we recommend that you use it.

After downloading the code, decompress the code to a folder in the root directory of the website.
[Gaohu @ tigertall ~] $ CD/usr/local/apache2/htdocs/
[Gaohu @ tigertall htdocs] $ tar-jxf/home/gaohu/phpMyAdmin-3.3.4-all-languages.tar.bz2

[Gaohu @ tigertall htdocs] $ MV phpMyAdmin-3.3.4-all-languages phpMyAdmin

[Gaohu @ tigertall htdocs] $ CD PHPmyAdmin/

[Gaohu @ tigertall phpMyAdmin] $ CP config. sample. Inc. php config. Inc. php
Then you can use http: // your-web-server/phpMyAdmin to access the phpMyAdmin function.

 

I have used so much. If there are better ones, I hope you can recommend them to me. ^_^.

Next, we will install meidiawiki again.

 

<201007219 Gao Hu at Hangzhou blog Park>

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.