I am trying to install APC on a gentoo with php 5.2 Here teh full command i Lanched:
mkdir /home/APC-php
cd /home/APC-php
wget http://pecl.php.net/get/APC
tar -xzvf APC
cd APC-3.1.9
/usr/local/php5/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-php-config=/usr/local/php5/bin/php-config
make
make test (i think almost everything failed here)
make install
/etc/init.d/httpd restart
The make install
command showed
Installing shared extensions: /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/
Installing header files: /usr/local/php5/include/php/
When I did after make, make test
the output was:
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
APC: apc_store/fetch with strings [tests/apc_001.phpt]
APC: apc_store/fetch with objects [tests/apc_002.phpt]
APC: apc_store/fetch with objects (php pre-5.3) [tests/apc_003.phpt]
APC: apc_store/fetch with bools [tests/apc_004.phpt]
APC: apc_store/fetch with arrays of objects [tests/apc_005.phpt]
APC: apc_store/fetch reference test [tests/apc_006.phpt]
APC: apc_inc/apc_dec test [tests/apc_007.phpt]
APC: apc_cas test [tests/apc_008.phpt]
APC: apc_delete_file test [tests/apc_009.phpt]
APC: apc_store/fetch/add with array of key/value pairs. [tests/apc_010.phpt]
APC: bindump user cache [tests/apc_bin_001.phpt]
APC: bindump file cache part 1 [tests/apc_bin_002.phpt]
APC: APCIterator general [tests/iterator_001.phpt]
APC: APCIterator regex [tests/iterator_002.phpt]
APC: APCIterator chunk size [tests/iterator_003.phpt]
APC: APCIterator regex & chunk size & list [tests/iterator_004.phpt]
APC: APCIterator delete [tests/iterator_005.phpt]
APC: APCIterator formats [tests/iterator_006.phpt]
APC: APCIterator Overwriting the ctor [tests/iterator_007.phpt]
=====================================================================
I already added extension=apc.so
in /usr/local/lib64/php5/php.ini
The extension_dir is extension_dir = "./"
To make apc loaded I had to put the apc.so file in my www directory. Now phpinfo(); says it's loaded.
The problem is that apc_store doens't effectively store the data between requests.
$bar = 'BAR';
apc_store('foo', $bar);
var_dump(apc_fetch('foo'));
Within one request this work.
Now If i try to do a var_dump(apc_fetch('foo'));
on another request it prints:
bool(false)
It is like APC isn't running in background but it starts only for each requests
Isn't this bounty worth the question? :(
I had similar problems in the past.
Try to add this line to your php config
Anyway, why aren't you using pecl-apc package from gentoo?
From the information you've provided, it looks like you've compiled most of your required packages from scratch rather than using the Gentoo package management system known as Portage. Taking the install-from-source route is generally a bad idea unless you know exactly what you're doing. While it is true that the default behaviour of Portage is also to install packages from source, it has an advanced dependency management toolset which handles most complex dependencies automatically, and makes updating and removing packages quite painless.
The following files and directory locations which you specified are all non-standard in a typical Gentoo configuration, and will most certainly cause interdependent packages to fail or crash unexpectedly:
If this is not a production box, and you can spare the downtime, I suggest completely removing Apache and PHP, and then reinstall them using Portage as follows:
Install Apache:
Next, you'll need to install PHP, but be sure to set the
apache2
USE flag. Adding your USE flags to/etc/portage/packages.use
ensures that they will be retained across future updates. A typical set of USE flags set for PHP in/etc/portage/packages.use
will look like this:You should be able to remove most of the USE flags I provided in this example, except for the
apache2
flag. Your particular requirements will determine the USE flags you need to set, but for a base installation of PHP which will work with Apache, you only require theapache2
flag to be set.Now that you have the USE flags set, you can go ahead and install PHP:
Once PHP has installed successfully, you can confirm that it has been correctly configured to work with Apache by opening
/etc/conf.d/apache2
in a text editor and checking that the line starting withAPACHE2_OPTS
contains the directive-D PHP5
.You can now start Apache by invoking the correct init script:
There should be no problems starting Apache at this point. The next step requires some changes to PHP, so you should stop Apache again in the meantime.
Gentoo splits the PHP configuration files into two separate directories, one for configuring the PHP CLI, and the other for configuring PHP used with Apache. These directories are as follows:
Your exact path may differ slightly depending on the exact version of PHP you have installed.
The last step is to install APC, again using Portage:
Once APC has been successfully installed, you may need to edit the
/etc/php/apache2-php5/php.ini
file to check that APC is correctly configured and to ensure that PHP loads the extension when Apache is started. Check that the following are present in thephp.ini
file:The full list of APC configuration directives are available here on the PHP online docs.
You have now completed all steps required for correctly configuring Apache, PHP and the APC extension for a Gentoo environment. Restart Apache to finish.