Archive for the tag 'Script'

Upgrading to PHP5 using /script/easyapache

1. Connect to server as root
2. /scripts/upcp –force ##this can take a while.
3. /script/easyapache

SELECT OPTION 7

1. Select “Php Module —>”
2. Uncheck current PHP version
3. Check latest version of PHP5
4. Select “Exit”
5. Select “Exit” again
6. Sit back and wait, it can take 10-60 minutes to complete

Disable Script Execution Using .htaccess

You can disable scripts being run in the directory of your choice by adding the following code to your .htaccess file in that directory

This would be particularly useful if you allow visitors to upload files to your server, but want to be sure that any potentially harmful files they upload are not allowed to execute.

AddHandler cgi-script .php .pl .jsp .asp .sh .cgi
Options -ExecCGI

You can replace the file types in the example with the file types you wish to disallow using .htaccess.

Debugging on part(s) of the bash script

Using the set Bash built-in you can run in normal mode those portions of the script of
which you are sure they are without fault, and display debugging information only for troublesome zones.

Say we are not sure what the `uptime` command will do in a script, then we could enclose it in the script like this:

set -x # activate debugging from here
uptime
set +x # stop debugging from here

How to check if Python script engine is enabled

We can check using the default Parallels Plesk Panel domain page content (http://domain.tld/index.html) - then by the “Python” item.

The test looks successful if a page with a list of environment variables is shown.

Test can be done using a simple script like this.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print “Content-Type: text/plain;charset=utf-8″
print

print “Hello World!”

It is necessary to put the content into a text file and save in the domain web-accessible folder (like $HTTPD_VHOSTS_D/domain.tld/httpdocs) on the server with .py extension (test.py for example). Then try to open the file via browser by the http://domain.tld/test.py URL.

The test looks successful if a page shows the “Hello World!” string. If an error or full script listing is visible, it means that Python engine is not configured for the domain properly.

Reference: http://parallels.com/

How to check if Perl script engine is enabled and working for a domain?

To check this we can use a simple script like this:

#!/usr/bin/perl
print “content-type:text/html\n\n”;
print “<html>\n”;
print “<head />\n”;
print “<body>\n”;
print “Hello World!\n”;
print “</body>\n”;
print “</html>\n”;
#

Save the content into a text file and save in the domain web-accessible folder (like $HTTPD_VHOSTS_D/domain.tld/httpdocs) on the server with .pl extension (test.pl for example). Then try to open the file via browser by the http://domain.tld/test.pl URL. The domain name should be resolved for this to work.

The test looks successful if a page shows the “Hello World!” string.

If an error or full script listing is visible, it means that Perl script engine is not configured for the domain properly.

« Prev - Next »