You can add functions/classes to PHP, programmed in C (and you can wrap a C++ class from C, if I remember correctly from an article I read some time ago), which might allow you to do some things faster -- if programmed well : no need for interpretation of PHP code ; only execution of machine code, which is generally way faster.
To do that, you'll have to develop a PHP extension.
There are not that many ressources available on the Internet about that, but these one might help you to start :
And, specifically about the C++ part, this one might help too :
If you are really interested by the subject, and ready to spend some money on it, you could also buy the book Extending and Embedding PHP (some pages are available as preview on Google Books too) ; I've seen a couple of times that it was the book to read when interested on this subject (In fact, I've bought it some time ago, and it's an interesting read)
BTW, the author of that book is also the author of the first four articles I linked to ;-)
Hope this help...
Have fun !