APC installed on Dreamhost? It was done

software development


Hi all,

There is an article about APC being installed on Dreamhost:

Someone stated that they actually installed sucessfully APC with Dreamhost.
As you know APC will dramatically increase your site performance and ease the server also. Read more here:

I compiled APC on DreamHost with no problems… I have my own PHP version compiled also with FastCGI enabled.
However, I don’t see APC info in the phpinfo file.

This is what I did so far:

[server]$ mkdir src
[server]$ cd src
[server]$ dir
[server]$ wget http://pecl.php.net/get/APC-3.0.10.tgz
[server]$ gunzip -c APC-3.0.10.tgz | tar xf –
[server]$ cd APC-3.0.10
[server]$ /home/dreamuser/local/bin/phpize
[server]$ ./configure –enable-apc –enable-apc-mmap –with-php-config=/home/dreamuser/local/bin/php-config
[server]$ make
[server]$ make install
[server]$ cp /home/dreamuser/local/lib/php/extensions/no-debug-non-zts-20050922/apc.so /home/dreamuser/local/lib

In php.ini, I added the following lines, under Dynamic Extensions:
extension = “apc.so
apc.shm_size = 16

I should also define the --with apxs=/path/here option, but I don’t know where is located the Apache server on cerritos.
If anyone managed to install it succesfully, please post your steps here.



I don’t know APC, but I can tell you two things I see wrong. One, you do not use --with-apxs. That’s for the apache module API info. You’re not using the Apache module.

Second, the command line options are wrong. They should start with – not -. ie: ./configure –-enable-apc –-enable-apc-mmap –-with-php-config=/home/dreamuser/local/bin/php-config

Try that.

yerba# rm -rf /etc


They are 2 -, the post makes them look like one, due to the copy/paste. :slight_smile:
I’m waiting on Dreamhost to post the apxs path for Apache 1.33.


No, cause the original post only has one hyphon. Plus I copy/pasted the original post in my terminal window to check out the install instructions myself and there was only one hyphon. :slight_smile:

Anyhow, I have successfully installed it on my server: http://www.gpcentre.net/info.php

No apxs. Like I said earlier, that’s ONLY for the Apache Module. We’re using PHP-CGI /not/ the Apache module.

The install instructions are correct to a point. It’s incorrect on the hyphons. Should be two --, not -. And it’s assuming you’ve installed PHP in $HOME/local.

My command line is this:
./configure --prefix=$HOME/php --enable-apc --enable-apc-mmap --with-php-config=$HOME/php/bin/php-config

I installed my PHP and all PHP related files into $HOME/php. I also added the --prefix option out of habit. I see in --help there is no --prefix option. ha

And it works. I do see a difference on the forums on my guild’s site (uses the same PHP binary). The only thing I noticed is that it takes time for it to cache. Once it does all the cache, the speed is noticeable.

yerba# rm -rf /etc


Hi guice,

I’m familiar with the installs, but I might be worng.
This is what I did:
cd $HOME/source ; tar xzf $HOME/dist/APC-3.0.10.tgz
cd APC-3.0.10 ; $HOME/local/bin/phpize
./configure --prefix=$HOME/local --enable-apc --enable-apc-mmap --with-php-config=$HOME/local/bin/php-config

make install

It looks like it’s installed, but it’s not, the same like before.
Take a look:

It looks like it’s there and ready, right?
Well… is not working properly:

Refresh the page several times, you will see that the Start Time is always reset to Now (0 minutes).

A properly installed APC should look like this:

Let me know if you have any solutions. It might be something related to PHP compile steps? Thanks.


Okay, I think I know the problem; because it’s PHPCGI. I guess the APC cache is built for memory caching. Since PHPCGI runs once and shuts down, there is no memory retain the data.

That’s odd, cause it does seem like the my forum’s speed improved. :slight_smile:
Guess not … since I just disabled it and the forums are going the same speed. Maybe there was a significant speed boosts from PHP5.1.2 to PHP5.1.4. That or I did something in MY version to boost the speed when I installed it. /shrug

Sorry, but from the look of things, APC is a memory cacher and requires the use of mod_php for full proper use. And no, we do not have the ability to install that. Basically it means we’re SOL and nothing we can do about it.

yerba# rm -rf /etc


Then I have to stick with eAccelerator… :frowning:
Thanks for your help.


Ok, I installed eAccelerator. Same results, it’s caching only one script/page:

Are we dealing with the same problem?


Yup, looks like it.

yerba# rm -rf /etc


Guice, you have to find a solution.
We are talking about lowering the server load for many people.
That will result in an increased performance for all of us.
DH should install APC as default, it’s supported by the PHP guys, it’s not a cheap PHP mod.

Where could I develop the subject?
Could you put a good word with the support team? Thanks.


Unfortunately, there’s no much I can do. DH folks are moving away from mod_php to PHPCGI. These cache systems only work on mod_php. Not to mention that DH won’t be using mod_php5. I don’t recommend anybody going back to PHP4.

To be quite honest, it’s stuck between a rock and a hard place now.

Let me ask around on other PHP sites to see if there’s any other option. I don’t know of any off hand. But reading from eAccelerator, it stores PHP’s compiled state in memory. If there’s a way to store that on a local file system, maybe there will be a way to use it between state.

yerba# rm -rf /etc


I’ve got both eA and APC working.

I’ve got a general set of instructions on my site; It worked for me on my site… I’m interested in knowing if what worked for me will also work for other people.



Well, it installs, but it doesn’t cache. And it can’t by design. It caches the PHP compile code within shared memory. Because PHP CGI runs a new instance everytime you make a request, you get a whole new shared memory space each time.

Copy your apc.php file into a browsable location and take a look at it. You’ll noticed the only think it’ll have listed is itself.

yerba# rm -rf /etc


I came across that problem too at first. What I was saying was that I solved that problem; APC works 100%. EA works 100%. You’ll see a nice little graphic with APC displaying the number of files that it has cached. (The uptime increases; the number of cached scripts increases.) EA doesn’t have that nice graphics – it simply tells you the number of cached scripts, with the file ’ control.php ’ …

The secret is changing your .htaccess and renaming your php.cgi. That is, assuming that all the pre-requisite modules were downloaded and installed… such as m4, autoconf, and automake.

You have to change php5.cgi or whatever it’s named to php5.fcgi … PLUS you have to tell .htaccess to run all scripts as fast cgi by adding a couple of lines to it. And, in .htaccess, you must reference the php5.fcgi or php.fcgi or whatever it’s named.

Then you’ll see that it is working.

I promise that it’s working. I know that it’s working. I can verify that it’s working. And I’ll prove that it’s working. I’ll send you a link in a PM or something.


In fact, just for you, I’ll change over to APC for a little while. And I’ll post a link for EVERYONE to verify. Give me about 5 minutes, and I’ll come back here and post a link …


Okay, I de-activated eA and put APC back on, but the server is being stubborn by keep eA in memory … so it looks like I need a server reboot or something. But … just in case, I’ll give you two links.

1: eA … http://www.pennyquick.com/control.php
2. APC … http://www.pennyquick.com/apc.php

I don’t know which one will be active; I did edit my php.ini to activate APC, however, at the time of this post, eA still showed to be doing its thing.

You can check the server status, too …

Status : http://www.pennyquick.com/status.php
or even see my php config …


APC is up.

Please post back here to confirm.


Interesting. Very nice. It does work! In case people don’t know the required entries for .htaccess, here are mine:

[quote]<Files “php”>
SetHandler fastcgi-script

Action gpcentre-php php-cgi/php
AddHandler gpcentre-php .php .pcgi
That works; it is caching: http://crescent.gpcentre.net/apc.php !

Nice call nite. Didn’t think to set type to fastcgi for it to start up. Didn’t even think there was a difference between the two. :slight_smile:

yerba# rm -rf /etc


I think this information ought to go out with the next news letter … that way, everyone on the shared server can benefit from it.

By the way, be sure to check your error logs. It seems there’s still work to do on either our end with APC, or on Dreamhost’s end to properly allow for APC.


Do you have CPU resources enabled on your account to see whether or not the accelerator makes a difference on the number of seconds that the CPU has to work ?

If there is a difference, then I think everyone ought to have an accelerator installed – to make -everyone’s- site speedier.