Archive for November, 2011

SBDavid

How do I disable IPv6?

How do I disable IPv6?

Redhat recommends not disabling the ipv6 module, as that can cause issues with SELinux and other components, but adding the following to /etc/sysctl.conf will disable IPv6.

net.ipv6.conf.all.disable_ipv6 = 1
SBDavid

Mysql Tables

Mysql Tables

Each database will contain one or more tables once an application starts storing data in it. The application should usually be what creates tables and modifies them.

List tables

Use the “show tables” command to list the tables in a database:

SHOW TABLES FROM databasename;

Count the rows in a table

A simple query to count the number of rows (entries) in a table would look like:

SELECT COUNT(*) FROM databasename.tablename;

Show all data in a table

To list absolutely every entry in a table, run:

SELECT * FROM databasename.tablename;

Note that this will usually be a huge result. You can list just the fields you want to view from each entry by listing them in place of “*” above, separating them with commas.

SBDavid

Premature End Of Script Headers

Premature End Of Script Headers

Where to check for errors

Check domain/apache error log file.
Check /var/log/apache/suexec.log file that should give a solution.

http://httpd.apache.org/docs/current/suexec.html

Upload your script is ASCII mode

Upload your Perl script in ASCII mode.
Set the permission of the file to 755, which allows the script to be executed by everybody.

Tracking Errors in the Script

perl -wc helloworld.pl

Will cause the Perl interpreter to check your script for syntax errors.

Running it without the syntax check options:

perl -w helloworld.pl

If something strange has gone wrong with your program and youre not sure where you should look for help, try the -w switch first.

It will often point out exactly where the trouble is.

SBDavid

Using ntpdate command

Using ntpdate command

The ntpdate command will sync your clock with an NTP server

The ntpdate command will not run when the NTP server is running, if you run then it says the NTP socket is in use, exiting.

[centos@centos ~]$ grep ^server /etc/ntp.conf
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
[centos@centos ~]$ sudo ntpdate 0.rhel.pool.ntp.org
[sudo] password for centos:
13 Nov 19:15:42 ntpdate[10611]: the NTP socket is in use, exiting
[centos@centos ~]$

Stop NTP and then run ntpdate

centos@centos ~]$ sudo /etc/init.d/ntpd stop
Shutting down ntpd: [ OK ]
[centos@centos ~]$ sudo ntpdate 0.rhel.pool.ntp.org
13 Nov 19:16:58 ntpdate[10636]: adjust time server 123.108.200.163 offset -0.285447 sec
[centos@centos ~]$ sudo /etc/init.d/ntpd start
Starting ntpd: [ OK ]
[centos@centos ~]$ pgrep ntp
10643
[centos@centos ~]$

Reference: http://support.ntp.org/bin/view/Support/GettingStarted

htpasswd - Manage user files for basic authentication

htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users. If htpasswd cannot access a file, such as not being able to write to the output file or not being able to read the file in order to update it, it returns an error status and makes no changes.

Resources available from the Apache HTTP server can be restricted to just the users listed in the files created by htpasswd. This program can only manage usernames and passwords stored in a flat-file. It can encrypt and display password information for use in other types of data stores, though. To use a DBM database see dbmmanage.

htpasswd encrypts passwords using either a version of MD5 modified for Apache, or the system’s crypt() routine. Files managed by htpasswd may contain both types of passwords; some user records may have MD5-encrypted passwords while others in the same file may have passwords encrypted with crypt().

-m Use MD5 encryption for passwords.
-c Create the passwdfile. If passwdfile already exists, it is rewritten and truncated.

EXAMPLES

htpasswd /usr/local/etc/apache/.htpasswd-users jsmith

Adds or modifies the password for user jsmith. The user is prompted for the password.

« Prev - Next »