Previous | Up | Next |
RSD | RSD | RSD Coding Conventions |
It is essential to have a development system logically and physically sepearated from the productive system. Never do any development on the productive system! Too many people hackin' 'round on your productive system can become very dangerous because software developers are only human, and humands do make mistakes! Need an example? Here we go:
He did to fatal mistakes: he did not know the meaning of the -R switch of the rm command and he did not know that spaces need to be escaped. What he meant was 'rm www\ alias'. But instead of deleting the symlink he recursivly deleted the whole webroot! This example proves another thing: you need backups! A mirror implemented using rsync (or somthing like that) wont do any good because accidentially deleted files will be removed on the mirror as well (after the next sync).$ cd / $ ln -l drwxrwxr-- 2 someuser somegroup 4096 Jun 18 08:49 www lrwxrwxrwx 1 someuser somegroup 3 Jun 18 08:49 www alias -> www #now our (not very experienced) unix user somehow dislikes the symlink 'www alias' #therefor he wants to delete it $ rm -R www alias rm: cannot remove `alias': No such file or directory $ cd www -bash: cd: www: No such file or directory
Another reason why we need a development system is that we need a different configuration of the PHP engine for debugging purpose. The next two sections will describe the installation of RSD on the The Development System and on the The Productive System. System configuration issues will be discussed as well.
Go to http://www.mysql.com and download the latest stable binary package for your operating system. The installation is pretty easy.
Please see http://pear.php.net/manual/en/installation.php for details on this. In the command prompt cd to C:\php. Run go-pear.bat which creates pear.bat. Please make sure that you have the folling packages installed and that they are uptodate. Archive_Tar Auth DB Date File File_SearchReplace Net_SMTP Mail Mail_Mime PEAR Validate To install a package run
To upgrade runpear install <package>
pear upgrade <package>
All packages are installed to C:\php\pear. Make sure this directory is in your include path.pear upgrade <package>
include_path = "c:\php\PEAR;."
Please go to http://smarty.php.net and download the lates stable release of Smarty. It is recommended to move the smarty files in the directory C:\php\pear\Smarty. This allows you to include Smarty like this (if C:\php\pear is in your include path):
require_once('Smarty/Smarty.class.php');
You can install PHPDocumentor as a pear package using the command 'pear install PhpDocumentor'. PHPDocumentor is as well available for download at http://phpdoc.org. It is strongly recommended to use 1.2.0 or later. Please note that PHPDocumentor 1.2.0 requires PHP 4.3.0 or later.
Put the RSD directory anywhere in your webroot. You can move the directory 'framework' out of the webroot if you like. Just Make sure the path to the framework directory is in your include path. If you just put the RSD directory into C:\Programme\Apache Group\Apache\htdocs you would have to set the following include path in your php.ini:
include_path = "c:\php\PEAR;C:\Programme\Apache Group\Apache\htdocs\RSD\framework;."
Installing Auth_Container_RSDB: Auth_Container_RSDB is an extended container for PEAR::Auth based on Auth_Container_DB. Copy $RSD_DIR/framework/Auth_Container_RSDB/RSDB.php to the container directory of PEAR::Auth. On Unix this would be /usr/local/lib/php/Auth/Container/ by default. On Windows it would be C:\php\PEAR\Auth\Container\.
Edit rsdInit.php as you like! Change at least the option $eafConfigDefaults['copyright']!
Add the following lines to C:\Programme\Apache Group\Apache\conf\httpd.conf:
ScriptAlias /php4/ "C:/php/" Action application/x-httpd-php4 "/php4/php.exe" AddType application/x-httpd-php4 .php
It is strongly recommended to have the following configuration options in your php.ini (on most systems to be found in C:\WINNT or C:\WINDOWS).
RSD only requires include_path to be set correctly as described in Installing RSDregister_globals = Off magic_quotes_gpc = Off magic_quotes_runtime = Off magic_quotes_sybase = Off include_path = "c:\php\PEAR;C:\Programme\Apache Group\Apache\htdocs\RSD\framework;."
Go to http://www.mysql.com and download the latest stable binary package for your operating system. The installation is pretty easy.
On SuSE Linux you will have to install the package gdbm-devel first.# tar -xzvf apache_1.3.27.tar.gz # cd ./apache_1.3.27 # CFLAGS=-DEAPI; export CFLAGS; # ./configure --enable-module=all --enable-shared=max --enable-rule=EAPI # make # make install
On SuSE Linux you will have to install the package flex first. Copy /usr/local/src/php-4.3.2/php.ini-recommended to /usr/local/lib/php.ini.# tar -xzvf php-4.3.2.tar.gz # cd ./php-4.3.2 # CFLAGS=-DEAPI; export CFLAGS; # ./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql # make # make install
Please see http://pear.php.net/manual/en/installation.php for details on this. Please make sure that you have the folling packages installed and that they are uptodate. Archive_Tar Auth DB Date File File_SearchReplace Net_SMTP Mail Mail_Mime PEAR Validate To install a package run
To upgrade runpear install <package>
PEAR installs the packages into /usr/local/lib/php per default (which is not a bad choice).pear upgrade <package>
Please go to http://smarty.php.net and download the lates stable release of Smarty. It is recommended to move the smarty files in the directory /usr/local/lib/php/Smarty. This allows you to include Smarty like this (if /usr/local/lib/php is in your include path):
require_once('Smarty/Smarty.class.php');
You can install PHPDocumentor as a pear package using the command 'pear install PhpDocumentor'. PHPDocumentor is as well available for download at http://phpdoc.org. It is strongly recommended to use 1.2.0 or later. Please note that PHPDocumentor 1.2.0 requires PHP 4.3.0 or later.
Put the RSD directory anywhere in your webroot. You can move the directory 'framework' out of the webroot if you like. Just Make sure the path to the framework directory is in your include path. If you just put the RSD directory into /www you would have to set the following include path in your php.ini:
RSD needs write permissions in order to create files and directories!include_path = "/usr/local/lib/php:/www/RSD/framework:."
Installing Auth_Container_RSDB: Auth_Container_RSDB is an extended container for PEAR::Auth based on Auth_Container_DB. Copy $RSD_DIR/framework/Auth_Container_RSDB/RSDB.php to the container directory of PEAR::Auth. On Unix this would be /usr/local/lib/php/Auth/Container/ by default. On Windows it would be C:\php\PEAR\Auth\Container\.
Edit rsdInit.php as you like! Change at least the option $eafConfigDefaults['copyright']!
Add the following lines to your httpd.conf (most likely to be be found in /usr/local/apache/conf):
# module section LoadModule php4_module libexec/libphp4.so AddModule mod_php4.c # Document type section AddType application/x-httpd-php .php .wml .php3 .php4 AddType application/x-httpd-php-source .phps
Example httpd.conf:
yet to come
It is strongly recommended to have the following configuration options in your php.ini (located in /usr/local/src).
RSD only requires include_path to be set correctly as described in Installing RSD.register_globals = Off magic_quotes_gpc = Off magic_quotes_runtime = Off magic_quotes_sybase = Off ;this is a development system so we ;need all error information we can get error_reporting = E_ALL display_errors = On include_path = "/usr/local/lib/php:/www/RSD/framework:."
Example php.ini:
yet to come
To make the files on the development system accessible to anyone in your network Samba is the perfect solution. It allows you to access your files on the server from a Linux box as well as from Windows 95/98/NT/2K/XP. Please see http://www.samba.org for details. In order to make the files on the server accessible to MacOX 9 and MacOSX we need netatalk.
As mentioned in Installing RSD, RSD needs write permissions! So the user apache runs under must have write permissions in the web root. We cannot let all files be owned by the apache user - nor can we give write permissions to 'others'. So the apache user and all developers must be in the same (default) group and create files with a umask of 0664 and directories with a umask of 0775.
This is a sample samba configuration file:
# # /etc/samba/smb.conf is the main samba configuration file. See the manual page # of smb.conf and the included documentation in /usr/share/doc/packages/samba in # order to understand the options listed here and many more features. # # Lines in this file which starts with ; and # are ignored by samba while # parsing it. Therefor both signs mark a comment, but here we use a # to # indicate a real comment and ; for a deactivated option. To activate such a # feature just remove the leading semicolon. # # We suggest to use the command 'testparm' after any changes you made. # # Copyright (c) 1999-2003 SuSE Linux AG Nuernberg, Germany. # # Submit bugfixes or comments to http://www.suse.de/feedback/ # [global] workgroup = ENDLOS netbios name = ROCKETSCIENCE os level = 2 time server = Yes unix extensions = Yes encrypt passwords = Yes map to guest = Never log level = 3 # Do not log anything to syslog syslog = 0 #hosts allow = 192.168.1. security = share # CUPS is the current SuSE Linux default printing system. #printing = CUPS #printcap name = CUPS # These settings are a suggestion for a local network. See section # 'socket options' in the man page of smb.conf and socket(7). socket options = SO_KEEPALIVE IPTOS_LOWDELAY TCP_NODELAY # Change the value to Yes, if samba should act as a WINS server. wins support = No # Set these two parameters to your DOS code page and appropriate UNIX # character set. These values are for west European languages (Latin-9) # UNIX character and MS-DOS Latin 1 code page. ; client code page = 850 ; character set = ISO8859-15 # This is a simple measure against Nimba Worm. See README.Win32-Viruses veto files = /*.eml/*.nws/riched20.dll/*.{*}/ [homes] comment = Home Directories valid users = %S browseable = No read only = No create mask = 0600 directory mask = 0700 [www] comment = Shared Directory path = /www read only = No browseable = Yes create mask = 0664 directory mask = 0775
Add the following line in AppleVolumes.default for netatalk:
/www "www" mswindows,codepage:maccode.iso8859-1 allow:@nobody umask:0775
For obvious reasons we will discuss only issues concerning Linux on the productive system.
Please see Installing a Database: MySQL.
Please see Installing PHP and Apache. In production environments SSL often is a requirement. Download additional to PHP and Apache, mod_ssl from http://www.modssl.org and OpenSSL from http://www.openssl.org. The whole installation procedure looks like this:
# cd /usr/local/src # tar -xzvf apache_1.3.27.tar.gz # tar -xzvf mod_ssl-2.8.14-1.3.27.tar.gz # tar -xzvf php-4.3.2.tar.gz # tar -xzvf openssl-0.9.7b.tar.gz # cd mod_ssl-2.8.14-1.3.27 # ./configure --with-apache=/usr/local/src/apache_1.3.27 --with-eapi-only # cd ../apache_1.3.27 # CFLAGS=-DEAPI; export CFLAGS; # ./configure --enable-module=all --enable-shared=max --enable-rule=EAPI # make # make install # cd ../openssl-0.9.7b # ./config # make # cd ../mod_ssl-2.8.14-1.3.27 # ./configure --with-ssl=/usr/local/src/openssl-0.9.7b --with-apxs=/usr/local/apache/bin/apxs # make # make install # cd ../php-4.3.2 # CFLAGS=-DEAPI; export CFLAGS; # ./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql[=/usr/local/mysql/] # make # make install
Please see Installing PEAR.
Please see Installing Smarty.
All you need on the production system is the directory framework. Copy the contents of framework to /usr/local/lib/RSDFramework and put /usr/local/lib/RSDFramework in your include path.
Under no circumstances install PHPDocumentor on an production system!include_path = "/usr/local/lib/php:/usr/local/lib/RSDFramework:."
Installing Auth_Container_RSDB: Auth_Container_RSDB is an extended container for PEAR::Auth based on Auth_Container_DB. Copy $RSD_DIR/framework/Auth_Container_RSDB/RSDB.php to the container directory of PEAR::Auth. On Unix this would be /usr/local/lib/php/Auth/Container/ by default. On Windows it would be C:\php\PEAR\Auth\Container\.
RSD itself cannot be configured on the production system because all you use is the packages provided by RSD.
The following guidlines are strongly recommended.
# module section LoadModule php4_module libexec/libphp4.so AddModule mod_php4.c # Document type section AddType application/x-httpd-php .php .wml .php3 .php4 AddType application/x-httpd-php-source .phps <Directory /> Order deny,allow Deny from all Options None AllowOverride None </Directory> <FilesMatch "\.(inc|bak|save|sav|tpl|tpl\.php)$"> Order allow,deny Deny from all </FilesMatch>
Example httpd.conf:
yet to come
It is strongly recommended to have the following configuration options in your php.ini (located in /usr/local/src).
Applications created with RSD only require include_path to be set correctly.register_globals = Off magic_quotes_gpc = Off magic_quotes_runtime = Off magic_quotes_sybase = Off ;This is a productive system so we ;must not allow potential hackers ;to get too much information about ;our application. error_reporting = E_ALL display_errors = Off display_startup_errors = Off log_errors = On include_path = "/usr/local/lib/php:/usr/local/lib/RSDFramework:."
Example php.ini:
yet to come
Previous | Up | Next |
RSD | RSD | RSD Coding Conventions |
Documentation generated on Mon, 8 Dec 2003 13:09:43 +0100 by phpDocumentor 1.2.3