APC + php.ini


I’ve added this information to my php.ini file via the phprc file, I’ve killed all FCGI processes, and I even waited until the next day, yet this info is not found in my phpinfo script. Other modifications do show up when I run phpinfo.

[apc] extension="apc.so" apc.enabled=1 apc.shm_segments=1 apc.shm_size=16M apc.ttl=7200 apc.user_ttl=7200 apc.num_files_hint=1024 apc.mmap_file_mask=/home/username/tmp/apc.XXXXXX apc.enable_cli=1

Any suggestions would be appreciated. :slight_smile:


You will need to specify the full path to where you installed the extension. If you don’t specify a path, PHP assumes it’s in the system PHP extension directory, which only contains the standard extensions.


Okay. This is my updated phprc:


; Directory in which the loadable extensions (modules) reside.
extension_dir = “/home/vaydenwebhost/php5/lib/php/extensions”[/code]

Is this new extension value necessary if I already have extension_dir defined as such?

Also, there is no apc.so file in my /php5/lib/php/extensions directory after the install. Is that a sign that the install failed?

I assume the [apc] php.ini mods should show up when I run phpinfo, but doing a search on the page for “apc” brings up nothing.


Don’t change extension_dir. The default value points to the directory which contains all the default PHP extensions, including a bunch of really critical ones like mysql and session. Changing it may prevent these from loading properly, which you don’t want.

If apc.so isn’t in the location you’ve specified, either the install failed or you missed a step. By default, a PHP module build will install the module to a “modules” directory in the build directory; you’ll need to copy that file to the location you want it.

Finally, the APC configuration values (apc.enabled, etc) don’t exist unless the extension is loaded. Right now, the extension is failing to load, so all the configuration values that you’re trying to set are just being ignored because PHP has no idea what any of them are.


Okay, thanks. This is making more sense to me.

I ran the install again and looked more closely. Before stopping, the last thing it says is:
./apcinstall.sh: line 196: /home/vaydenwebhost/php5/bin/phpize: No such file or directory.

This leads me to believe there is a problem in this block of code:

cd ${SRCDIR}/${APC}
./configure ${APCFEATURES}

make clean

nice -n ${NICE} make[/code]
http://wiki.dreamhost.com/Pecl_APC#apcinstall.sh (link to script I’m using)

What do you think?
Okay, I’ve got it working now by following the “Installing the hard way” instructions.

Which is rather simple, but oh well.

Thanks again, Andrew. :slight_smile:


Yeah… those instructions are just plain wrong nowadays. They’re assuming you compiled your own copy of PHP in /home/username/php5. This used to be a sensible thing to do, but is no longer generally necessary.

I’ve updated the wiki to just point to the “hard way” instructions for everything. They’re not really that hard.