One can use PHP to write sites/pages which are of little load. But if you have millions of visitors per day, PHP interpreter will give a deadly strain to the server.
CGI is an old technology, which allows dynamic program execution on the server side. In difference from PHP, however, it launches separate process for each client connection, which unnecessarily loads CPU.
However, there is a FastCGI technology, which doesn't need launching process for each connection, but instead treats CGI script as a server (network or local), sending and receiving data through sockets. This approach speeds up processing HTTP server connections and unloads CPU. However we pay for that with a greater complexity of the application.
This CGI library can support CGI as well as FastCGI (of course, if you compile it with FastCGI library). You can choose anytime which is better for you - speed or simplicity.
1.5.5