How to change the max file upload size for phpMyAdmin in Plesk

You need to edit the correct php.ini file and increase the value of the following variables to the desired size:

memory_limit, upload_max_filesize and post_max_size

The  php.ini file is located at:

On Linux server:

/usr/local/psa/admin/conf/php.ini

On Windows server:

C:\Program Files (x86)\Parallels\Plesk\admin\php.ini

 

Then you will need to restart your webserver & PSA.

 

 

Change email password without logging in on DirectAdmin

If you would like your pop users to be able to change their own email passwords without having to login to the control panel, simply give them this link:

http://www.domain.com:2222/CMD_CHANGE_EMAIL_PASSWORD

Where www.domain.com is either your domain, hostname, or IP address.

More information on this function and how you can use it via API can be found Here.

There is also a DA plugin that also gives email users the ability to change their passwords, and vacation messages, and show them their email stats, all in once place:
http://www.directadmin.com/forum/showthread.php?t=22715

For automated vacation messages changes by email users, it can be implemented via API here, or just use the plugin above:http://www.directadmin.com/forum/showthread.php?t=13112

A squirrelmail plugin has been created which allows interaction with DirectAdmin showing usage, as well as the ability to change the password and vacation message:
http://www.directadmin.com/forum/showthread.php?t=31050

How to forward a website to another url

There are several ways to accomplish this task, but the simplest to understand is to use php.

To do this, you need to create the page that will do the forwarding.  This can be any page, as long as it ends in “.php”.  If you are trying to redirect a domain, you’d create “index.php” inside the public_html directory.

Once you decide which page you will use, then create the file and enter the following text:

<?php
header(“Location: http://whereyouwant.com/to/go.html“);
?>

Where http://whereyouwant.com/to/go.html is the location that you want the page to forward to.  You can use local values, ie: /page.html, or full urls as in the above example (http://..etc.)


Another way to accomplish this is to use an .htaccess file in the public_html directory.  Sample contents:

Redirect 301 / http://whereyouwant.com/to/go.html

Redirect domain.com to www.domain.com

If you want to force clients to use www.domain.com, you can redirect them from domain.com to the www version with an .htaccess file.

In your public_html folder, create a file called .htaccess and add the code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent]

where you’d need to replace domain\.com and domain.com with your actual domain name.  Note the \ character must be present to escapce the . character.

Other versions of the same thing do a negation check to see if the domain is not www.domain.com, but that doesn’t work if you have subdomains.. hence the need for the explicit check for the value we don’t want.

Adding custom modules to apache for custombuild – DirectAdmin

If you want to add any extra modules to apache in custombuild, they’ll need to be compiled in. Any module that needs to be compiled in will have a –with-module type flag which will need to be used. To add this flag, run the following:

 

cd /usr/local/directadmin/custombuild
mkdir -p custom/ap2
cp configure/ap2/configure.apache custom/ap2/configure.apache
vi custom/ap2/configure.apache

#add your –with-module line to the end of the file,
# and make sure the  character exists at the end of all lines except the last one../build clean
./build apache
Then restart apache:
RedHat:/sbin/service httpd restart
FreeBSD:/usr/local/etc/rc.d/httpd restart
Debian:/etc/init.d/httpd restart

If you run into problems, you may also need to recompile php as well:./build php

Then restart apache again.

MySQL Socket errors

This is an error that many people who run PHP and MySQL are familiar with:

ERROR 2002: Can’t connect to local MySQL sever through socket

‘/var/lib/mysql/mysql.sock’ (2)

Luckily, this is relatively easy to solve in most cases. Here’s what to do.

·First of all, we need to decide where the MySQL socket file should be. For this text we will assume that you would like the socket file to be placed in the MySQL default location for a Redhat system which is /var/lib/mysql/mysql.sock.

·Second, is MySQL running? This is easily overlooked, but check and make sure that MySQL is running with a command such as:

[[email protected] ~]# ps aux | grep mysql

root67220.00.146561132 ?S08:200:00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –socket=/var/lib/mysql/mysql.sock –log-error=/var/log/mysqld.log –pid-file=/var/run/mysqld/mysqld.pid

mysql67640.12.6 128328 16904 ?Sl08:200:01 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –user=mysql –pid-file=/var/run/mysqld/mysqld.pid –skip-external-locking –port=3306 –socket=/var/lib/mysql/mysql.sock

root70510.00.14044676 pts/0R+08:400:00 grep mysql

Good, it’s running so we can move on. If MySQL is not running, try to start it with “/etc/init.d/mysqld start”

·Alright, so MySQL is humming along, but it is pretty useless if we cannnot connect to it. The easiest way to see what MySQL thinks it should be using for socket file is by running the following command:

[[email protected] ~]# /usr/libexec/mysqld –print-defaults

/usr/libexec/mysqld would have been started with the following arguments:

–port=3306 —socket=/var/lib/mysql/mysqld.sock –skip-locking –key_buffer=16K

–max_allowed_packet=1M –table_cache=4 –sort_buffer_size=64K –read_buffer_size=256K

–read_rnd_buffer_size=256K –net_buffer_length=2K –thread_stack=64K –server-id=1

–port=3306 –socket=/var/lib/mysql/mysql99999.sock –skip-locking –key_buffer=16K

–max_allowed_packet=1M –table_cache=4 –sort_buffer_size=64K –read_buffer_size=256K

–read_rnd_buffer_size=256K –net_buffer_length=2K –thread_stack=64K –server-id=1

[[email protected]  ~]#

I’ve highlighted the part that you should look at to find what you need to know. It looks like I must have had a bad keystroke when editing my “/etc/my.cnf” the other day.

·Here’s an excerpt from my “/etc/my.cnf”. Make sure that when you edit this file that you update the correct socket specification. You will notice that there two of them, one of them is for the MySQL client, the second is for the MySQL daemon. Update the one from the “[mysqld]” section.

——-cut———

[client]

#password= your_password

port= 3306

socket= /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server

[mysqld]

port= 3306

socket= /var/lib/mysql/mysqld.sock

skip-locking

key_buffer = 16K

max_allowed_packet = 1M

——-cut———

Change it to:

——-cut———

[client]

#password= your_password

port= 3306

socket= /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server

[mysqld]

port= 3306

socket= /var/lib/mysql/mysql.sock

skip-locking

key_buffer = 16K

max_allowed_packet = 1M

——-cut———

·Okay, now that this is updated, we should restart MySQL.

[[email protected] ~]# /etc/init.d/mysqld restart

Stopping MySQL:[OK]

Starting MySQL:[OK]

[[email protected] ~]#

·Okay, is everything working now? If you were using the command line mysql client, give it a try. If you were using php, try your webpage again. If you are still experiencing problems with php not being able to find the socket, then you should check where php thinks the socket file lives.

[[email protected] ~]# php -i | grep mysql.default_socket

mysql.default_socket => no value => no value

[[email protected] ~]# php -i | grep php.ini

Configuration File (php.ini) Path => /etc

Loaded Configuration File => /etc/php.ini

It appears that php does not have a socket location set, meaning that it will use what MySQL tells it is the default (in this case being /var/lib/mysql/mysql.sock), but to make sure lets specify a location.

·Notice that in the last step, we also wanted to find out where php’s php.ini configuration file is located and we know that it is in “/etc/php.ini”. Let’s fire up our favorite text editor and fix this.

——-cut———

; compile-time value defined MYSQL_PORT (in that order).Win32 will only look

; at MYSQL_PORT.

mysql.default_port =

; Default socket name for local MySQL connects.If empty, uses the built-in

; MySQL defaults.

mysql.default_socket =

; Default host for mysql_connect() (doesn’t apply in safe mode).

mysql.default_host =

; Default user for mysql_connect() (doesn’t apply in safe mode).

mysql.default_user =

——-cut———

Changes to:

——-cut———

; compile-time value defined MYSQL_PORT (in that order).Win32 will only look

; at MYSQL_PORT.

mysql.default_port =

; Default socket name for local MySQL connects.If empty, uses the built-in

; MySQL defaults.

mysql.default_socket = “/var/lib/mysql/mysql.sock”

; Default host for mysql_connect() (doesn’t apply in safe mode).

mysql.default_host =

; Default user for mysql_connect() (doesn’t apply in safe mode).

mysql.default_user =

——-cut———

Now both the command line MySQL client as well as php should be able to connect to MySQL just fine!

 

How to use SSH

 

To use ssh, you’ll need an ssh client for your local computer.  We recommend PuTTY

Once you’ve installed your ssh client, load it up and you should be given a space to enter some information.  You’ll want to select “SSH” on port 22.  You can past in the name of your server “domain.com” or the ip “1.2.3.4” in the the space that says “Host Name (or IP Address)”.  Click Open.

If you’ve entered all info correctly, you should be prompted with a large black screen asking for your login information.  If you are doing system tasks, you’ll probably need root access.  If you have root access, enter “root” and press enter.. sometimes it can take several seconds before you see any change.   Enter the root password (and press enter), and if everything works, you should see a command prompt, ex:[[email protected]]#

You are now on the server. This is your starting point.

From here you can do anything, including destroy your server, so you must be very careful with the commands you enter.

Some basic commands include:

List: ls[[email protected]]# ls
file1.txt   file2.txt   file3.txt

Change Directories: cd[[email protected]]# cd /home/admin

Remove a file: rm[[email protected]]# rm file1.txt
rm: remove `file1.txt’ ? y

Once you’ve finished working, you can type[[email protected]]# exit

and the ssh window should be closed.

 

Welcome to our blog

This blog will cover the following topics:

  • Attacker.NET offers & News
  • Security Advisories
  • Tutorials & How-To’s
  • Genetal IT news, Issues and Best practices