Apache2 Custom php.ini

Posted on Monday, April 19, 2010 in Linux

<VirtualHost 0.0.0.0:80>
[...]
PHPINIDir /var/www/example/config
[...]
</VirtualHost>

Unicode data in a Unicode-only collation

Posted on Thursday, April 15, 2010 in Linux, PHP

PHP Error on MSSQL query:
Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library

Edit /etc/freetds/freetds.conf (Ubuntu)
uncomment line:
;tds version = 4.2
and change to:
tds version = 8.0

WinRAR Command Line

Posted on Monday, April 12, 2010 in Application

Click here

Apache2 Authentication with htpasswd

Posted on Monday, April 5, 2010 in Linux

Create user/password file:
#htpasswd -c /var/www/example/cfg/.htpasswd example_username
Enter password

Use in .htaccess:
AuthType Basic
AuthName "Restricted Directory"
AuthUserFile /var/www/example/cfg/.htpasswd
Require user example_username

Add another user to .htpasswd file:
#htpasswd /var/www/example/cfg/.htpasswd example_user2

Create group auth file /var/www/example/cfg/.htgroup with text:
ExampleGroup: example_username example_user2

Use group access in .htaccess:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /var/www/example/cfg/.htpasswd
AuthGroupFile /var/www/example/cfg/.htgroup
Require group ExampleGroup

Use for virtual host:
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/example 
<Directory "/var/www/example">
AuthType Basic
AuthName "Restricted Directory"
AuthUserFile /var/www/example/cfg/.htpasswd
AuthGroupFile /var/www/example/cfg/.htgroup
Require group ExampleGroup
</Directory>
</VirtualHost>

Install Zend Optimizer

Posted on Monday, April 5, 2010 in Linux

Download ZendOptimizer.so and move to directory on server
Add to php.ini (/etc/php5/apache2/php.ini):
zend_extension=/example/zend/ZendOptimizer.so

Navicat HTTP Tunneling

Posted on Tuesday, March 30, 2010 in Application

1. Upload “/path_to_navicat_dir/ntunnel_mysql.php” to server
2. Setup Navicat connection properties->general with database params
3. Check connection properties->HTTP “Use HTTP Tunnel” and add “Tunnel URL:” (path to ntunnel_mysql.php)

Ubuntu Install PHP5 MSSQL

Posted on Tuesday, March 30, 2010 in Linux

Install works on Ubuntu 9.04
Install generic support for mssql:
#aptitude install php5-sybase
Install PEAR if not already installed:#aptitude install php-pear
Install entire mssql functions:#pear install --nodeps MDB2_Driver_mssql

Alias in WHERE Clause

Posted on Thursday, March 18, 2010 in MySQL

Aliases are not used in WHERE clause, instead they should be used in HAVING clause, like this:
SELECT customer_email, COUNT(customer_email) AS 'duplicate_customer_email'
FROM customers
WHERE customer_email != ''
GROUP BY customer_email
HAVING duplicate_customer_email > 1
ORDER BY duplicate_customer_email DESC

Outlook 7 Profile Location

Posted on Wednesday, March 17, 2010 in MS OS

C:\Documents and Settings\user\Local Settings\Application Data\Microsoft\Outlook

FTP Auto Sync

Posted on Wednesday, March 10, 2010 in MS OS

Download app:
Go to download

FTP Auto Sync Example:
Copy download files to C:\ftp

Setup C:\ftp\example.ini
[Source]
Type=F
Dir=C:\autouploads\
ExcludeDir=_*
ExcludeFile=_*;*.log
Case=Sensitive
DSTChange=201003140200
DSTDifference=60
[Destination]
Server=ftp.example.com
User=ftp_user
Pass=ftp_pwd
Dir=/auto/upload/dir/
Type=M
TimeOut=60
Passive=Yes

Now setup batch job that can be scheduled: upload.bat
cd C:\ftp
FTPSync example /FULL /QUIET

Can use “/DEBUG” to output log files

More docs here:
Docs