When PHP safe_mode is on

When PHP safe_mode is on

When safe_mode is on, PHP checks to see if the owner of the current script matches the owner of the file to be operated on by a file function or its directory. For example:

-rw-rw-r– 1 buddies buddies 43 Nov 1 19:20 passwd.php
-rw-r–r– 1 root root 1116 Nov 26 18:01 /etc/passwd

Running passwd.php: results in this error when safe mode is enabled:

Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not
allowed to access /etc/passwd owned by uid 0 in /docroot/passwd.php on line 2

However, there may be environments where a strict UID check is not appropriate and a relaxed GID check is sufficient. This is supported by means of the safe_mode_gid switch. Setting it to On performs the relaxed GID checking, setting it to Off (the default) performs UID checking.

If instead of safe_mode, you set an open_basedir directory then all file operations will be limited to files under the specified directory. For example (Apache httpd.conf example):

php_admin_value open_basedir /docroot

If you run the same script.php with this open_basedir setting then this is the result:

Warning: open_basedir restriction in effect. File is in wrong directory in /docroot/passwd.php on line 2

Simplifying Setup of User Accounts in Plesk

Before you start signing up new users for your services, you should create account configuration presets, referred to as reseller account templates and client account templates. They will simplify setting up user accounts for new customers. The templates cover all resource usage allotments, permissions and limits that you can define for a user account. There are predefined reseller account and client account templates: You can modify them as required and use them, or you can create your own templates. The default templates cannot be removed.

To create a reseller account template:

1. Go to Resellers > Reseller Account Templates > Create Reseller Account Template.

Click OK to complete creation of a template.

During setup of a new reseller account, you will select the required template and the account will be created and allocated the resources you defined.

To create a client account template:

1. Go to Clients > Client Account Templates > Create Client Account Template.

Click OK to complete creation of a template.

During setup of a new user account, you will select the required template and the account will be created and allocated the resources you defined.

Setting up the Tunnel

The most common methods of setting up a tunnel are through putty or through command-line SSH.

To open an SSH tunnel via the command line, run:

ssh -L3307:127.0.0.1:3306 -p 22 -N -t -x user@myhost.com

Connecting with MySQL

You can connect to the MySQL server!
You want to choose 3307 for your local port so that it does not conflict with your existing local copy of MySQL.

mysql -u username -ppassword -h 127.0.0.1 -P 3307

How to configure to use RPMforge ?

Reference: http://dag.wieers.com/rpm/FAQ.php#B2

It’s very easy. Just install the latest rpmforge-release package for your distribution and architecture.

This will automatically install the configuration and GPG keys that are for safely installing RPMforge packages.

The configuration of Yum is inside the rpmforge-release package.

You need to install it yourself.

If you’ve done that, the rest is simple. Upgrade your system by doing:

yum update
You can add new software by typing:
yum install [name of package]
Or update installed software:
yum update [name of package]

Or search for software in the local repository meta-data:
yum search [keyword]
Or simply list all available software:
yum list available
From time to time you may want to save some diskspace:
yum clean

You can change the time zone within a php script. Here is a sample code:

With the php tags enter the following

putenv(”TZ=Europe/Amsterdam”);

You can set the timezone in .htaccess as well. Add the line:

SetEnv TZ America/Indianapolis

List of timezones is here: http://us.php.net/manual/en/timezones.php

« Prev - Next »