Configuring FreeRADIUS DHCP for ABillS

Suppose you installed FreeRADIUS 2 as written in this article – Installation and configuration of the ABillS billing system
Now copy the dhcp.conf file into the FreeRADIUS configuration:

sudo cp /usr/abills/misc/freeradius/v2/dhcp.conf /usr/local/freeradius/etc/raddb/sites-enabled/

Continue reading “Configuring FreeRADIUS DHCP for ABillS”

The solution of the error “PDOException “could not find driver””

I noticed somehow the following error:

PDOException “could not find driver”

The reason may be not activated pdo_mysql or not installed php5-mysql.
Let’s look at the PDO:

php -i|grep PDO

In php.ini or connected configuration files there should be a line:

extension=pdo.so
extension=pdo_mysql.so

Let’s see the information about php5-mysql:

dpkg --get-selections | grep php5-mysql

If not installed, then install, in Ubuntu it can be done like this:

sudo apt-get install php5-mysql
sudo apt-get install php-mysql
sudo /etc/init.d/apache2 restart
sudo service apache2 restart

The solution of the error “Unable to create channel of type ‘SIP’ (cause 20 – Subscriber absent)”

I noticed one time when I received a call from the Asterisk console:

dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 – Subscriber absent)

In the context of the dialplan, I make a call simultaneously to two phones:

exten => s,5,DIAL(SIP/204&SIP/203,19)

Sometimes one of the IP phones is turned off, which is why this error occurs, informing that there is no subscriber.
To solve it, you just need to turn on the IP phone.

You can see information about SIP in the Asterisk console:

asterisk -rvv
sip show peers
sip show peer NUMBER
quit

If the client’s IP address is null and expire is -1, the SIP client is not online:

Expire: -1
Addr->IP: (null)

Comments in PHP

In PHP, comments can be of three types.

I will give an example of the first (one-line in the style of C ++):

<?php
echo "TEXT"; // Comment
?>

The second one in Unix style:

<?php
echo "TEXT"; # Comment
?>

The third multiline:

<?php
     /* Comment
        Comment
        Comment */
     echo "TEXT";
?>

PHP. Redirect to another page

I’ll give an example of redirecting to another page:

<?php
  header("Location: http://www.example.com/");
  exit;
?>

Example of redirecting in specified number of seconds:

<?php
  header('Refresh: 5; URL=http://www.example.com/');
  echo 'After 5 seconds you will be automatically redirected to another page.';
  exit;
?>

Example of Redirect in JavaScript (this may not work for everyone):

<script type="text/javascript">
  location.replace("http://www.example.com/");
</script>

Example Redirect in JavaScript after 5 seconds (this may not work for everyone):

<script type="text/javascript">
  setTimeout('location.replace("http://www.example.com/")', 5000);
</script>

An example of Redirect in HTML after 5 seconds (if you specify 0, it will redirect immediately):

<meta http-equiv="refresh" content="5; url=http://www.example.com/">

How to remove a Steam account

To delete the Steam account, you need to write a message to the technical support, for this go to the official website
https://support.steampowered.com/kb_article.php?ref=1558-QYAX-1965&l=english

Сlick “I need help“, choose the category of the question “My account” and write a message that we want to delete the account.

A week later I received an answer in which I asked if I really want to delete my account.
To which I replied “Yes, I want to delete my account“, after that, about a week later, the second message came:

The Steam account was disabled at your request. All information posted by him in the Community has been deleted. You will no longer be able to sign in to this account or restore access to it.

Done.

Linux disk test for errors and broken sectors

Switch directly to the root user:

sudo -i

Let’s see the list of disks:

fdisk -l
df -h

You can see the information and model of the disk as follows:

hdparm -i /dev/sda

If SMART is supported, install the utilities and see the SMART statistics:

apt-get install smartmontools
smartctl -a /dev/sda
smartctl -a /dev/sda|grep -i reallocated

Run SMART tests and view information (smartctl -X to stop the long test):

smartctl -H /dev/sda
smartctl --test=long /dev/sda
smartctl -l selftest /dev/sda

Now we will perform a disk check on the broken sectors (-s will display information about scanning, -v more detailed mode):

badblocks -sv /dev/sda1

You can save the result to a file:

badblocks -sv /dev/sda1 > ~/badblocks.list

You may need to unmount the disk to check:

umount /dev/sda1

You can run the test using e2fsck like this:

e2fsck /dev/sda1

See also:
Description of SMART attributes
Diagnostics HDD using smartmontools