Admin Life Errors, Fixes, and Encounters

18Mar/100

Changing your hosts file in Vista

By default, if you try to modify your hosts file in windows Vista, it will not let you save it. It tells you that you don't have permission. To successfully modify the hosts file, run notepad.exe as an administrator open the file. This is a windows vista and windows 7 issue and does not need to run in windows XP

1 ) Browse to Start -> All Programs -> Accessories
2 ) Right click "Notepad" and select "Run as administrator"
3 ) Click "Continue" on the UAC prompt
4 ) Click File -> Open
5 ) Browse to "C:\Windows\System32\Drivers\etc"
6 ) Change the file filter drop down box from "Text Documents (*.txt)" to "All Files (*.*)"
7 ) Select "hosts" and click "Open"
8 ) Make the needed changes and close Notepad. Save when prompted.

Here is a sample of what the hosts file looks like
I added 3 banner sites at the bottom as an example of what you can add.
In this example, everytime your browser tries to go to bannersite1.com bannersite3.com or bannersite3.com
your computer will answer with nothing... which causes no banners to come up!

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
::1 localhost
127.0.0.1 bannersite1.com
127.0.0.1 bannersite2.com
127.0.0.1 bannersite3.com

17Mar/101

TRAC multiple projects in apache for freebsd

How to install multiple TRAC projects on freebsd with apache 1.3

# cd /usr/local/www/
# mkdir trac_projects

////////// you have to do this for each project /////////////////////////
# trac-admin /usr/local/www/trac_projects/trac initenv
# trac-admin /usr/local/www/trac_projects/trac deploy /tmp/deploy
# mkdir /usr/local/www/trac_projects/trac_env
# mv /tmp/deploy/* /usr/local/www/trac_projects/trac_env
# chown -R www:www /usr/local/www/trac_projects/trac
# chown -R www:www /usr/local/www/trac_projects/trac_env
# cd /usr/local/www/trac_projects/trac_env/cgi-bin/
# chmod 744 trac.cgi
////////// you have to do this for each project /////////////////////////
// I did the steps above again for "trac_prj_2_env"

# cd /usr/local/etc/apache/
# vi httpd.conf


ServerName domain.ath.cx
DocumentRoot /usr/local/www/trac_projects
CustomLog /var/log/trac-apache-access.log combined
ErrorLog /var/log/trac-apache-error.log

ScriptAlias /trac /usr/local/www/trac_projects/trac_env/cgi-bin/trac.cgi
ScriptAlias /trac_prj_2 /usr/local/www/trac_projects/trac_prj_2_env/cgi-bin/trac.cgi


SetEnv TRAC_ENV "/usr/local/www/trac_projects/trac"


SetEnv TRAC_ENV "/usr/local/www/trac_projects/trac_prj_2"

# Allow access to the Trac static files
Alias /trac/ /usr/local/www/trac_projects/trac_env/htdocs/
ScriptAlias /cgi-bin/ /usr/local/www/trac_projects/trac_env/cgi-bin/

# Route "/" to the Trac cgi processor
#ScriptAliasMatch ^/(.*) /usr/local/www/trac_projects/trac_env/cgi-bin/trac.cgi/$1


AllowOverride None
Order allow,deny
Allow from all

# Set security on the login page, which allows Trac to use HTTP
# Auth as the mechanism for user authentication

AuthName "Top Secret"
AuthType Basic
#this is a location where all the projects will have access to
AuthUserFile /usr/local/www/trac_projects/trac_auth
Require valid-user

# cd /usr/local/etc/rc.d
# ./apache restart

use http://www.xs4all.nl/~remcovz/htpasswd.html to generate a user name and password to put inside trac_ath

an example line you would have inside trac_auth would be...
test:W.Mrp0Xqwcgxg

the actual username: test and password: test

Filed under: Errors 1 Comment
17Mar/101

mod_wsgi apache freebsd python

The version of Apache on older versions of FreeBSD is not compiled with support for multithreading but Python itself is. Normally this would be where Apache 1.3 is being used. The result is that when starting up Apache with mod_wsgi, an error similar to the following can occur:

Syntax error on line 37 of /usr/local/apache2/conf/httpd.conf: \
Cannot load /usr/local/apache2/modules/mod_wsgi.so into server: \
/usr/local/apache2/modules/mod_wsgi.so: Undefined symbol \
"pthread_attr_init"

You may also get this Error with apache 1.3

Syntax error on line 244 of /usr/local/etc/apache/httpd.conf:
Cannot load /usr/local/libexec/apache/mod_wsgi.so into server: \
/usr/local/lib/libpython2.4.so: Undefined symbol "pthread_attr_destroy"

The solution is to force Apache to preload the reentrant version of the C runtime library which contains the POSIX thread library functions. This can be done by modifying the 'envvars' script, if it exists and is used, contained in the same directory as where the Apache 'httpd' binary is installed, or the Apache startup script, and add the lines:

LD_PRELOAD=/usr/lib/libc_r.so
export LD_PRELOAD

Step 1.

Set the library to system environment.

# LD_PRELOAD=/usr/lib/libc_r.so
# export LD_PRELOAD

Step 2.

Stop apache then start it up again

root@host rc.d # ./apache stop
Stopping apache.
Waiting for PIDS: 35117.

root@host rc.d # ./apache start
Starting apache.

root@host rc.d #

15Mar/100

sqlite error trac install

While trying to install trac on freebsd 7.0 I had an error with sqlite.
The problem was that I had an old version already installed, but the system didn't tell me that!

# cd /usr/ports/www/trac
# make install clean

Installed /usr/local/lib/python2.5/site-packages/pytz-2009r-py2.5.egg
===> Registering installation for py25-pytz-2009r
===> Returning to build of trac-0.11.5
===> trac-0.11.5 depends on file: /usr/local/lib/python2.5/site-packages/_sqlite3.so - not found
===> Verifying install for /usr/local/lib/python2.5/site-packages/_sqlite3.so in /usr/ports/databases/py-sqlite3
===> Vulnerability check disabled, database not found
===> Extracting for py25-sqlite3-2.5.2_1
=> No MD5 checksum recorded for python/Python-2.5.2.tgz.
=> No SHA256 checksum recorded for python/Python-2.5.2.tgz.
=> No suitable checksum found for python/Python-2.5.2.tgz.
*** Error code 1

Stop in /usr/ports/databases/py-sqlite3.
*** Error code 1

Stop in /usr/ports/www/trac.
*** Error code 1

Stop in /usr/ports/www/trac.

I thought to myself, maybe I need to update the system.

# cvsup -g -L 2 /root/cvs-supfile

# make install clean

That did nothing, I get this same error. Maybe if I install it manually

cd /usr/ports/databases/py-sqlite3

root@host py-sqlite3 # make install clean
===> Vulnerability check disabled, database not found
===> Extracting for py25-sqlite3-2.5.2_1
=> No MD5 checksum recorded for python/Python-2.5.2.tgz.
=> No SHA256 checksum recorded for python/Python-2.5.2.tgz.
=> No suitable checksum found for python/Python-2.5.2.tgz.
*** Error code 1

Stop in /usr/ports/databases/py-sqlite3.

that didn't work either, so I tried

# pkg_add -R sqlite3

But the ftp server was wrong to get the correct port...

for sh you type in
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7-stable/Latest/

for bash you update the ftp location by typing
export PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7-stable/Latest/
export PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6-stable/Latest/

# pkg_add -r trac

That worked but this is where the Error shows me I have an old version of sqlite already installed!

...
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-7-stable/All/py26-sqlite3-2.6.4_1.tbz... Done.
pkg_add: warning: package 'py26-sqlite3-2.6.4_1' requires 'sqlite3-3.6.19', but 'sqlite3-3.5.6' is installed
...

so I upgrade my port that I do have.
# /usr/local/sbin/portupgrade -R sqlite3

---------
root@draco sqlite3 # cd /usr/ports/www/trac
root@draco trac # make install clean

Traceback (most recent call last):
File "setup.py", line 15, in
from setuptools import setup, find_packages
ImportError: No module named setuptools
*** Error code 1

Stop in /usr/ports/www/trac.
*** Error code 1

Stop in /usr/ports/www/trac.

3Mar/100

mysql replication error

MySQL replication broke after a server crash. When trying to start it backup this error shows up.

100303 10:09:54 [ERROR] Slave: Query caused different errors on master and slave. Error on master: 'Invalid error code' (126), Error on slave: 'no error' (0). Default database: 'db_name'. Query: 'INSERT DELAYED INTO stats (clientID, date_accessed, current_url, referred_by, unique_id)
VALUES (0, now(), '/index.php', '', '076c47a32066f611d60e107b3c6be475')', Error_code: 0
100303 10:09:54 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000463' position 207592

After a little searching, in order to fix the problem I just have to repair the table with the following command.

mysql> repair table stats;

In my case the query is fine, the reason why it is failing may be
index file is crashed or file format is wrong. Here is a list of error codes that may be helpful to other people.
126 = Index file is crashed / Wrong file format
127 = Record-file is crashed
132 = Old database file
134 = Record was already deleted (or record file crashed)
135 = No more room in record file
136 = No more room in index file
141 = Duplicate unique key or constraint on write or update
144 = Table is crashed and last repair failed
145 = Table was marked as crashed and should be repaired
28 = You ran out of disk space. Delete unnecesary files, or move the MySQL data files to another partition.
1045: Access denied for user: = You forgot to specify a password, or you used the wrong one. Use the -u and -p options when starting the client. (use mysql --help to see how)
1046: No Database Selected = You must use the command USE database_name or the mysql_select_db() function to select a database to use.
1062: Duplicate entry 'x' for key n = You have attempted to insert or update data that would break the integrity of a UNIQUE index (most likely the primary key). You must redefine either the data you're trying to insert, or the indexes which you have imposed on the table.
1064: Syntax error = You wrote something that doesn't match the syntax definitions in the manual. When you have checked everything else, here's something to consider: A common error is to put a space between a function name and its opening parenthesis '('. Another common error is to use a reserved word out of its normal context.
2000: parse error near ... = see explanation for 1064: Syntax error
2002: Can't connect to local MySQL server = The MySQL socket file (usually, /tmp/mysql.sock) is missing. See the notes on connecting to the server.

Filed under: Errors, MySQL, Unix No Comments
2Mar/100

Toronto ecommerce website

If your looking for the best Toronto E-commerce website professionals you should look at http://www.techtouch.ca

They've done a number of amazing websites that not only generate more traffic but also more revenue for the owners. Their basic SEO package is always included in any website package and can be expanded for high volume E-commerce website. The best part is that they are located in Toronto and will come to your office for a free consultation or any where in the Toronto area.

Toronto E-commerce website professional also make websites in PHP, HTML and CSS so you'll be covered at every point. Don't worry about the MySQL database they'll take care of that also.

Filed under: Errors No Comments