Ubuntu Symbolic Link

Posted on Thursday, April 29, 2010 in Linux

ln -s
From /var/www/example2:

#ln -s /var/www/example/httpdocs httpdocs

To remove link, delete directory/file

Disabling open_basedir Restriction

Posted on Thursday, April 29, 2010 in Linux

<Directory /var/www/vhosts/example_2.com/httpdocs>
php_admin_value open_basedir "/var/www/vhosts/example_2.com/
httpdocs:/var/www/vhosts/example.com/httpdocs:/tmp"
</Directory>

Add Ubuntu Directory Index

Posted on Tuesday, April 20, 2010 in Linux

Add directory index to:
/etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>
 DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

Ubuntu Logrotate

Posted on Monday, April 19, 2010 in Linux

Create logrotate file /etc/logrotate.d/example
/var/log/webserver/barsupply.log {
daily
rotate 7
missingok
compress
notifempty
#olddir will change log archive directory (not required)
olddir /var/log/example/archive
}

Register logrotate file:
#logrotate -f /etc/logrotate.d/example

View file status in logrotate:
/var/lib/logrotate/status

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

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

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

Empty Log File

Posted on Tuesday, March 9, 2010 in Linux

#> /var/www/domain/log/error_log