The yaSSL Open Source Embedded Web Server has support for CGI (Common Gateway Interface). Using CGI, a web server can communicate with other types of programs running on the server. Because the yaSSL Embedded Web Server by itself is only able to deal with HTML file, it can “pass off” scripts written in other languages to their specific interpreter, thus allowing the functionality of many CGI languages to be used. Some of the possible languages include: PHP, Perl, ASP, ASP.NET, Python, Ruby on Rails, and C.
To configure the yaSSL Embedded Web Server to process CGI scripts in a given language, the interpreter for that language must be installed on the server. As an example, we’ll walk through how you would enable PHP to be used with the yaSSL Embedded Web Server.
The first thing you would need to do would be to download PHP if it is not currently installed on your server. The PHP source can be downloaded from the following location: http://www.php.net/downloads.php. After it has been downloaded, it should be built and installed. From the php source directory, run the following commands:
sudo make install
On OS X, this will place the “php-cgi” program in the “/usr/local/bin” directory. Now that we have the PHP CGI interpreter, we need to let the yaSSL Web Server know where it is located. This can be done in two ways (as most options can) and be set at runtime using the -cgi_interp option, or by adding a similar line to the configuration file. We can also set the -cgi_ext option, which defines which extensions are treated as CGI scripts. Setting these option at runtime, you would start the yaSSL Embedded Web Server as follows:
./yasslEWS -cgi_ext cgi,php -cgi_interp /usr/local/bin/php-cgi
After starting the web server, you can test if PHP is working by browsing to any PHP file which is located under your web server root directory.