Archive for the tag 'cgi'

How to resolve Suexec problems with cgi scripts

Run the following script:

/scripts/fixsuexeccgiscripts

This reads /usr/local/apache/logs/suexec_log and looks for errors and tries to fix them.

Running CGI scripts in the httpdocs directory without mod_perl in Plesk

To accomplish this on a per domain basis you will need to create a vhost.conf in the conf directory at /var/www/vhosts/serverbuddies.com/ with the following code.

<Directory /var/www/vhosts/mt-example.com/httpdocs>
<Files ~ (\.cgi$)>
SetHandler cgi-script
Options ExecCGI
allow from all
</Files>
</Directory>

Then run the following command to enable the change.

/usr/local/psa/admin/sbin/websrvmng -v -a

Now, all files with ‘.cgi’ extension will be executed as usual CGI scripts in /cgi-bin/.

To enable CGI in httpdocs for the whole server just uncomment the “AddHandler cgi-script .cgi” directive in httpd.conf and restart Apache.

Reference: http://parallels.com/

CGI is not working for sub-domain after the site has been imported

This is because the /home/virtual//fst/var/subdomain//html link which points to ../../../home//public_html doesn’t export because this link does not belong to exported user.

To resolve this issue, Create the mentioned link after export manually.

Login to the server as root

Change directory to home of a site administrator of exported site

chroot ~adminN

Where N is an ID of the site administrator.

Create the necessary link by executing the following command:

ln –s ../../../home//public_html/var/subdomain//html

4. After link has been created the CGI for sub-domain(s) should be working.

Reference : http://parallels.com

SBDavid

Running CGI script from any directory

Running CGI script from any directory

In order to force apache to allow cgi script to run, simply create a file called .htaccess inside the directory in which you wish to run the scripts. Inser this text into the file:

AddHandler cgi-script .cgi .pl

AddHandler maps the filename extensions extension to the handler handler-name. This mapping is added to any already in force, overriding any mappings that already exist for the same extension. For example, to activate CGI scripts with the file extension “.cgi”, you might use:

AddHandler cgi-script .cgi

Once that has been put into your srm.conf or httpd.conf file, any file containing the “.cgi” extension will be treated as a CGI program.

The extension argument is case-insensitive, and can be specified with or without a leading dot.

PHP as a CGI script with suexec

For hosts running PHP as a CGI script with suexec you may be able to put these directives in a php.ini file in your website root directory.

upload_max_filesize = 10M
post_max_size = 20M

Add the below to your .htaccess file in your web root directory.

php_value upload_max_filesize 10M
php_value post_max_size 20M

The PHP documentation states that the memory_limit setting also affects file uploading.
Generally speaking, memory_limit should be larger than post_max_size.

Depending on your host, this can be done in a number of places with the most likely being php.ini or .htaccess depending on your hosting situation.

Add for example:

memory_limit = 16M to your php.ini file (recommended, if you have access)

With root access, you can use the sed util in Linux/Unix based systems, in order to increace the memory for 64M. Don’t forget to properly locate you php.ini file!

sed -i ’s/memory_limit = 16M/memory_limit = 64M/’ /etc/php5/apache2/php.ini

Next »