Moved to Dreamhost PS

Hi all,

I’m having an issue with PHP 5 on my Dreamhost PS.

I was firstly moved automatically to a new server which had PHP 5 (I was previously on PHP 4). About 2-3 days later Dreamhost automatically moved me now to a Dreamhost PS.

My site is now up however each process of PHP 5 is taking too much MB is my opinion and that’s probably what is causing the high memory/CPU load which made Dreamhost transfer me to this PS.

With PHP 4 my resources for PHP looked like which I think isn’t too bad as Dreamhost never complained about it.
php.cgi 4104.9200 99.923% 17.104% 105868 0.039

As you can see below here is “top” running on the Dreamhost PS which shows PHP 5 taking up lots of memory:

top - 21:57:30 up 2:08, 1 user, load average: 38.97, 39.12, 36.14
Tasks: 30 total, 9 running, 3 sleeping, 0 stopped, 1 zombie
Cpu(s): 9.4%us, 0.9%sy, 0.0%ni, 89.5%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 2355200k total, 1262184k used, 1093016k free, 0k buffers
Swap: 921600k total, 0k used, 921600k free, 0k cached

18067 alexxxxx 15 0 81528 26m 7576 H 3 1.2 0:47.52 php5.cgi
18072 alexxxxx 15 0 80500 26m 7524 H 3 1.2 0:48.24 php5.cgi
18073 alexxxxx 15 0 81560 26m 7604 H 3 1.2 0:48.95 php5.cgi
18075 alexxxxx 16 0 81528 26m 7568 H 3 1.2 0:48.69 php5.cgi
18076 alexxxxx 15 0 81540 26m 7600 H 3 1.2 0:49.33 php5.cgi
18215 alexxxxx 15 0 81680 26m 7596 R 3 1.2 0:47.86 php5.cgi
18005 alexxxxx 16 0 82052 27m 8196 H 3 1.2 0:49.23 php5.cgi
18216 alexxxxx 16 0 77904 23m 7600 H 3 1.0 0:47.40 php5.cgi
18065 alexxxxx 15 0 80528 26m 7520 H 3 1.2 0:50.56 php5.cgi
18003 alexxxxx 16 0 79236 24m 7584 R 2 1.1 0:51.28 php5.cgi
11405 alexxxxx 16 0 75888 21m 7880 R 2 0.9 0:52.37 php5.cgi
18044 alexxxxx 16 0 84232 30m 7532 H 1 1.3 0:49.58 php5.cgi
18066 alexxxxx 16 0 84892 30m 7524 R 1 1.3 0:48.85 php5.cgi
5587 alexxxxx 15 0 68004 14m 7476 H 1 0.6 0:11.93 php5.cgi
18004 alexxxxx 15 0 68676 14m 7932 R 1 0.6 0:50.89 php5.cgi
18045 alexxxxx 15 0 68020 14m 7532 H 1 0.6 0:49.97 php5.cgi
18070 alexxxxx 16 0 68020 14m 7536 R 1 0.6 0:49.20 php5.cgi

I guess what I would like to know is, is this normal? Is there a way I can configure this PS to run PHP 4 instead?

Thanks in advance,


Have you checked your error logs?

You might be able to perform a quick test by removing the handler in a .htaccess file.

RemoveHandler php-cgi .phpIf you require PHP4 you should install PHP 4.4.9

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost

Hi sXi,

I’ve just checked my error log and it’s 150MB.

It has this line repeated:
[error] [client] Premature end of script headers: php.cgi

Could be anything from incorrect permission settings to a script uploaded in binary mode, etc. that’s causing the issue.

Take a gander at your (hopefully already downloaded) log and see if there’s a referer [sic] mentioned. It might be just one file that’s creating all the pain.

[error] [client] Premature end of script headers: php.cgi, referer:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost

I’ve check the error.log file and it seems that it only happened a few times at the start, other than that it hasn’t happened again.

The most common thing listed in the error log file is can’t find a certain directory which dreamhost renamed to something else to prevent load, however I don’t think that would cause the PHP5 issues?

[Sat Oct 03 23:24:08 2009] [error] [client] client denied by server configuration: /home/alexxxxx/web/xxxxxxxx
[Sat Oct 03 23:24:08 2009] [error] [client] client denied by server configuration: /home/alexxxxx/web/forbidden.html

In regards to PHP 4, is this script still valid or is there a simpler way to install PHP 4?

You’re on VPS now so you can rename it back again to see if that’s causing problems :wink:

Rebooting your server (via Panel) will get rid of the extra php.cgi processes that are currently running. Using top -d1 in a shell window then navigating your site after a reboot might shed light about why/where those apparently extra processes are being spawned.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost

Thanks, I’ve renamed it back. Things seem to be at around 350-400MB used but that could just be that it’s 4am in the morning in the US.

These processes do seem a little weird running for so long:
5075 alexxxxx 16 0 66944 12m 7924 S 0 0.6 0:10.53 php5.cgi
5842 alexxxxx 15 0 65856 12m 7536 S 0 0.5 0:08.62 php5.cgi

I don’t think I can afford to at least $40 a month just because I was moved to PHP 5.

Do you know any reliable web hosts that still have PHP 4 or if there is a way to request to be moved to a shared PHP 4 server as my website was all ok on it?

Also do you think they could move me back to shared hosting if I hosted the PHP files elsewhere?

You’ll need to get your resource usage down to an “acceptable level” (whatever that is) before asking Support to move you back onto shared hosting.

I just noticed you asked about parsing image files as php some days ago. If you’ve set this instruction in a domain root it could cause unnecessary resource usage.

It could be a case that the scripts you’re running were written for, or for some reason perform better, on PHP4. The only way to test that hypothesis is to install PHP4 yourself and let the site run for a few days, checking your VPS graphs in Panel to see if it provided any benefit resource-wise compared to running under PHP5.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost

Thanks for that. After a while I got php 4 running and things seem to work better. The parsing of image files isn’t for the root and is just for a certain directory.

Will let the server go on for another day and check out the usage.

Hmm, my website kept randomly getting 503 errors (for a few hours it would work and then not work for a few minutes) and this is what Dreamhost had to say about it:

"However, the reason it is now working is that the number of
incoming connections to your domains decreased. The 503 error shows that
all the available connections to your Private Server’s Apache instance
were used up at that time.

I used the following wiki article’s tips to check your access logs:

For ‘xxxxxxx’, you had a lot of connections from Google yesterday:



You can use the “Goodies > Block Spiders” page in your Web Panel to block
this bot, but you’ll want to contact Google directly for the best ways to
deal with their bot."

How could this be? 719 connections is considered a lot?
I had 70,000 to 100,000 instances a day with php.cgi (when checking out /resources) before when I was on shared hosting and they never complained about it and now they say it’s because I’ve had 719 connections? Something isn’t right.

Would anyone have any insight as to why this could be?

719 isn’t a lot, unless they were concurrent connections, which would be a tremendous waste of resources just to satisfy a bot.

Have you implemented a robots.txt file to try lower the crawl rate?

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost

Thanks for your replies.

Dreamhost advised that it was 719 for the day.

“That was 719 connections for the day, actually. How many were being run concurrently is not possible to determine without monitoring the server when it is happening.”

They keep referring me to which isn’t really helpful for me because they suggest to use mod_php but if you select it, the control panel says “not recommended”.

I think I will give that a go once my server is back as I’ve managed to kill my server by rebooting and killing off processes because for no reason it was using 1 GB of memory.

What I don’t understand is why they have this Dreamhost PS when you can get more performance with just the shared hosting and pay less too.

I’m not sure if it’s just my server or because it had PHP 5 but when I refreshed a page the memory would increase and then decrease but still around a few MB was still shown as used when it should have been completely freed. So if I kept refreshing it would start increasing and get up to 300-400 MB and stay around there even if you didn’t access the pages. Maybe there are other factors in play, like accessing non-PHP files could cause this sort of thing but you can’t really tell.

I think I’m going to have to move all my PHP scripts out of the PS and just have it hosting the images, static pages, etc in the hope that they move me back to shared hosting. I’ve got my own little server at home (only 512mb ram) with Apache and PHP 4 (and it’s on windows!) and it runs without any issues at all even when I refresh it a heap of times (I would run my website from it but my upload is slow), if only everything was that simple.

In my opinion Dreamhost shared hosting (with PHP4) > Dreamhost PS (even with PHP4). Shared hosting was a dream run for me.

Sorry for my rant :.

Your site was likely thrashing the shared server you were on - you just couldn’t “see” it like you can with VPS. That’d be why DH sent you into VPS land in the first place :wink:

What scripts are you running, and which caching solutions have you tried thus far?

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost