44c44
< int fcgi_spawn_connection(char *appPath, char *addr, unsigned short port, const char *unixsocket, int child_count, int pid_fd, int nofork) {
---
> int fcgi_spawn_connection(char *appPath, char *cfgPath, char *addr, unsigned short port, const char *unixsocket, int child_count, int pid_fd, int nofork) {
167,169c167,177
< 			b = malloc(strlen("exec ") + strlen(appPath) + 1);
< 			strcpy(b, "exec ");
< 			strcat(b, appPath);
---
> 			if (cfgPath) {                                                                                                                                 
> 				b = malloc(strlen("exec ") + strlen(appPath) + strlen(" -c ") + strlen(cfgPath) + 1);                                                  
> 				strcpy(b, "exec ");                                                                                                                    
> 				strcat(b, appPath);                                                                                                                    
> 				strcat(b, " -c ");                                                                                                                     
> 				strcat(b, cfgPath);                                                                                                                    
> 			} else {                                                                                                                                       
> 				b = malloc(strlen("exec ") + strlen(appPath) + 1);                                                                                     
> 				strcpy(b, "exec ");                                                                                                                    
> 				strcat(b, appPath);                                                                                                                    
> 			}                    
249a258
> " -x <path>    path to the php config directory (e.g. /etc/php/)\n" \
268c277
< 	char *fcgi_app = NULL, *changeroot = NULL, *username = NULL,
---
> 	char *fcgi_app = NULL, *fcgi_cfgpath = NULL, *changeroot = NULL, *username = NULL,
279c288
<        while(-1 != (o = getopt(argc, argv, "c:f:g:hna:p:u:vC:s:P:"))) {
---
>        while(-1 != (o = getopt(argc, argv, "c:f:x:g:hna:p:u:vC:s:P:"))) {
281a291
> 		case 'x': fcgi_cfgpath = optarg; break;
436c446
<        return fcgi_spawn_connection(fcgi_app, addr, port, unixsocket, child_count, pid_fd, nofork);
---
>        return fcgi_spawn_connection(fcgi_app, fcgi_cfgpath, addr, port, unixsocket, child_count, pid_fd, nofork);
