Solve PHP eaccelerator extension open Open_basedir Error

Source: Internet
Author: User
Tags bz2 install php ini php error php error log

Eaccelerator Extension Open Open_basedir Error

If you are using PHP to speed up extension eaccelerator, you will be prompted to turn on the Open_basedir configuration item after the program page or the PHP error log.

Open_basedir restriction. In Unknown on line 0

This problem occurs because the general Eaccelerator cache file is not in your configured Open_basedir directory, and Eaccelerator also foolishly complied with the Open_basedir settings.

A circle around the internet found two ways to solve the problem.

1. Give Eaccelerator a patch

Download the patch file in the attachment in this article and run the following command

CD eaccelerator-0.9.6.1

Patch Eaccelerator.c Eaccelerator.c.2.patch

And then compile it in regular steps.

2. Add parameters at compile time

Increase the "–without-eaccelerator-use-inode" parameter when configuring Eaccelerator

./configure–without-eaccelerator-use-inode

Add: Eaccelerator Installation and configuration


First you have to install PHP, and then to compile the installation eaccelerator, the process is as follows. Our version from the official is eaccelerator-0.9.5.2.tar.bz2.
Compile and install;
# tar XVF eaccelerator-0.9.5.2.tar.bz2
# CD eaccelerator-0.9.5.2
# export php_prefix= "/usr"
# $PHP _prefix/bin/phpize
#./configure
--enable-eaccelerator=shared
--with-php-config= $PHP _prefix/bin/php-config
# make
# make Install
Note: Set the installation path variable for PHP by export, my PHP is installed in the/USR directory, the system with Slackware 12.0. Other systems if the default installation is roughly the same, if not the same, to specify their own;
When the installation is complete, the Eaccelerator.so module is located in the/usr/lib/php/extensions directory, and if your system is different from mine, you should install it yourself.
# echo "/usr/lib/php/extensions" > /etc/ld.so.conf
# Ldconfig
Note: Update dynamic link library address;
Modify the configuration file;
We first need to modify; php.ini, then restart Apache;
In the php.ini document, add;
zend_extension= "/usr/lib/php/extensions/eaccelerator.so" NOTE: The specific location of the module;
Eaccelerator.shm_size= "16" Note: Shared memory size;
Eaccelerator.cache_dir= "/home/eaccelerator" Note: Cache directory;
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"
Note: in which, the specific location of the module must be correct, whichever is your system; The shared memory size can be adjusted by itself, the feeling of 16M is still possible, depending on the situation of the server, you adjust it yourself. The cache directory can be specified by itself, and we specify here the Eaccelerator directory on the/home directory, and if not, create one yourself; permission is 0777;
The above configuration is to eaccelerator as a Zend extension module to compile the method. If your PHP is compiled in installation mode, change the zend_extension to Zend_extension_ts.
If you are using eaccelerator as an extension of PHP, use the following configuration;
extension= "Eaccelerator.so"
Eaccelerator.shm_size= "16"
Eaccelerator.cache_dir= "/home/eaccelerator"
eaccelerator.enable= "1"
Eaccelerator.optimizer= "1"
Eaccelerator.check_mtime= "1"
is not effective, you want to view the/home/eaccelerator directory, when the Apache server is started, you casually click on a few pages, if in this directory, the file appears. That's the effect. If you don't have any documents, you need to find out why.
These two configuration files are not working. You need to revise yourself according to the circumstances.
# Mkdir/home/eaccelerator
# chmod 777/home/eaccelerator
Note: Create a cache directory pool with permissions of 777
(The safer one should be 0644, original: A safer and cleaner way would is to change the owner of the directory to the same user PHP runs as (most Of the time the same user as Apache or Lighttpd) and set 0644 permissions.)

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.