Change Server API to CGI

Zordon

Verified User
Joined
Dec 11, 2009
Messages
13
Hi,
when I run phpinfo() I get:
Server API Apache 2.0 Handler

However, I have a script that needs to have CGI/FastCGI as ServerAPI.
So how do I change this??

I already did a custombuild and enabled cgi in the options.conf file of the custombuild folder:
php5_cgi=yes

When I click "list users" in DirectAdmin it also says:
CGI-Bin: ON


But the Server API is still set to Apache handler. So how can I change that?
Furthermore I have multiple users and domains on the server. Is it possible to change the Server API just for a single user?
 
Thanks for your answer
I forgot to mention that I also updated DA and a lot of components.
After that I did "./build all", so php definitely has been rebuild. And I can use CGI now, however the server API is still the Apache Handler. How can I switch that to CGI?

Thanks
 
Thanks.
Now it does work:)

However, another HUGE problem: Now I can't access some .php file on the web? What could be wrong here? Most of them (and so far all of which use mod_rewrite) still work fine.

edit:
The error I get is:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

I get this error with mysqldumper (a php script to create database dumps). However, other php scripts like phpmyadmin work perfectly fine. I already tried re-install mysqldumper, but can't even call the install.php on a new folder.
Is it possible that CGI messed something up here??
 
Last edited:
Check the apache error log to find out the reason.
 
Apache error log doesn't say anything?!
However I found the cause. I can't access php files in subdirectories where a .htaccess file with mod_rewrite is one directory level above. Removing the htaccess files solved the problem. I guess I'll have to find new rewrite rules? Why does switching to CGI affect the rewrite rules anyway?
 
Sounds like there is something wrong with suphp. Are you running suphp on your server?

If yes, then you have to overwrite the configuration files for Apache, we can do it eventually. But do that scsi saies first.
 
ps aux | grep suphp returns nothing, so I'm not running suphp.
What shall I do first?? What do you mean by scsi?

edit. sorry, it's NOT the .htaccess file. I can't access ANY php file in a subdirectory.
test.php works, but /folder/test.php fails. what's wrong here??
 
Last edited:
I'm afraid the error log doesn't say anything about those errors:

Code:
[Wed May 11 00:10:02 2011] [notice] SIGHUP received.  Attempting to restart
httpd: Could not reliably determine the server's fully qualified domain name, using server.xxx.net for ServerName
[Wed May 11 00:10:03 2011] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed May 11 00:10:03 2011] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Wed May 11 00:10:03 2011] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8g DAV/2 configured -- resuming normal operations
[Wed May 11 00:14:01 2011] [notice] caught SIGTERM, shutting down
[Wed May 11 00:14:05 2011] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed May 11 00:14:05 2011] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Wed May 11 00:14:05 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed May 11 00:14:06 2011] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Wed May 11 00:14:06 2011] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Wed May 11 00:14:06 2011] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8g DAV/2 configured -- resuming normal operations

edit: I still don't fully understand where and how this error occurs. When I create a test.php with just "echo phpinfo()" in it, in some directories it does work and in others it doesn't (i.e. I get the 500 Internal Server Error)?! What could be wrong here?

completely helpless and without ideas:
I just set up a test without htaccess file:
/test.php works
/DirA/test.php works
/DirB/test.php displays 500 internal server error

What does CGI mess up here?


edit.: SOLVED
Turns out now with CGI enabled I can't run php scripts in folders with permission 777. Changing the permission of the directories fixed everything.

Thanks again for your help.
 
Last edited:
Back
Top