PHP-Nuke: Management and Programming Chris Karakas www.karakas-online.de Claudio Erba www.spaghettibrain.com Chris Karakas - Conversion from LyX to DocBook SGML, Index, document generation, PHP-Nuke module, see Credits Andre Purfield - Translation from italian (v.1.0) and translation project coordination, see Credits Fortunato Matarazzo - Translation from italian (v.1.0), see Credits Chris Karakas - Translation from italian (v.1.0), see Credits Revision History Revision 2.0 16.02.2004 Revised by: CK Added more than 400 pages of additional material. See Credits section for the exact details. Revision 1.2.1 22.08.2003 Revised by: CK Now available as PHP-Nuke module too. Link to the module source in the Formats section. Smaller logo. Revision 1.2 29.05.2003 Revised by: CK New logo, CSS stylesheet, HTML validation, footer icons. Incorporated LDP reviewer's comments. Created Aknowledgements and Availability of sources sections. Revision 1.1 13.02.2003 Revised by: AP Cleaned up the wording and a few typos. Revision 1.0 09.01.2003 Revised by: CK First complete version. Figure Figure There has always been the necessity to have a definitive guide on PHP-Nuke. This guide describes the installation and structure of PHP-Nuke and the details of customizing the front end to suit the users' needs. The architecture of PHP-Nuke, with its modules, blocks, topics and themes is presented in detail, as well as the interplay of PHP and MySQL for the creation of a mighty content management system (CMS).It also delves into more advanced issues, like the programming of PHP-Nuke blocks and modules, security, acceleration, and optimization. Day-to-day operations and miscellaneous topics are also covered. _________________________________________________________________ Table of Contents 1. Terms of distribution 1.1. Disclaimer 1.2. Formats 1.3. Licence 1.4. Availability of sources 1.5. Credits 1.5.1. Version 1.0 1.5.2. Versions 1.x 1.5.3. Version 2.0 1.5.4. General 1.6. Aknowledgements 1.7. Conventions 1.8. The book behind the book 1.8.1. The general idea 1.8.2. Line of attack 1.9. How to translate this HOWTO 2. Introduction to PHP-Nuke 2.1. Purpose 2.2. What Is PHP-Nuke 2.3. Short history of PHP-Nuke 2.4. The PHP-Nuke Communities 2.5. Why use PHP-Nuke and not static HTML pages 2.6. The PHP-Nuke forks 2.6.1. PHP-Nuke vs. Post-Nuke 2.6.2. PHP-Nuke vs. XOOPS 2.6.3. XOOPS vs. Post-Nuke 3. How to install PHP-Nuke 3.1. Prerequisites 3.2. Installation process 3.2.1. Download 3.2.2. Upload through FTP 3.2.3. File permissions 3.2.4. Database creation 3.3. How to install PHP-Nuke through phpMyAdmin 3.3.1. What Is PHPMyadmin 3.3.2. How to install phpMyAdmin 3.4. phpMyAdmin: How to administer MySQL via Web 3.4.1. phpMyAdmin navigation bar: Structure 3.4.2. phpMyAdmin navigation bar: SQL 3.4.3. phpMyAdmin navigation bar: Export 3.4.4. phpMyAdmin: other commands 3.4.5. How to install the DB of PHP-Nuke with PHPMyadmin 3.5. How to install PHP-Nuke using nukesql.php 3.6. How to install PHP-Nuke locally 3.6.1. easyPHP 3.6.2. XAMPP 3.6.3. Apache2Triad 3.6.4. Apache, PHP and MySQL on Mandrake Linux 3.6.5. Apache, PHP and MySQL on Red Hat Linux 3.7. The config.php file 3.7.1. More than one PHP-Nuke sites 3.8. Resources 3.9. Common installation problems 3.9.1. Test scripts 3.9.2. Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource 3.9.3. Call to undefined function: message_die() in db.php line 88 3.9.4. Error: Failed opening 'language/lang-.php' for inclusion 3.9.5. Fatal error: Failed opening required 'includes/sql_layer.php' 3.9.6. Sorry, such file doesn't exist... 3.9.7. Warning: setlocale(): Passing locale category name as string is deprecated 3.9.8. Security code is not showing up 3.9.9. Warning: Invalid argument supplied for foreach() in mainfile.php 3.9.10. Include path is wrong 3.9.11. Users don't receive any confirmation mails 3.9.12. Login loop 3.9.13. You have an error in your SQL syntax near '------------- 3.9.14. Error: Couldn't update private forum permissions 3.9.15. Invalid session in forums 3.9.16. You cannot create the administrator account 3.9.17. You lost the administrator password, or deleted the admin account 3.9.18. You get garbage in some parts of the page 3.9.19. Compressed output in forums 3.9.20. Warning: Cannot add header information...in forums 3.9.21. In Windows, you get an empty page 3.9.22. You get a lot of Notice lines in the output of PHP-Nuke 3.9.23. How to get a more descriptive error message 3.10. Common miscellaneous errors 3.10.1. RSS block Error: There is a current problem with the headlines from this site 3.10.2. MySQL errno: 145: Can't open file nuke_XXXX.MYI 3.10.3. Modules do not show up and/or disappear 3.10.4. Forums Error: Can't create a category without a name 3.10.5. Left and right blocks are missing 4. How to upgrade PHP-Nuke 4.1. From 6.0 to 6.5 4.1.1. Upgrade instructions for PHP-Nuke 6.0 without Tom's bbtonuke port 4.1.2. Upgrade instructions for PHP-Nuke 6.0 with Tom's 2.0.6 bbtonuke port 4.2. From phpBB to PHP-Nuke 4.3. PHP-Nuke upgrade scripts 5. How to move PHP-Nuke 5.1. Transferring a local installation to the Web 5.2. Changing Web hoster 6. Front end structure: user view 6.1. The preinstalled modules 6.2. Non-installed modules 6.3. The preinstalled blocks 7. Back end structure: administrator view 7.1. The administration functions 7.1.1. phpBB Forum administration 7.2. The Preferences Page 8. PHP-Nuke add-ons 8.1. Add-on themes 8.1.1. AutoTheme 8.2. Add-on blocks 8.2.1. Moon & Sun block 8.2.2. Meteosat block 8.2.3. Comic block 8.2.4. Menu Builder 8.2.5. Treemenu with PHP 8.2.6. Treemenu with Javascript 8.2.7. Google AdSense block 8.2.8. Random Quotes block 8.3. Add-on modules 8.3.1. Daily Comic module 8.3.2. Event calendar 8.3.3. NSN Your Account Tweak module 8.3.4. Approve Membership module 8.3.5. Gallery module 8.3.6. IP Tracking module 8.3.7. Protector module 8.3.8. WebCam module 8.3.9. My Headlines module 8.3.10. PHP-Nuke-Tools module 8.3.11. Upload module 8.3.12. Upload add-on for phpBB 8.3.13. ODP module 8.3.14. eCommerce module 8.3.15. WorkBoard Module 9. Architecture and structure 9.1. Directory structure 9.2. Main page management 9.3. Module management 9.4. Administration management 10. Session management 10.1. How sessions work in the forums 10.2. How to eliminate session checks 11. Editing PHP (-Nuke) files 11.1. vi 11.2. Emacs 11.3. Bluefish 11.4. UltraEdit 11.5. WinSyntax 11.6. HTMLKit 11.7. Crimson Editor 11.8. PHPEd 12. Modifying the PHP-Nuke database 12.1. More than 255 characters of user extra information 13. Modifying PHP-Nuke texts 13.1. General PHP-Nuke texts 13.2. PHP-Nuke module texts 13.3. PHP-Nuke module and block titles 14. Customising PHP-Nuke themes 14.1. Structure of a PHP-Nuke theme 14.2. Modifying the PHP-Nuke theme HTML template 14.2.1. Example creation of HTML file to include in the theme 14.3. Modifying the PHP-Nuke theme header 14.3.1. How to create a top navigation bar as in NukeNews theme 14.3.2. How to insert a Search Box as in SlashOcean theme 14.3.3. How to change the PHP-Nuke header depending on some global feature 14.3.4. How to change the logo in the PHP-Nuke header 14.3.5. How to change the logo's dimensions dynamically 14.3.6. How to change placement of the banner in the PHP-Nuke header 14.3.7. How to display a watermark background image 14.3.8. How to display a Flash object in the PHP-Nuke header 14.3.9. How to hide the left blocks 14.4. Modifying the PHP-Nuke theme body 14.4.1. How to get multipage News articles 14.4.2. How to change background colour 14.5. Modifying the PHP-Nuke theme index 14.6. Modifying the PHP-Nuke theme footer 14.6.1. How to insert an extra table to the right of the page 14.6.2. The PHP-Nuke Copyright notice 14.7. Modifying the PHP-Nuke theme icons 14.8. Theme construction: the rules to follow 14.9. How to change a buggy PHP-Nuke theme 14.10. How to prevent users from changing the theme in PHP-Nuke 14.11. How to change the PHP-Nuke theme depending on the module 14.12. How to change the font size in PHP-Nuke 15. Modifying the PHP-Nuke HTML header 15.1. How to implement a favourites icon (favicon.ico) 15.2. How to prevent the statistics module from gathering hits from certain hosts 16. Modifying mainfile.php 16.1. How to allow special HTML tags 16.2. How to change the order of messages 16.3. How to change the duration of a public broadcast message 17. Modifying PHP-Nuke blocks 17.1. How to change a buggy block 17.2. How to build custom module blocks 17.2.1. Simple module block 17.2.2. Treemenu block 17.3. How to build RSS blocks with variable number of news items 17.4. How to get scrolling headlines in blocks 18. Modifying PHP-Nuke modules 18.1. Modifying any PHP-Nuke module 18.1.1. How to hide the right blocks 18.1.2. How to change a buggy module 18.2. Modifying the PHP-Nuke Homepage 18.2.1. How to redirect users to the Login page 18.2.2. How to restrict the Homepage only to registered users 18.3. Modifying the PHP-Nuke FAQ module 18.3.1. How to add more than 127 FAQ answers 18.4. Modifying the PHP-Nuke Reviews module 18.4.1. How to allow only registered users to enter a review 18.4.2. How to choose images from a dropdown list 18.5. Modifying the PHP-Nuke Web_Links module 18.5.1. How to display Web Links in the same window 18.5.2. How to change the number of Web Links per page 18.6. Modifying the PHP-Nuke Your_Account module 18.6.1. How to redirect users to the Homepage 18.6.2. How to redirect Your Info to the Forums user profile 18.6.3. How to redirect users to Login and back 18.6.4. How to disable registration 18.6.5. How to let users register immediately 18.6.6. How to approve users before registration 18.6.7. How to register users through iBill 18.6.8. How to change the maximum allowed length for user names 18.7. Modifying the PHP-Nuke News module 18.7.1. How to get rid of the need to use
for new lines 18.8. Modifying the PHP-Nuke Submit News module 18.8.1. How to bypass article approval 18.9. Modifying the PHP-Nuke Sections module 18.9.1. How to order the articles in the Sections module 18.10. Modifying the PHP-Nuke Downloads module 18.10.1. How to add URLs longer than 100 characters in Downloads and Web Links 18.11. Modifying the PHP-Nuke Stories Archive module 18.11.1. How to order the articles in the Stories Archive module 19. Modifying the PHP-Nuke administration panel 19.1. How to set an arbitrary "Stories Number in Home" 19.2. How to allow HTML in the Newsletter 20. Creating PHP-Nuke blocks 20.1. The characteristics of the various types of blocks 20.2. How to create a new block 20.2.1. How to create a block, theoretical approach 20.2.2. How to create a block, a practical example 20.3. Simple Content block 20.4. How to include PHP/HTML files in a PHP-Nuke block 20.5. How to use Javascript in PHP-Nuke blocks 20.5.1. How to create a Hello World block 20.5.2. How to create a fade block 20.5.3. How to create a Help Center Live block 20.6. How to display Flash in PHP-Nuke blocks 20.7. How to show advertisements in PHP-Nuke blocks 20.8. How to display images in PHP-Nuke blocks 20.8.1. How to display random images in PHP-Nuke blocks 20.9. How to display HTML forms in a block: Paypal 21. Creating modules 21.1. Module structure 21.2. Creating fully compatible modules: the rules to follow 21.3. Module creation, the public part 21.4. Module creation, administrator part 21.5. How to include a HTML file in a PHP-Nuke module 21.6. How to include a HTML file and its links in a PHP-Nuke module 21.7. How to include a HTML file and its links using an iframe in a PHP-Nuke module 21.8. How to include a plain text file in a PHP-Nuke module 21.9. How to use Javascript in PHP-Nuke modules 21.9.1. Javascript functions in javascript.php 21.9.2. Complete Javascript code in modules 21.10. How to create a Logout module 21.11. How to show advertisements in PHP-Nuke modules 21.11.1. Google AdSense in the News module 21.11.2. Google AdSense on top of a PHP-Nuke module 21.12. How to display HTML forms in a module 22. Duplicating PHP-Nuke modules 22.1. Duplicating the PHP-Nuke FAQ module 23. Security 23.1. How secure is PHP-Nuke? 23.2. The impact of bad security record on software popularity 23.3. Common PHP-Nuke security vulnerabilities 23.3.1. Cross-site scripting with PHP-Nuke 23.3.2. SQL injection with PHP-Nuke 23.3.3. Path disclosure with PHP-Nuke 23.3.4. Cross-site tracing with PHP-Nuke 23.4. How to guard against security vulnerabilities in PHP-Nuke 23.4.1. Security fixes 23.4.2. Security measures 23.4.3. Security audit 23.4.4. Permissions on folders and files 23.4.5. Cookies - timeout and configuration 23.5. How to ban IP addresses 23.6. Hacked - now what? 24. Accelerating PHP-Nuke 24.1. Caching PHP-Nuke 24.1.1. jpcache 24.1.2. Cache-Lite 24.1.3. Turck MMCache 24.1.4. Caching PHP-Nuke: Conclusion 25. Optimizing PHP-Nuke 25.1. Search engines and dynamic URLs 25.1.1. Search engines and the GET method 25.2. mod_rewrite 25.2.1. API phases 25.2.2. Ruleset processing 25.2.3. Quoting special characters 25.2.4. Regex backreference availability 25.3. Regular expressions 25.4. The .htaccess file 25.5. How to make PHP-Nuke search engine friendly 25.5.1. GoogleTap 25.6. How to make PHP-Nuke hot link stealth 25.7. How to make a dynamic CSS 25.8. How to proceed when MySQL is slow 26. How to solve common probems with PHP-Nuke 26.1. How to repair a corrupt table 26.2. How to restore PHP-Nuke from backup 26.2.1. How to restore a single table 26.2.2. How to restore a large backup 26.3. How to install new modules 26.3.1. How to install modules that do not change the database structure 26.3.2. How to install modules that change the database structure 26.3.3. How to install modules that change the database structure and the files 26.4. How to install patches and correct errors 26.5. How to find all registration links 26.6. How to allow anonymous web link submissions 26.7. How to disable DEBUG mode 27. Miscellaneous 27.1. How to change the Home module 27.2. How to use PHP-Nuke under SSL 27.3. How to change PHP parameters when you don't have access to php.ini 27.4. How to display HTML code in a FAQ 27.5. How to enter thousands of web links 27.6. How to enter thousands of download links 27.7. How to check the validity of thousands of web links 27.8. How to enter thousands of ephemerids 27.9. How to make the Encyclopedia international 27.10. How to find the user name in a module 27.11. How to correct thousands of users fields 27.12. How to size the select boxes in a module 27.13. How to deal with date and time 27.13.1. How to find the last date of... 27.13.2. How to adjust server time 27.13.3. The Discordian Calendar 27.14. How to deal with quotes in the site's name 27.15. How to embed a Flash object in PHP-Nuke News 27.16. How to backup your MySQL database using only the browser 28. Programmer's tools 28.1. The database tables 28.2. The syntax of HTML code 28.2.1. How to format text in HTML 28.2.2. How to create a link in HTML 28.2.3. How to insert an image in HTML 28.2.4. How to create a table in HTML 28.3. The syntax of CSS 28.4. The syntax of PHP code 28.4.1. Variables 28.4.2. Functions 28.4.3. Switches 28.5. The syntax of SQL code 28.6. MySQL Front, how to administer a MySQL DB from Windows 28.7. Foxserv, making PHP-Nuke work on Windows Systems A. Appendix A.1. The GNU Free Documentation Licence A.1.1. PREAMBLE A.1.2. APPLICABILITY AND DEFINITIONS A.1.3. VERBATIM COPYING A.1.4. COPYING IN QUANTITY A.1.5. MODIFICATIONS A.1.6. COMBINING DOCUMENTS A.1.7. COLLECTIONS OF DOCUMENTS A.1.8. AGGREGATION WITH INDEPENDENT WORKS A.1.9. TRANSLATION A.1.10. TERMINATION A.1.11. FUTURE REVISIONS OF THIS LICENSE A.1.12. ADDENDUM: How to use this License for your documents Index List of Tables 6-1. Classification with topics and sections 14-1. tags in theme.php of various themes 16-1. Calls to filter_text from PHP-Nuke modules (v.6.8) 16-2. Calls to check_html from PHP-Nuke modules (v.6.8) 20-1. Help Center Live: setcookie() calls 21-1. Changing HTML links for use in a custom PHP-Nuke module 21-2. Alternative way of changing HTML links for use in a custom PHP-Nuke module 23-1. List of PHP-Nuke security vulnerabilities 25-1. URL replacement with replace_for_mod_rewrite(): dynamic to static. List of Figures 2-1. phpnuke.org, the official PHP-Nuke site. 3-1. WS_FTP: General connection parameters. 3-2. WS_FTP: Main screen with local and remote windows. 3-3. PHP-Nuke 6.0 file structure 3-4. WS_FTP context menu on right mouse click: chmod (UNIX) 3-5. WS_FTP Remote file permissions window 3-6. PHPMyAdmin start screen. 3-7. phpMyAdmin: Select database. 3-8. phpMyAdmin: Navigation bar. 3-9. phpMyAdmin: field functions. 3-10. phpMyAdmin: SQL function. 3-11. phpMyAdmin: database dump. 3-12. phpMyAdmin: table forum_topics. 3-13. phpMyAdmin: Create database. 3-14. phpMyAdmin: table structure and selection. 3-15. phpMyAdmin: SQL query. 3-16. phpMyAdmin: table data. 3-17. easyPHP: Installation screen. 3-18. easyPHP icon in the bottom bar. 3-19. phpinfo: PHP screen for a Windows system. 3-20. RPMdrake: selecting the Apache package(s) for installation. 3-21. Mandrake Control Center. 3-22. Red Hat Menu: Packages. 3-23. Red Hat: Package Sections. 3-24. Red Hat: Service Configuration Panel. 3-25. analyze.php: MySQL connection transcript. 3-26. analyze.php: MySQL security warning. 3-27. Modules administration panel. 3-28. Security code in the User Login screen. 3-29. phpinfo(): GD library information. 3-30. analyze.php: GD library information. 3-31. User Login screen. 3-32. Administration panel: Forums. 3-33. Administration panel: Forums. 3-34. Administration panel: Edit Admins. 3-35. Administration panel: Edit Admins. 3-36. phpMyAdmin: field functions. 3-37. Gzip compression in the Admin Panel of the Forums module. 3-38. Administration panel: Modules. 3-39. Missing blocks. 6-1. PHP-Nuke Homepage 6-2. Classifying articles 6-3. Downloads module 6-4. Private messages 6-5. Search module 6-6. Statistics module 6-7. Your account 6-8. Splatt Forum. 6-9. phpBB Forum. 6-10. The standard Modules block 6-11. Waiting Content block. 6-12. Who Is Online block. 6-13. Languages block. 6-14. Surveys block. 6-15. Login block. 7-1. Administration panel. 7-2. Administration panel: Add story. 7-3. Attaching a poll to an article awaiting admission. 7-4. Article Poll block. 7-5. Administration panel: Backup DB. 7-6. Administration panel: Banners. 7-7. Administration panel: Blocks. 7-8. Administration panel: Content. 7-9. Administration panel: Downloads. 7-10. Administration panel: Edit Admins. 7-11. Administration panel: Edit Users. 7-12. Administration panel: Encyclopedia. 7-13. Administration panel: Ephemerids. 7-14. Administration panel: FAQ. 7-15. Administration panel: Forums. 7-16. Administration panel: HTTP Referers. 7-17. Administration panel: Messages. 7-18. Administration panel: Modules. 7-19. Modules administration panel. 7-20. Administration panel: Newsletter. 7-21. Administration panel: Optimize DB. 7-22. Administration panel: Preferences. 7-23. Administration panel: Reviews. 7-24. Administration panel: Sections. 7-25. Administration panel: Submissions. 7-26. Administration panel: Surveys. 7-27. Administration panel: Topics. 7-28. Administration panel: Add a new topic. 7-29. Administration panel: Web Links. 7-30. Administration panel: Logout. 7-31. Administration panel: Forums. 7-32. Administration panel: Preferences. 7-33. General site info in the Preferences page. 7-34. Icons in the footer. 7-35. WebMail service options in the Preferences page. 8-1. Moon, Moon & Sun and Sun blocks. 8-2. Meteosat block. 8-3. Menu block with Menu Builder. 8-4. Treemenu block with PHP. 8-5. Treemenu block with Javascript. 8-6. Modules block. created with Sommaire Paramétrable. 8-7. Random Quotes block. 8-8. Event Calendar 8-9. Calendar1 Block 8-10. Calendar2 Block 8-11. Calendar3 Block 8-12. Calendar4 Block 8-13. Calendar5 Block 8-14. Extra options for user management in the NSN Your Account Tweak module. 8-15. Pending applications in the Approve Membership module. 8-16. Approval message in the Approve Membership module. 8-17. E-mail management in the Approve Membership module, part I. 8-18. E-mail management in the Approve Membership module, part II. 8-19. Gallery module. 8-20. Gallery related files at nukedgallery. 8-21. IP Tracking module: IP Tracking Info. 8-22. IP Tracking module: Page View Info. 8-23. camPortal block. 8-24. camPortal module. 8-25. ConquerCam: main window with the Options dialog opened up. 8-26. MyHeadlines Box containing syndicated content. 8-27. MyHeadlines: Subscribing to News sources. 8-28. PHP-Nuke Tools block 8-29. PHP-Nuke Tools module: Module Creator. 8-30. Upload module. 8-31. ODP module. 8-32. Calloways Cart module: Add Product screen. 8-33. Administration panel: WorkBoard. 8-34. WorkBoard module: Administration panel. 9-1. PHP-Nuke directory structure. 12-1. Extra Info field of User Personal Information (Your Info) 14-1. Structure of the NukeNews theme. 14-2. Structure of other themes, without HTML templates. 14-3. Top navigation bar in the NukeNews theme. 14-4. News article: "posted by" does not mean "submitted by". 16-1. Administration panel: Messages. 17-1. The standard Modules block 17-2. The standard Modules block. 17-3. Treemenu Block. 17-4. Treemenu Block with "Links" expanded. 17-5. Treemenu Block with "My work" expanded. 17-6. Treemenu Block with "Linux" expanded. 18-1. Administration panel: Modules. 18-2. Administration panel: FAQ. 18-3. Administration panel: Reviews. 18-4. Administration panel: Web Links. 18-5. Your Info link in the User Preferences panel. 18-6. Forum Profile link in the Forums module. 18-7. User profile in Your Info. 18-8. User profile in the Forums. 18-9. Administration panel: Add story. 18-10. Administration panel: Submissions. 18-11. Waiting Content block. 18-12. Administration panel: Sections. 18-13. Administration panel: Downloads. 18-14. Administration panel: Add story. 19-1. Administration panel. 19-2. Administration panel: Preferences. 19-3. Administration panel: Newsletter. 20-1. Administration panel: Blocks. 20-2. Block example 20-3. Administration panel: Content. 20-4. Hello World block with Javascript. 20-5. Help Center Live: Main screen. 20-6. Help Center Live block: Live Support is Offline. 20-7. Help Center Live block: Creating a trouble ticket. 20-8. Help Center Live block: Live Support is Online. 20-9. Help Center Live block: Request monitor for the operator. 20-10. Help Center Live block: User notification of the operator's chat request. 20-11. Help Center Live block: User chat request. 20-12. PayPal donation button 20-13. PayPal donation block. 21-1. PHPMyAdmin: inserting values 21-2. Example module. 21-3. PHP-Nuke HOWTO included in a module with the help of an iframe. 21-4. Logout link in the Modules block. 23-1. PHP security warning from analyze.php. 23-2. Site key security warning from analyze.php. 23-3. WebMail security warning from analyze.php. 24-1. Accelerating PHP-Nuke. 24-2. Optimizing PHP code execution. 24-3. Powered by jpcache. 24-4. Cache-Lite is powered by PEAR. 24-5. Turck MMCache. 25-1. Apache section of the phpinfo() output: mod_rewrite is loaded. 25-2. mod_rewrite: The control flow through the rewriting ruleset 25-3. mod_rewrite: The back-reference flow through a rule. 25-4. Pattern matching with a regular expression. 26-1. Administration panel: Backup DB. 26-2. Administration panel: Backup DB. 26-3. phpMyAdmin: SQL query. 26-4. Administration panel: Modules. 26-5. Administration panel: Web Links. 27-1. Administration panel: Modules. 27-2. Modules administration panel. 27-3. Administration panel: FAQ. 27-4. Administration panel: Web Links. 27-5. Administration panel: Downloads. 27-6. Administration panel: Web Links. 27-7. Administration panel: Ephemerids. 27-8. Administration panel: Encyclopedia. 27-9. Administration panel: Downloads. 27-10. Downloads: Add download. 27-11. Downloads: Add download. 27-12. Downloads: Main categories with last download date. 27-13. Your Info profile: Timezone and Date settings. 28-1. CSS page area model. 28-2. MySQL Front: Connection 28-3. MySQL Front: export tables 28-4. MySQL Front: SQL Query _________________________________________________________________ Chapter 1. Terms of distribution 1.1. Disclaimer No liability for the contents of this documents can be accepted. Use the concepts, examples and other content at your own risk. As this is a new edition of this document, there may be errors and inaccuracies, that may of course be damaging to your system. Proceed with caution, and although this is highly unlikely, the author does not take any responsibility for that. All copyrights are held by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. Naming of particular products or brands should not be seen as endorsements. _________________________________________________________________ 1.2. Formats Tip Include the PHP-Nuke HOWTO as a module in your PHP-Nuke site! You can include the PHP-Nuke HOWTO in your PHP-Nuke site as a module using either the method of Section 21.6 or the method of Section 21.7! To use the method of Section 21.6, download the PHP-Nuke module version of the PHP-Nuke HOWTO and install it according to the instruction in the accompanying INSTALL file. To use the method of Section 21.7, just make a module with an index.php file exactly as in the example shown there. It will show the starting page of the PHP-HOWTO in an iframe (Figure 21-3) and you will be able to navigate its pages without installing anything locally. You have Chris' explicit permission for this. Inline graphic This document is available in the following formats: * HTML (HyperText Markup Language), many HTML files (one for every section), for viewing with any browser * HTML (HyperText Markup Language), one big HTML file * PHP-Nuke Module * TXT (ASCII Text) * RTF (Rich Text Format) * PDF (Portable Document Format) * PS.GZ (Compressed Postscript) * SGML (Standard Generalized Markup Language), (with the Appendix) * LYX (LaTeX frontend LyX), (with the Appendix) Important IMPORTANT: Downloads for offline reading! If you want to download the HTML or RTF formats for offline reading, you will need to download the images as well - PNG for HTML and BMP for RTF, including the callouts! To save you the hassle, I have compiled the following zipped tar archives for offline reading: * TAR.GZ (Compressed TAR Archive), many HTML files with images * TAR.GZ (Compressed TAR Archive), one big HTML file with images * TAR.GZ (Compressed TAR Archive), SGML file with images * TAR.GZ (Compressed TAR Archive), RTF file with images A tarball containing all the above formats, including images, is also available: * TAR.GZ (Compressed TAR Archive), All files _________________________________________________________________ 1.3. Licence Copyright © version 1.0 2002 by Claudio Erba. Copyright © version 2.0 2004 by Chris Karakas and Claudio Erba. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be found in Section A.1, as well as at the GNU Free Documentation License. Original version 1.0 by Claudio Erba, webmaster of spaghettibrain, PHP-Nuke italian Mirror, 2002. Second, revised and expanded, version 2.0 2004 by Chris Karakas and Claudio Erba (see Section 1.5 for details). This book, in all its versions (also those modified from third parties in italian, english or whichever other language), for will of the authors, may be reproduced also integrally without violating any law in asmuch as this book is released under the GNU Free Documentation License, see Section A.1. This book: * May be modified partially or integrally creating manuals for companies, agencies or persons who deal with formatting, changing either the diagram or the contents or the pagination. * May be distributed either in its original or in modified form, or either in electronic or in paper format from either field periodicals or not, Internet sites and whichever other medium. * May be used as internal manual by companies, public or private agencies, or universities . * May be used distributed by universities as a hand-out. * May even be resold without having to recognize any type of royalty to the authors on the condition that the purchasers be granted the freedom of making even integral copies, redistribute or resell them. _________________________________________________________________ 1.4. Availability of sources See Section 1.2 for the modifiable sources of this document. These are the official versions. We (the authors, translators and current maintainers) plan to continue work on this document and add new chapters and enhancements. If you want to see the version we are currently working on (the "bleeding edge" version), check PHP-Nuke: Management and Programming from time to time. The modifiable sources of Claudio's text (in italian), the images and example files are available in sxi format (OpenOffice Impress)[1] on Downloads Area PHPNuke BOOK - LIBRO on spaghettibrain. _________________________________________________________________ 1.5. Credits This section documents the efforts that have been invested into this document by its authors, contributors and the community. We tried hard to give credit where credit is due. However, this does not mean that we used only the sources mentioned explicitly here, in this section. Numerous other sources of information have been used, mainly Forums, such as: * PHP-Nuke Forum of Chris Karakas. * spaghettibrain of Claudio Erba. * nukeforums * nukecops Whenever a source has been used, we have included a link to it. Thus, depending on the context, you should interpret the links in this document not only as a source of further information on a subject, but also as Credit and a "Thank you" for the idea, the explanation, the discussion or the piece of code it offers. If you feel we have ovelooked something, please feel free to contact us. We do not offer a Bibliography, as strict academic criteria would require, but this may change in the future, as Chris is working on a solution to the Bibliography problem in the context of LyX and SGML. Tip How to enter hundreds of references in LyX If you look in the following Section 1.5.1, Section 1.5.2 and especially Section 1.5.3, you will notice the exceptionally large number of cross-references that had to be entered. Although a single cross-reference is inserted very easily in LyX (just choose Insert->Cross-reference from the menu, then choose the label of the reference you want), it becomes a real pain if you have to enter hundreds of them, as in our case. Chris' solution to this was to write a script that reads a LyX file and outputs another LyX file that contains references to all labels of the first one. It was easier to copy the references from the file thus created, paste them in Section 1.5.3(which deals with version 2.0), then delete references to parts that already existed in version 1.0, than try to insert references to all new parts of version 2.0 by using the menu. You can read about Chris' script in Mass insertion of cross-references in LyX. _________________________________________________________________ 1.5.1. Version 1.0 This book started in version 1.0 as a document in italian language, written by Claudio Erba. It contained: * Chapter 1, consisting of Section 1.1, Section 1.2, Section 1.3, Section 1.4 and Section 1.6. This was Chapter 1 of version 1.0. * Chapter 2, consisting of Section 2.1, Section 2.2, Section 2.3, Section 2.4, and Section 2.5. This was Chapter 2 of version 1.0. * Chapter 6, consisting of Section 6.1, a section on AvantGO, now removed, Section 6.2 and Section 6.3. This was Chapter 3 of version 1.0. * Chapter 7, consisting of Section 7.1 and Section 7.2. This was Chapter 4 of version 1.0. * Chapter 3 consisting of Section 3.2, Section 3.2.1, Section 3.2.2, Section 3.2.3, Section 3.3, Section 3.3.1, Section 3.4.5, Section 3.7 and Section 3.8. This was Chapter 5 of version 1.0. * Chapter 9, consisting of Section 9.1, Section 9.2, Section 9.3, and Section 9.4. This was Chapter 6 of version 1.0. * Chapter 14, consisting of Section 14.1, Section 14.2, Section 14.2.1 and Section 14.8. This was Chapter 7 of version 1.0. * Chapter 20, consisting of Section 20.1, Section 20.2, Section 20.2.1, Section 20.2.2. This was Chapter 8 of version 1.0. * Chapter 21, consisting of Chapter 21, Section 21.1, Section 21.2, Section 21.3 and Section 21.4. This was Chapter 9 of version 1.0. * Chapter 23, consisting of Section 23.4.4, Section 23.4.5 and Section 23.4.5.1. This was Chapter 10 of version 1.0. * Chapter 28, consisting of Section 28.1, Section 28.5, Section 3.4, Section 3.3.1, Section 3.3.2, Section 28.6 and Section 28.7. This was Chapter 11 of version 1.0. Version 1.0 came with the following figures: * Figure 6-1, Figure 6-2, Figure 6-3, Figure 6-4, Figure 6-5, Figure 6-6, Figure 6-7, Figure 6-8, Figure 7-1, a screenshot of the News articles that has been removed, Figure 3-3, Figure 3-6, Figure 3-14, Figure 3-15, Figure 3-16, Figure 3-11, Figure 20-2, Figure 21-1, Figure 21-2, Figure 3-12, Figure 28-2, Figure 28-3, Figure 28-4. Version 1.0 contained no tables. Andre Purfield of Open Source Solutions started the translation project (see the PHP-Nuke book translation thread at nukeforums) and coordinated the work of the translators. Fortunato Matarazzo made the transaltion of the version 1.0 Chapters 7, 8 and 9 (see above). Chris Karakas translated the rest. Andre imported Fortunato's part into LyX, remade many of the screenshots and also made corrections to the english text of the whole document. Chris imported his part in LyX, formatted the whole document, created the Index and processed the LyX file through his scripts (see Section 1.8, for details) to render all the versions and files available from Section 1.2. Chris also made PNG, PDF (encapsulated PDF), EPS (encapsulated Postscript) and BMP versions of all figures. The PDF and EPS versions are included in the PDF and PS versions of the document respectively. The PNG and BMP versions are used by the HTML and RTF versions of the document respectively and are supplied separately in the images folder. _________________________________________________________________ 1.5.2. Versions 1.x In the 1.x versions, various improvements have been made on the document, as can be seen in the Revision History in the front page: * Version 1.1: Andre Purfield of Open Source Solutions cleaned up the wording and a few typos. * Version 1.2: Chris Karakas made various improvements: + Added a new logo. + Added a CSS stylesheet for DocBook. + Took care of HTML validation (all HTML pages now are validated as conforming to the HTML 4.01 Transitional standard[2]). + Added footer icons that have the following property: if you click on them, they validate, depending on the icon, either the HTML code or the CSS code of the page being currently viewed. + Added translation links in the header and footer: in the header of each page, you will find links to Google's automatic translation of that page into 5 languages - french, german, italian, portuguese and spanish. In the footer of each page, on the other hand, you will find links to Alta Vista's automatic "Babelfish" translation of that page into 8 languages: chinese, german, japanese, korean, french, italian, portuguese and spanish. + Incorporated LDP reviewer's comments. + Created Section 1.4 and Section 1.6. * Version 1.2.1: Chris created the PHP-Nuke HOWTO module for PHP-Nuke, a module that integrates this HOWTO into your PHP-Nuke site (you could install this module too, tip, tip!). Chris added a link to it in the Formats section (Section 1.2) and made a smaller logo. Due to Chris' efforts, starting from version 1.2 this document is an official HOWTO of the Linux Documentation Project. Also, starting from PHP-Nuke version 6.7 FINAL, this document is included in the docs folder of the standard PHP-Nuke package, as the official PHP-Nuke guide. In all 1.x versions after 1.0, the original italian text has undergone no changes other than those related to translation. But behind the scenes, Chris and Claudio were working fervently for the next version 2.0, which was going to bring dramatic improvements, as you can read in Section 1.5.3. Inline graphic _________________________________________________________________ 1.5.3. Version 2.0 In version 2.0, Chris Karakas added the following Chapters and Sections: * In Chapter 1: Section 1.5, Section 1.5.1, Section 1.5.2, Section 1.5.3, Section 1.5.4, Section 1.7, Section 1.8, Section 17.2.2.1, Section 1.8.2 and Section 1.9. * In Chapter 2: Section 2.6, Section 2.6.1, Section 2.6.2 and Section 2.6.3. * In Chapter 3: Section 3.1, Section 3.2.4, Section 3.6, Section 3.6.2, Section 3.6.3, Section 3.7.1, Section 3.7.1.1, Section 3.7.1.2, Section 3.9, Section 3.9.1, Section 3.9.1.1, Section 3.9.1.2, Section 3.9.1.3, Section 3.9.2, Section 3.9.3, Section 3.9.4, Section 3.9.5, Section 3.9.6, Section 3.9.7, Section 3.9.8, Section 3.9.8.1, Section 3.9.9, Section 3.9.10, Section 3.9.11, Section 3.9.12, Section 3.9.13, Section 3.9.14, Section 3.9.15, Section 3.9.16, Section 3.9.17, Section 3.9.18, Section 3.9.19, Section 3.9.20, Section 3.9.21, Section 3.9.22, Section 3.9.23, Section 3.10, Section 3.10.1 and Section 3.10.2, Section 3.10.3, Section 3.10.4 and Section 3.10.5. * In Chapter 4: Section 4.1, Section 4.1.1, Section 4.1.2, Section 4.2. * In Chapter 5: Section 5.1 and Section 5.2. * The whole Chapter 8: Section 8.1, Section 8.1.1, Section 8.2, Section 8.2.1, Section 8.2.2, Section 8.2.3, Section 8.2.4, Section 8.2.5, Section 8.2.6, Section 8.2.7, Section 8.2.8, Section 8.3, Section 8.3.1, Section 8.3.2, Section 8.3.3, Section 8.3.4, Section 8.3.5, Section 8.3.6, Section 8.3.7, Section 8.3.8, Section 8.3.9, Section 8.3.10, Section 8.3.11, Section 8.3.12, Section 8.3.13, Section 8.3.14 and Section 8.3.15. * The whole Chapter 10: Section 10.1 and Section 10.2. * The whole Chapter 11: Section 11.1, Section 11.2, Section 11.3, Section 11.4, Section 11.5, Section 11.6, Section 11.7, Section 11.8 (FIXME: Well, this may not be finished by the time version 2.0 is released, but the will to write it was certainly there! :-) ). * The whole Chapter 12: Section 12.1. * The whole Chapter 13: Section 13.1, Section 13.2, and Section 13.3. * In Chapter 14: Section 14.3, Section 14.3.1, Section 14.3.2, Section 14.3.3, Section 14.3.4, Section 14.3.5, Section 14.3.6, Section 14.3.7, Table 14-1, Section 14.3.8, Section 14.3.9, Section 14.4, Section 14.4.1, Section 14.4.2, Section 14.5, Section 14.6, Section 14.6.1, Section 14.6.2, Section 14.7, Section 14.9, Section 14.10, Section 14.11 and Section 14.12. * The whole Chapter 15: Section 15.1 and Section 15.2. * The whole Chapter 16: Section 16.1, Section 16.2 and Section 16.3. * The whole Chapter 17: Section 17.1, Section 17.2, Figure 17-1, Section 17.2.1, Section 17.2.2, Figure 17-2, Section 17.2.2.1, Figure 17-3, Figure 17-4, Figure 17-5, Figure 17-6, Section 17.2.2.2, Section 17.3 and Section 17.4. * The whole Chapter 18: Section 18.1, Section 18.1.1, Section 18.1.2, Section 18.2, Section 18.2.1, Section 18.2.2, Section 18.3, Section 18.3.1, Section 18.4, Section 18.4.1, Section 18.4.2, Section 18.5, Section 18.5.1, Section 18.5.2, Section 18.6, Section 18.6.1, Section 18.6.2, Section 18.6.3, Section 18.6.4, Section 18.6.5, Section 18.6.6, Section 18.6.7, Section 18.6.8, Section 18.7, Section 18.7.1, Section 18.8, Section 18.8.1, Section 18.8.1.1, Section 18.9, Section 18.9.1, Section 18.10, Section 18.10.1, Section 18.11 and Section 18.11.1. * The whole Chapter 19: Section 19.1 and Section 19.2. * In Chapter 20: Section 20.3, Section 20.4, Section 20.5, Section 20.5.1, Section 20.5.2, Section 20.5.3, Table 20-1, Section 20.7, Section 20.8, Section 20.8.1, Section 20.9. * In Chapter 21: Section 21.5, Section 21.6, Table 21-1, Table 21-2, Section 21.7, Section 21.8, Section 21.9, Section 21.9.1, Section 21.9.2, Section 21.10, Section 21.11, Section 21.11.1, Section 21.11.2, Section 21.12, * The whole Chapter 22: Section 22.1. * In Chapter 23: Section 23.1, Section 23.2, Section 23.3, Section 23.3.1, Section 23.3.2, Section 23.3.3, Section 23.3.4, Section 23.4, Section 23.4.1, Section 23.4.2, Section 23.4.3, Section 23.4.4 (some changes), Section 23.4.5.2, Section 23.5 and Section 23.6. * The whole Chapter 24: Section 24.1, Section 24.1.1, Section 24.1.1.1, Section 24.1.1.2, Section 24.1.1.3, Section 24.1.2, Section 24.1.2.1, Section 24.1.2.2, Section 24.1.3, Section 24.1.3.1, Section 24.1.3.1, Section 24.1.3.3 and Section 24.1.4. * The whole Chapter 25: Section 25.1, Section 25.1.1, Section 25.2, Section 25.2.1, Section 25.2.2, Section 25.2.3, Section 25.2.4, Section 25.3, Section 25.4, Section 25.5, Section 25.5.1, Section 25.5.1.1, Section 25.5.1.2, Section 25.5.1.3, Table 25-1, Section 25.6 and Section 25.7. * In Chapter 26: Section 25.8, Section 26.1, Section 26.5, Section 26.6 and Section 26.7. * The whole Chapter 27: Section 27.1, Section 27.2, Section 27.3, Section 27.4, Section 27.5, Section 27.6, Section 27.7, Section 27.8, Section 27.9, Section 27.10, Section 27.11, Section 27.13, Section 27.13.1, Section 27.13.2, Section 27.13.3, Section 27.14, Section 27.15 and Section 27.16. In version 2.0, Claudio Erba added the following Chapters and Sections: * In Chapter 3: Section 3.4, Section 3.4.1, Section 3.4.2, Section 3.4.3, Section 3.4.4, Section 3.5, Section 3.6.1, Section 3.6.1.1, Section 3.6.4 and Section 3.6.5. * In Chapter 4: The introductory text (Chapter 4) and Section 4.3. * In Chapter 6: A lot of additions and improvements in the whole chapter: Section 6.1, Section 6.2, Section 6.3. * In Chapter 7: A lot of additions and improvements in the whole chapter: Section 7.1, Section 7.1.1 (which was added in this version) and Section 7.2. * In Chapter 9: Some changes in Section 9.1 and Section 9.2. * In Chapter 26: Section 26.2, Section 26.2.1, Section 26.2.2, Section 26.3, Section 26.3.1, Section 26.3.2, Section 26.3.3 and Section 26.4. * In Chapter 28: Section 28.2, Section 28.2.1, Section 28.2.2, Section 28.2.3, Section 28.2.4, Section 28.3, Section 28.4, Section 28.4.1, Section 28.4.2 and Section 28.4.3. Note Note As you can see, almost all labels of version 1.0 have been preserved in version 2.0 too. More specifically, all labels that give rise to HTML files have been preserved in the LyX file. That's no coincidence: Cool labels don't change! Chris translated Claudio's additions from italian and inserted some additions and many cross-references. On the other hand, some of Claudio's information has found its way in the sections added by Chris. We have added the GNU Free Documentation Licence in the Section A.1. The following figures have been added in version 2.0: * Chris added: Figure 3-4, Figure 3-5, Figure 3-25, Figure 3-26, Figure 3-27, Figure 3-28, Figure 3-29, Figure 3-30, Figure 3-31, Figure 3-32, Figure 3-33, Figure 3-34, Figure 3-35, Figure 3-37, Figure 3-38, Figure 3-39, Figure 6-9, Figure 6-10, Figure 6-11, Figure 6-13, Figure 7-2, Figure 7-3, Figure 7-4, Figure 7-5, Figure 7-6, Figure 7-7, Figure 7-8, Figure 7-9, Figure 7-10, Figure 7-11, Figure 7-12, Figure 7-13, Figure 7-14, Figure 7-15, Figure 7-16, Figure 7-17, Figure 7-18, Figure 7-19, Figure 7-20, Figure 7-21, Figure 7-22, Figure 7-23, Figure 7-24, Figure 7-25, Figure 7-26, Figure 7-27, Figure 7-29, Figure 7-30, Figure 7-31, Figure 7-32, Figure 7-33, Figure 7-34, Figure 7-35, Figure 8-1, Figure 8-2, Figure 8-3, Figure 8-4, Figure 8-5, Figure 8-6, Figure 8-7, Figure 8-8, Figure 8-9, Figure 8-10, Figure 8-11, Figure 8-12, Figure 8-13, Figure 8-14, Figure 8-15, Figure 8-16, Figure 8-17, Figure 8-18, Figure 8-19, Figure 8-20, Figure 8-21, Figure 8-22, Figure 8-23, Figure 8-24, Figure 8-25, Figure 8-26, Figure 8-27, Figure 8-28, Figure 8-29, Figure 8-30, Figure 8-31, Figure 8-32, Figure 8-33, Figure 8-34, Figure 12-1, Figure 14-3, Figure 14-4, Figure 16-1, Figure 17-1, Figure 17-2, Figure 17-3, Figure 17-4, Figure 17-5, Figure 17-6, Figure 18-2, Figure 18-3, Figure 18-4, Figure 18-5, Figure 18-6, Figure 18-7, Figure 18-8, Figure 18-9, Figure 18-10, Figure 18-11, Figure 18-12, Figure 18-13, Figure 18-14, Figure 19-1, Figure 19-2, Figure 19-3, Figure 20-1, Figure 20-3, Figure 20-4, Figure 20-5, Figure 20-6, Figure 20-7, Figure 20-8, Figure 20-9, Figure 20-10, Figure 20-11, Figure 20-12, Figure 20-13, Figure 21-3, Figure 21-4, Figure 23-1, Figure 23-2, Figure 23-3, Figure 24-1, Figure 24-2, Figure 24-3, Figure 24-4, Figure 24-5, Figure 25-1, Figure 25-2, Figure 25-3, Figure 25-4, Figure 26-1, Figure 26-3, Figure 26-4, Figure 26-5, Figure 27-1, Figure 27-2, Figure 27-3, Figure 27-4, Figure 27-5, Figure 27-6, Figure 27-7, Figure 27-8, Figure 27-9, Figure 27-10, Figure 27-11, Figure 27-12, Figure 27-13 and Figure 28-1. * Claudio added: Figure 2-1, Figure 3-1, Figure 3-2, Figure 3-7, Figure 3-8, Figure 3-9, Figure 3-10, Figure 3-13, Figure 3-17, Figure 3-18, Figure 3-19, Figure 3-20, Figure 3-21, Figure 3-22, Figure 3-23, Figure 3-24, Figure 3-36, Figure 6-12, Figure 6-14, Figure 6-15, Figure 7-28, Figure 9-1, Figure 14-1, Figure 14-2, Figure 26-2 and Figure 27-2. Again, as in version 1.0, Chris made PNG, PDF (encapsulated PDF), EPS (encapsulated Postscript) and BMP versions of all figures to be used in the various formats of the document. The following tables have been added in version 2.0: * Chris added: Table 6-1, Table 14-1, Table 16-1, Table 16-2, Table 20-1, Table 21-1, Table 21-2, Table 23-1 and Table 25-1. Chris wrote all new material of version 2.0 in LyX, formatted the whole document, created the Index (semi-automatically this time, through some of his sed and awk scripts, as described in Document processing with LyX and SGML) and processed the LyX file through his scripts (see Section 1.8, for details) to render all the versions and files available from Section 1.2. _________________________________________________________________ 1.5.4. General Some quotes have been taken from the installation files of phpnuke.org, as well as from the MySQL manual. In Section 25.3 we use material taken from A Brief Introduction to Regular Expressions. The sections on mod_rewrite: Section 25.2.1, Section 25.2.2, Figure 25-2, Section 25.2.3 and Section 25.2.4 have been taken from the Apache Documentation of mod_rewrite. Section 10.1 and part of Section 10.2 were taken from a post of Paul S. Owen, Development Team Leader of phpBB, in http://www.phpbb.com/phpBB/viewtopic.php?t=69493, as well as in http://www.phpbb.com/kb/article.php?article_id=54 and are included here with permission. Figure 28-1 is taken from W3C's working draft CSS3 Paged Media Module, version of Dec. 18th 2003 and is Copyright © 2003 W3C (MIT, ERCIM, Keio), All Rights Reserved. Used with permission according to W3C document licence. The examples for admonition in the Conventions Section (Section 1.7) were taken from the Section on admonitions of the DocBook Guide of the Debian Newbiedoc Project. The CSS file for DocBook that is used in this document , ck-style.css, uses QBullets in links. See Explain CSS on how to do this. Thanks to Matterform Media for providing QBullets for free. If you plan to use them on your website, please observe the QBullets usage terms. The CSS also got important elements from the Newbiedoc CSS file for DocBook and Mark Pilgrim's influential dive into Accessibility. The CSS font size controlling code and its explanation are taken from Using relative font sizes. _________________________________________________________________ 1.6. Aknowledgements Claudio said in the first version (1.x) of this document: The following people contribute, directly or indirectly to this project and their help is hereby kindly aknowledged: * Francisco Burzi with all the introductory scripts, found in the files of installation of PHP-Nuke * Vasco Clergy and his daughter Valentina of Lug Rieti for the translations of the modules of the handbook * Micaela Bechini, for the daily translations of phpnuke.org from English. * The communities of Splatt.it, Nukeitalia.com, PHPnuke.it (and its Mailing List), Postnuke.it, envolution.it, xoops.it and obviously the 1500 registered users of spaghettibrain. * Aemmenet, in the person of Mark Atzori that has granted us free use of the server on which spaghettibrain is accommodated. * Roberto Scano of IWA Italy and Patrizia Bertini of Webaccessibile.org for the contributions on usability, accessibility and W3C validation. * Marcello Tansini of webmasterpoint.org for the support given to the project in terms of visibility. * Andrea Birgahi, the best PHP-Nuke Theme Maker of the world for the diagram of spaghettibrain, for the logo of the book and a lot more. * My girl Sara for all... * My mother Lella, my sister Cora, my dog Grey and the newly arrived baby dog Maya. This book I dedicate it to my Papŕ Antonio. Hello Pŕ. For this second version (2.x), Claudio wishes to thank: * Francisco Burzi, the daddy of PHPNuke, who has chosen this book as the official PHP-Nuke handbook! * The translator and the manager team of the PHP-Nuke HOWTO: Chris Karakas, Andre Purfield, Fortunato Matarrazzo. * Umberto Zaccarini of WMG Italia. * Euro Gala of Eticoweb, for the operative and ethical support. * Florence University, because after reading my book they called me to give a course of CMS at Multimedia Master; in particular D.ssa Barbara Iraci, Dott. Diego Mencarelli and Dott. Del Bimbo. Thanks to every master student, too. * My team, the Crew Spaghetti, Andrea Biraghi, Federico Campoli, Fabio Pirovano, Claudio Demarinis and the casual externals Alex Zollia, Micaela Bechini, VirtualDarkness. * Michel "Ziobudda" Morelli, Fabio Farnesi (programmiamo.net), Giovanni Tummarello (wup.it), Roberto Scano (IWA Italia), Anna Bruno (fullpress.it), Alessandro Del Rosso and the De Andreis brothers (punto-informatico.it), for the mediatic space they give me every time. * My mother Lella, my sister Cora, my dogs Maia and Grey. * My Sara for everything. Chris wishes to thank: * Francisco Burzi, for writing PHP-Nuke and publishing it under the GNU General Public License. * Claudio Erba for bringing the ball in rolling. * Andre Purfield for starting this wonderful project in the PHP-Nuke book translation thread at nukeforums.com. * All software developers, whose software is used in the preparation of this document (see Section 1.8): + LyX, + TeX, + LaTeX, + pdfTeX, + hyperref, + openjade, + pdfjadetex, + thumbpdf, + DocBook DSSSL stylesheets, + collateindex, + sgmltools, + HTML tidy, + HTML split, + sed, + runsed, + awk, + dvips, + and all the standard software used in a GNU/Linux system. * nukeforums for providing a Forum for the initial stages of this project (see the PHP-Nuke book translation thread), as well as all its numerous readers for their questions and answers - who have influenced many solutions presented in this document. Special thanks go to its most active members + Humpa, + Chatserv, + Chris-au, for all the useful advice. I've learned a lot from you! * Paul S. Owen for his contribution in Chapter 10 on session management. * Mark Pilgrim for writing Dive into Accessibility and publishing it under the GNU Free Documentation License. * All authors of documentation used in various places (see Section 1.5): + PHP-Nuke, + PHP manual, + MySQL manual, + A Brief Introduction to Regular Expressions, + Apache Documentation of mod_rewrite, + CSS3 Paged Media Module, + Debian Newbiedoc Project. * Matterform Media for providing QBullets for free. * Didi for Figure 24-2. * Martin Kaspar for inspirating discussions on PHP-Nuke documentation. * Last, but not least, Gloomy for all the moral support during the hard times. The translators would like to thank the Linux Documentation Project (TLDP) and its reviewers, especially Tabatha Marshall and Greg Ferguson for their comments and efforts to make this document available from TLDP's plattform to a wider audience. _________________________________________________________________ 1.7. Conventions admonitions Admonitions are little pictures used to emphasize something of importance to the reader. The four types used are: Note Note Using a hammer to put together your computer is bad. Tip Tip Do not hit your thumb with the hammer, it hurts! Important Important Watch where you're swinging that hammer! Caution Caution Hitting your thumb with a hammer may lead to an unwanted trip to the hospital! Warning Warning Do not, under any circumstances, admit that you hit your own thumb with a hammer. The ridicule you will face is astounding! _________________________________________________________________ 1.8. The book behind the book Do you want to create professionally formatted documents? Tired of always having to change the font settings, to insert or delete pagebreaks, to format your text for printing, monitor, or web view? Do you find yourself spending hours of your life into formatting issues that you wish you never had to be conftonted with? Did you, during your editing efforts, ever get the uncomforting feeling that you are inventing the wheel for th 39th time? Well, in fact you are! You can use the power of Open Source tools like LyX and sgmltools to create the documents you've dreamed of, while, as a nice side effect, concentrating on what deserves most of your attention: Content, not Formatting! In Document processing with LyX and SGML, Chris Karakas describes a method by which all you have to do is to write your document in LyX, then run the .lyx file through a script that will produce the SGML source and, from it, the HTML, TXT, RTF, PDF and PS formatted documents (as in Section 1.2), complete with table of contents, embedded pictures, fonts, thumbnails (for PDF) and other goodies - just as in the document you are reading right now! That is, to learn how to produce a book like this one, you have to read the book behind the book. Inline graphic _________________________________________________________________ 1.8.1. The general idea When writing LyX documents, formatting should be the last thing on your mind. Concentrate on writing a clear and c oncise document. The sgml parser will take care of the formatting.We've all heard of WYSIWYG. LyX is WYGIWYM. WYGIWYM stands for "What You Get Is What You Mean". This means if you mean for text to represent source code you assign it a source code environment (Lyxese for style), and it formats the way you meant it to. You needn't worry about formatting during the writing of your document. If you don't like the way it looks upon finishing and printing it out, you can change the way styles map to formatting, and those styles will consistently change throughout the document. _________________________________________________________________ 1.8.2. Line of attack The method described in Document processing with LyX and SGML follows a line of attack defined by the following: * We put everything in a shell script. We don't want to bother about anything else. We want to ponder comfortably upon the meaning of life while drinking some coffee or tea, watching our computer do the work for us - personally, a very rewarding experience :-) * We use sed to correct LyX' SGML output. The more we are able to correct, the more SGML features we get out of our plain vanilla LyX. * We use the sgmltools package which hides a lot of details from the end user, giving nonetheless all the power of the involved tools.[3] * We will adapt the DocBook DSSSL stylesheets to our personal needs and taste.. * The end product shall be a directory ready to upload to our web server with all files, links, images and formats necessary. So you got appetite and want to delve into the gory details? Read the book behind this book: Document processing with LyX and SGML! Inline graphic _________________________________________________________________ 1.9. How to translate this HOWTO The PHP-Nuke HOWTO started also as a translation. You can read how it all started in PHP-Nuke book translation thread at nukeforums.com. The best way to do the translation would be to install the LyX. Chris still uses an old version (1.2.0) of it, but you could try the newest one and we will see if his document processing scripts still work. Inline graphic The process is the following (see, for example, Greek Translation of Php-Nuke HOWTO and New language translation howto): 1. You take the LyX version of the book from the Formats section (Section 1.2), you do the translation in LyX, then send it to Chris Karakas (chris at karakas-online dot de). 2. Chris will use his scripts (Section 1.8) to export the LyX document to SGML, correct the SGML that comes out of LyX, then produce all other formats, as in Section 1.2). The advantage of this method is that you only need to translate the words, leaving everything else (like "environments", SGML tags etc.) untouched. This way paragraphs, admonitions (see Section 1.7), callouts (those small numbers in circles that you see in some code examples, as in Section 3.7), code environments etc., all remain intact - and you don't need to recreate them. We are in search of available volunteers to translate this book in as many languages as possible. In the case you are interested in translating this book, write to chris at karakas-online dot de, or PHP-Nuke HOWTO. Be prepared for months of hard work, as this is 500 pages of printed material! _________________________________________________________________ Chapter 2. Introduction to PHP-Nuke 2.1. Purpose There has always been the necessity to have a definitive guide on PHP-Nuke. Due to time constraints, nobody has ever had the will to carry out this operation. Not any more! With this book, PHP-Nuke now posesses the most comprehensive guide on the subject, suitable for newbies and advanced users alike! _________________________________________________________________ 2.2. What Is PHP-Nuke PHP-Nuke is free software, released under the GNU License. It is a CMS (Content Managment System) that integrates in its inside all the instruments that are used to create, in a broad sense, an information portal (Figure 2-1). Given the immense number of present functions in the installation and in an even greater quantity of modules developed from third parties, the system is also adept to the management of * Intranet business, * e-commerce systems, * corporate portals , * public agencies, * news agencies, * online companies, * information sites, * e-learning systems * and so on... Figure 2-1. phpnuke.org, the official PHP-Nuke site. phpnuke.org, the official PHP-Nuke site. phpnuke.org, the official PHP-Nuke site. PHP-Nuke utilizes as hinge of its own structure the duo PHP+ MySQL, very often being accompanied by the Apache web server. Many modules have integrated many other languages, such as Javascript, Java, Flash and also even systems that serve, through the portal, sounds and films in streaming mode (Online Radio, TV Online, Images, Files...). From version 6.x onwards, the compatibility has been extended to include other databases as well, in order to extend the user base even more vastly. PHP-Nuke is developed with a particular eye to the suggestions of the W3C, in its origin, the code is in fact W3C compliant and one has validated both the code and the style sheets. It is then up to the user who intends to create a portal to adhere to these standards during the modification of the graphics or the intrinsic characteristics of the system. The personalisation either of the graphical, or of the programming part has only a single limit, the fantasy and capability of the programmer and web designer.The presence of many PHP-Nuke sites similar to each other is due mainly to the lack of time of those who created them or the fear that the phase of personalisation is too difficult on a technical level. In fact, it suffices to let oneself be inspired by the available themes, in order to realize how easy it is to sew a new dress to one's portal. Francisco Burzi, father and mother of PHP-Nuke, describes his creation as follows: PHP-Nuke is a Web Portal System, storytelling software, News system, online community or whatever you want to call it. The goal of PHP-Nuke is to have an automated web site to distribute news and articles with users system. Each user can submit comments to discuss the articles, just similar to Slashdot and many others. Main features include: web based admin, surveys, top page, access stats page with counter, user customizable box, themes manager for registered users, friendly administration GUI with graphic topic manager, option to edit or delete stories, option to delete comments, moderation system, Referers page to know who link us, sections manager, customizable HTML blocks, user and authors edit, an integrated Banners Ads system, search engine, backend/headlines generation (RSS/RDF format), and many, many more friendly functions. PHP-Nuke is written 100% in PHP and requires Apache Web server, PHP and a SQL (MySQL, mSQL, PostgreSQL, ODBC, ODBC_Adabas, Sybase or Interbase). Support for 25 languages, Yahoo like search engine, Comments option in Polls, lot of themes, Ephemerids manager, File Manager, Headlines, download manager, faq manager, advanced blocks systems, reviews system, newsletter, categorized articles, multilanguage content management and a lot more. _________________________________________________________________ 2.3. Short history of PHP-Nuke Francisco Burzi, describes the history of PHP-Nuke as follows: PHP-Nuke is a free software, released under the GNU GPL License, version 2.0. PHP-Nuke is the result of many years administrating a news site called Linux Preview. First, around August 1998, I wrote my own code in Perl called NUKE and used it for about 1 year, then my site grew big, so I needed a more powerfull system and decided to use Slash, the same used in the Slashdot site. It's good, but you realy need to know Perl to modify it, need too many modules, need to load a damn daemon that sucks all your CPU power. My Pentium III just appeared to be a 386 each minute the daemon made its work. Well, then I discovered Thatware, a good project to have a news site under PHP. I learned PHP in less than a week and began modifying it. There are too many mods to mention, it was practicaly a rewrite. I added some cool stuff, deleted some others and after more than 380 hours of hard work in 3 weeks! PHP-Nuke was born. On August 17, 2000 I sold LinuxPreview.org to LinuxAlianza.com and now I have all the time to dedicate to the development of PHP-Nuke. From January 2001 to January 2002, PHP-Nuke has been financially supported by MandrakeSoft, the folks that made Mandrake Linux. This gave me and PHP-Nuke a lot of oxygen and made possible a lot of stuff. Now, I'm alone with this killer project. There is a lot of help from the people that use and develop modules and themes. Now, phpnuke.org is a big site with a lot of users and helpful information for any user around the world. There are also strong users community sites in almost any language you can imagine. Just go to phpnuke.org and enjoy this great community! _________________________________________________________________ 2.4. The PHP-Nuke Communities A careful look is due to the true value of PHP-Nuke, that is the communities that you will find all around. Thanks to the voluntary job of these persons, of these sites, PHP-Nuke has become a well-known system and it is always thanks to them that PHP-Nuke is a multilanguage system that supports more than 25 languages. Even the modules have been created mostly from developers in external communities and have, in second round, been included in new distributions of PHP-Nuke. There are communities out there who are solely devoted to the creation of new graphical themes of PHP-Nuke, to technical support, file mirroring as well as a real lot of multilingual communities that take care of their members informing them in their local language, thus creating new personal ties and more focused projects. * Nukeforums.com: Technical support to PHP-Nuke. * Nukecops: Official PHP-Nuke development team. * Karakas-Online PHP-Nuke Forum: Chris' PHP-Nuke Forum. * Nukedownloads.com: File mirror for downloads. * nukeresources.com: Downloads * nukefixes.com: Fixes for PHP-Nuke bugs. * nukesecurity.com: PHP-Nuke security. * Somara.com: Themes and graphics. * Nukethemes.com: Themes and graphics. * Ecomjunk.com: Addons and modules. * Nukeaddn.com: Addons and modules. Communities in Italian language: * Spaghettibrain.com * Claudiodemarinis.it * PHPnuke.it * Splatt.it * Nukeitalia.com Thanks to the work of these portals and single persons we have more than 500 different modules and blocks that may be used to personalize our portal, in areas varying from the weather (Section 8.2.2) to e-commerce (Section 8.3.14), from gallery (Section 8.3.5) to chat realized in flash and videogames in Java, all included in the layout of PHP-Nuke. _________________________________________________________________ 2.5. Why use PHP-Nuke and not static HTML pages * Because managing large sites with only static HTML pages is dangerous for your health. * Because through the dynamic pages, users can interact (Forum, chat) * Because through the dynamic pages we can offer value added services (restricted areas, various services based on user classification...) * Because the information is more easily catalogued. * Because with a few PHP pages we recall a lot of information. * Because keeping the contents up-to-date does not demand particular technical expertise and can be managed by anyone (by Davis Batistes). * It is the simplest way to to pull over a complete portal, thanks to its open source engine, it allows anyone to implement new modules or to modify and to personalize existing modules. (by Micione, www.vizzani.net) * It is very intuitive and easy to learn (by Anonymous) * It is easy to modify by those who intend to personalize the program (By Arus) * It is easy to use by the lesser experts among us. _________________________________________________________________ 2.6. The PHP-Nuke forks There are several CMS systems, which are PHPNuke forks; among the most famous, we can mention Post-Nuke, Envolution, MyPHPNuke and Xoops. _________________________________________________________________ 2.6.1. PHP-Nuke vs. Post-Nuke Post-Nuke is another Content Management System (CMS) similar to PHP-Nuke. Whilst PostNuke is a fork of PHP-Nuke, the entire core of the product has been replaced, with the aim of making it more secure and stable, and able to work in high-volume environments with ease. Some of the highlights of PostNuke are, according to its developers (in Post-Nuke Modules): * Customisation of all aspects of the website's appearance through themes, including CSS support. * The ability to specify items as being suitable for either a single or all languages. * The best guarantee of displaying your webpages on all browsers due to HTML 4.01 transitional compliance. * A standard API and extensive documentation to allow for easy creation of extended functionality through modules and blocks. The merits of Post-Nuke, as compared to those of PHP-Nuke, have been subject of controversial discussion among fans of both CMSs. We cannot give an objective opinion, since we are biased towards PHP-Nuke. Inline graphic However, we will try to give you an idea: Even its critics will agree that, for a portal whose purpose is to make information publicly accessible, PHP-Nuke is a very good solution. In comparison to Post-Nuke, most people will also find that PHP-Nuke has many more modules available. However, some will argue that most of them seem geared toward the average end user and not a business or corporate environment. On the plus side, PostNuke has a very detailed strict user permissions system allowing you to limit access to every module and area of your site to a general group or a specific user. The permissions system allows you to create groups and users with special permissions. You can add a user to one or many of these groups to give a variety of complex permissions easily. This is handy if you need moderators, sub admins, and other people helping manage a commercial site and wish to limit admin access. This may make PostNuke more appealing to a professional site - but see the Your Account Tweak module (Section 8.3.3), the Approve Membership module ( Section 8.3.4), the eCommerce modules (Section 8.3.14) or the Project Management WorkBoard module (Section 8.3.15) before you draw premature conclusions. Inline graphic Here are some PostNuke modules that are popular among business end users: * Xanthia Theme Engine * ContentExpess Content management * Static Content Management * PostCalendar * FormExpress Forms Generator * pnAddressBook (Palm Style) * LDAP * NukeOWL * PNphpBB2 However, PostNuke seems to be caught prisoner of its own development impetus: it changed so fast, so often, and made code break backward compatibility in newer versions so often, that it became difficult even for seasoned webmasters to follow it. Lack of compatibility even between adjacent versions and rumours on its development being suspended, has robbed the nerve of quite a few people, who then turned back to PHP-Nuke for its great community, support, continuing, smooth development and vast collection of modules. The following quote, taken from History of PHP-Nuke and Post-Nuke, reflects this situation: I spent a month trying to customize Post-Nuke for a client, and then I gave up. It was too hard and the support was non-existent. Although you'll find many people in the community who want to help you, you'll find no one who has experience with the particular version you've got. Note Is Post-Nuke more secure than PHP-Nuke? The security argument is often heard in favour of Post-Nuke. However, a commited cracker will probably not encounter considerably more difficulties in cracking Post-Nuke, than PHP-Nuke, as the following testimonial, taken from the discussion in History of PHP-Nuke and Post-Nuke, illustrates: I have a fair few associates who are still hackers, and they can crack into any Post-Nuke site in 20 seconds flat - I've timed them - and they've had full - note: FULL access to the administration section when they have. The fastest I've seen them hack the least secure PHP-Nuke over the past year, is 30 seconds approx. (32 seconds to be precise). That doesn't sound like PHP-Nuke is less secure to me. The latest version of PHP-Nuke (6.5) prior to it's RC1 with the new security procedures in it, it took them 5 minutes to hack into it. Of course, 5 minutes will not make you sleep any more quiet than with Post-Nuke, but the Web is a dangerous place by construction and and the point is of relative, not absolute nature. PHP-Nuke has improved its security even more since then. For more details on PHP-Nuke security, we refer you to Section 23.1, where we will talk about PHP-Nuke's past security vulnerabilities, its new security procedures and what you can do to enhance its security even further. We cannot go into more details on PostNuke, since they would easily fill another book. Perhaps the best test is to visit the homepages of both projects, PHP-Nuke and PostNuke - and decide for yourself which one you like best. Inline graphic _________________________________________________________________ 2.6.2. PHP-Nuke vs. XOOPS XOOPS is a dynamic OO (Object Oriented) based open source portal script written in PHP. According to its developers, XOOPS is the "ideal tool for developing small to large dynamic community websites, intra-company portals, corporate portals, weblogs and much more" (see About XOOPS). The developers also tell the following about their goals: The goal of the XOOPS team is to create a Content Management System (CMS) for users and developers that installs out of the box offering unparalleled ease of use, support and management. The XOOPS CMS will be extendable by the use of modules installable through a unified admin interface. The ultimate goal of the XOOPS team is to take the best features of current CMS's and roll them into an Open Source CMS that's easy to use, extendable and unparalleled in the Free/Open Source Community. XOOPS is (see XOOPS Features List): * Database-driven: XOOPS uses relational databases (currently MySQL) to store data required for running a web-based content management system (compare with Section 2.2). * Fully Modularized: Modules can be installed/uninstalled/ativated/deactivated with a click using the XOOPS module administration system (compare with Section 9.3). * Personalization: Registered users can edit their profiles, select site themes, upload custom avatars, and much more (compare with Chapter 6)! * User Management: The ability to search for users by various criteria, send email and private messages to users through a template-based messaging system (compare with Figure 6-4). * Supported World-wide: The XOOPS community has more than dozen official support sites around the world for support of non-English speaking users (compare with Section 2.4). * Multi-byte Language Support: Fully supports multi-byte languages, including Japanese, Simplified and Traditional Chinese, Korean, etc (compare with Chapter 13). * Versatile Group Permissions System: Powerful and user-friendly permissions system which enables administrators to set permissions by group (compare with Section 8.3.3). * Theme-based skinnable interface: XOOPS is driven by a powerful theme system. Both admins and users can change the look of the entire web site with just a click of a mouse. There are also over 60 themes available for download (compare with Chapter 14)! The OO (Object Oriented) approach of XOOPS to Web Content Management is innovative, but also controversial. Franzisco Burzi writes in History of PHP-Nuke and Post-Nuke: About saying that OOP (Object Oriented Programming) is a good stuff and makes stuff more stable, modular, or whatever else you want... False. OOP is good for very big projects, which is not the case of PHP-Nuke (I mean VERY BIG projects) with a lot of reusable code. BUT... any good PHP programmer knows that the use (or worse, the intense use) of objects/classes in a PHP script isn't good. PHP is not efficient managing objects/classes. At least it's less efficient than managing custom user created functions. Any decent PHP 4 book will say this to you: If you can manage to have your software working without using OOP, there isn't any reason to use objects, because of performance issues. _________________________________________________________________ 2.6.3. XOOPS vs. Post-Nuke We cannot go into the details of a comparison between XOOPS and Post-Nuke, as this would be rather off-topic here. For a discussion of XOOPS vs. Post-Nuke, see XOOPS vs. Post-Nuke. There, among lists of pros and contras, you will read this: I'm an architect. My teacher always told me that there are no "bad tools". There are only "bad craftsmen". Find your own way to work - it's not a race, not a competition, you don't need to have the better machine to win. The best sites won't flash with decorations, tons of blocks and gifs. They are made with the same basic tools, CLEAR AND WISE IDEA, and lots of custom made details. Innovate - not imitate. Inline graphic _________________________________________________________________ Chapter 3. How to install PHP-Nuke The screenshots regarding the installation procedure, contrary to those of the other chapters, refer to the Windows platform. This is so in an effort to reduce the number of misunderstandings and ulterior help requests from the Windows community. (Judging from the feedback we receive, the Linux and FreeBSD community seem to be more able to deal with installation problems in this respect). For the installation of PHP+ MySQL+ Apache, PHPMyAdmin etc. refer to Chapter 28 where you will find notes and links to useful tools in order to emulate PHP-Nuke on your client. These instructions are valid for all PHP-Nuke versions from 6.0 onwards. _________________________________________________________________ 3.1. Prerequisites In the INSTALL file of PHP-Nuke, we read the following about its requirements: In order to setup PHP-Nuke the folowing prerequisits are necessary. * Linux, installed and working properly. * Apache Web Server. * PHP version 4.1.x or better (mod_php) Apache module. * MySQL database server ...The above doesn't mean it will not work with other configurations, OS's, DB's, etc, but we only provide INSTALL instructions for the above configuration. In fact PHP-Nuke works under Windows (all), FreeBSD, OS/2, MacOS, etc. Important PHP 4.1.0 or later needed! From the INSTALL file, we see that you must have at least PHP 4.1.0 to use PHP-Nuke 6.5 and later. This is an important piece of information that you should ckeck before proceeding. See Warning: Invalid argument supplied for foreach(). You see, it is always a good idea to read the INSTALL file that comes with a software package. Inline graphic To see the PHP version you are running and do also a small test on your configuration, take the following file, name it test.php (Section 3.9.1.1), put it in the html directory and point your browser to it: Note PHP-Nuke and databases other than MySQL From PHP-Nuke version 5.3, Francisco added a new SQL abstraction layer. It enables PHP-Nuke to support databases other than MySQL, like mSQL, PostgreSQL, PostgreSQL_local, ODBC, ODBC_Adabas, Sybase and Interbase. For the Microsoft Internet Informaion Server (IIS), some tests we have done were positive, some others indicated that a special configuration was needed. _________________________________________________________________ 3.2. Installation process 3.2.1. Download Well... there is little to say here, it suffices to go to a site that holds the files and download them. There is only a small remark to make: if you use Windows and download a version comprised of a file with the ending tar.gz, do not worry, your Winzip supports it without problems. Once downloaded, extract it and "throw" all its contents in a folder you created for this purpose and you call "Nuke6" or whatever ( sites from which you can download PHP-Nuke are: phpnuke.org, www.spaghettibrain.com etc.). _________________________________________________________________ 3.2.2. Upload through FTP Well, now what remains is just to upload the files to the interior of our main server directory that resides on our provider. Caution Attention! It is highly recommended, prior to any installation steps, to verify that your provider supports PHP and MySQL. Your ISP has already given you: * An FTP user and password: you need these for the file transfers. * A database user and password, as well as the name of the database server to connect to: you need them to connect your applications (like PHP-Nuke) to the database and to be able to access the administration panel of phpMyAdmin (Section 3.3). For FTP in the Windows plattform, we recommend using the WS_FTP application. It is free for personal use and you can download it from download.com by entering the search key "ws_ftp". For the Linux plattform instead, we recommend GFTP (free for all and preinstalled in all distributions), which can be run from the command line by simply typing "gftp". Figure 3-1. WS_FTP: General connection parameters. WS_FTP: General connection parameters. WS_FTP: General connection parameters. The use of an FTP program is very simple - we will follow the procedure through 4 screens that enable us to: * Connect (Figure 3-1) * Transfer files (Figure 3-2) * Set up the permissions (see also Section 3.2.3) * (Eventually) edit the uploaded files Figure 3-1 shows the WS_FTP General Connection Parameters screen. Entering the right values in the fields of that screen will enable you to conncet to the server where you want to upload the files. Caution Attention! If you are installing PHP-Nuke locally, it is not necessary to use FTP! In this case, it suffices to copy the files into the right directory. In case you are working under Linux, it may be necessary to set the right file permissions. See Section 3.2.3 on how to do this. Figure 3-2. WS_FTP: Main screen with local and remote windows. WS_FTP: Main screen with local and remote windows. WS_FTP: Main screen with local and remote windows. Once connected, the next operation is to upload the files on the remote server. With WS_FTP, as well as woth the majority of the other FTP clients, the window that contains the local files is located to the left, while the remote files are displayed in a window to the right (Figure 3-2). You have to position your cursor on the directory that contains the files to be uploaded to the left and the directory tha has to receive them on the remote host to the right. You can do this through the graphical interface of WS_FTP. As you can see in Figure 3-2, there are also some function buttons there: the two arrows are used to upload / download files to / from the server, the other two buttons that are functionally important are "MkDir", which creates a new directory, and "Refresh", which updates the view of data contained in a window. Don't upload all extracted files. After extraction, you will find a structure similar to the one depicted in Figure 3-3. Figure 3-3. PHP-Nuke 6.0 file structure PHP-Nuke 6.0 file structure PHP-Nuke 6.0 file structure You don't need to upload all the files from the folder, in the main directory of your web presence you will only need to upload the contents of the html folder (so just do a doubleclick on the html folder and upload everything that is inside it). But in order to populate the database with the PHP-Nuke tables, you will also need to upload the sql folder too. After the database creation (see Section 3.2.4), you should delete this folder though - for security reasons. An operation that may be useful in cases of emergency is "Edit", which is accessible from the context menu after a right click with the mouse on the desired file. "Edit" will allow a direct modification of the file, without the intermediate step of downloading it to your computer. _________________________________________________________________ 3.2.3. File permissions Important Important This process only really applies if your PHP-Nuke will be installed on a Linux/Unix server, if instead you will install it on Windows operating systems you don't have to do anything. Permissions: Each file or directory[4] has 3 groups of permissions associated with it: one set of Read, Write or Execute permissions for the owner (also called "user" in this context), a group and "others" respectively. The owner in our case should be the user name of your web server. The group is a user group the web server is a member of. And "others" are just "the rest". File permissions are usually grouped together in groups of three, like this: (rwx)(rwx)(rwx). The first group are the user permissions, the second one the group permissions and the third one the permissions for "others". A good mnemonic for this grouping is UGO (User, Group, Others). Inside each permissions group, a certain permission may or may not be present. Thus, the user (owner) of the file will usually have read and write permissions (and execute permission too, if the file is executable), but the group permissions may only allow read access and "others" may not be allowed to access the file at all, neither for reading, nor for writing or execution. If you imagine that the existence of a permission is denoted by a 1, while its absence by a 0, then you end up with a representation like (111)(111)(111), where all permissions are present for all, or (000)(000)(000), where they are absent for all. Of course, any other combination is possible, for example (111)(110)100), which denotes read, write and execute permissions for the user (all 1s are present in the first grouping: (111)), read and write permissions for the group (only the first and second 1s are there in the second grouping (110)) and read permission for others (since only the first 1 is there, while the rest are 0s in the third grouping (100)). Writing down a sequence of nine 0s and 1s is not very practical, so one came with the idea to interprete each one of the three groupings as a binary number. A (111) would thus mean a 7, a (110) a 6, a (100) a 4. Taken together, the sequence (111)(110)100) of the example above would be represented by the number 764. That's compact and widely used. Unfortunately, it is also very cryptic, since most people didn't have much exposure to the binary number system at school, not to mention everyday life. How is one going to understand instructions like "set file permissions to 644" then? Luckily, there exists an easy mnemonic for this: "4,2,1", that is the first 1 counts as a 4, the second as a 2 and the third one as 1 - a 0 is always a 0, by the way, even in the binary system. Inline graphic Whenever you see a 1 in the first position of a permissions triple, you add a 4, whenever you see one in the second, you add a 2 and if you see it in the third, you add 1. You do this for UGO, that is for User, Group and Others and you end up with a three digit number that represents the permissions of the file. Most of the time, however, you will be busy deciphering permissions, rather than formulating them yourself in this cryptic manner. So how do you go about interpreting a permissions representation like 764 that was given to you in a document like the PHP-Nuke HOWTO? For this, you will need to develop a "feeling" of how each of the three numbers (7, 6 and 4 in this example) can be written a a unique sum of 4s, 2s and 1s. For example 7 is 4+2+1, 6 is 4+2 and 4 is just 4. A 4 in the sum represents a 1 in the leftmost position. If a 4 is not present in the sum, the leftmost position is a 0. A 2 in the sum reperesents a 1 in the middle position - if there is no 2 in the sum, you just write a 0 there. Finally, a 1 in the sum represents a 1 in the rightmost position, while if there is no 1 in the sum, you write a 0 there. Now if you remember that the leftmost 1 or 0 in a pattern like (111) denotes a read permission or the absence or it, a 1 or a 0 in the middle position denotes a write permission or its absence and a 1 or 0 in the leftmost position denotes an execute permission or its absence, then you can take a permissions represenation like 764 above, see that 7=4+2+1 and realize that it means (111), see that 6=4+2 (or 4+2+0, if you like) and realize that it means (110), finally see that 4=4 (or 4+0+0) and realize that it stands for (100), and you can see that 764 is equivalent to (111)(110)(100), meaning read, write and execute permissions for the user (owner), read and write permissions for the group and only read permissions for others. Easy after all, isn't it? Inline graphic For more information on permissions, see: * Setting Unix Permissions For Web Pages * An Introduction to Unix Permissions * Understanding UNIX permissions and chmod * Tutorial: UNIX Permissions Setting up permissions on files serves the purpose of having them execute only certain operations (write, execute etc.) when called. Setting them up correctly is important for PHP-Nuke to operate in its full functionality. The right permissions for PHP-Nuke are the following (for the base permissions, see Section 23.4.4 in the context of security): * Files: 644 * Directories: 755 Only directories that require upload access (like the forum's avatar folder, if you allow avatar upload) should be set to 777 and files that get data written to them by the program should be set to 666. With WS_FTP you must select the files or folders on which you want to impose the permissions and, with the right mouse key, to select the option "chmod (UNIX)" (see Figure 3-4). Figure 3-4. WS_FTP context menu on right mouse click: chmod (UNIX) WS_FTP context menu on right mouse click: chmod (UNIX) WS_FTP context menu on right mouse click: chmod (UNIX) The window "Remote file permissions" will appear (see Figure 3-5). To change the permissions on a directory as required to 755, for example, check the boxes as shown in Figure 3-5 and press "OK". Figure 3-5. WS_FTP Remote file permissions window WS_FTP Remote file permissions window WS_FTP Remote file permissions window This procedure will cost you some time, but it is very important to carry out. Moreover, you will have to do it every time you insert a new file or module to your PHP-Nuke. _________________________________________________________________ 3.2.4. Database creation Create a database that will contain the PHP-Nuke tables. The name of the database should be the same name as the one you entered in config.php (see Section 3.7): mysqladmin create nuke To populate the database, you have to run the nuke.sql file "through" mysql. Change to the sql directory and do from the command line: mysql -h dbhost -u dbuname -p dbname < nuke.sql where dbhost, dbuname and dbname are the database host, database username and database name, exactly as entered in config.php. Just as you import nuke.sql, you can import any other MySQL dump file (see also Section 3.4.2). _________________________________________________________________ 3.3. How to install PHP-Nuke through phpMyAdmin To be able to create a database, you must be able to administer it. A perfect instrument for doing this via a browser is phpMyAdmin. _________________________________________________________________ 3.3.1. What Is PHPMyadmin PHPMyAdmin is a visual system for the management of a MySQL database (see Figure 3-6). It is written in PHP and serves to display the contents of the databases on the server (or client) on which MySQL is installed. Through this interface you can create new databases, modify existing ones and modify the contents of single fields. _________________________________________________________________ 3.3.2. How to install phpMyAdmin Local installation under Windows is very simple: you only need to extract the files from the archive you downloaded from the official phpBB site and point your browser to the address http://localhost/phpmyadmin. You will then see a screen as in Figure 3-6. Figure 3-6. PHPMyAdmin start screen. PHPMyAdmin start screen. PHPMyAdmin start screen. If you are working locally, don't worry about any warnings you might get. In case you have to install phpMyAdmin on your server, e.g. when your ISP does not offer a preinstalled administration panel for the database, you must configure the config.inc.php file that comes with it: Supposing that your data are: * IP of the database server: 156.123.22.34 * User: Pippo * Password: Topolino * Database name: Minnie then the necessary entries in config.inc.php look like this: $cfgServers[1]["host"] = "156.123.22.34"; // MySQL hostname $cfgServers[1]["port"] = ""; // MySQL port - leave blank for default port $cfgServers[1]["adv_auth"] = false; // Use advanced authentication? $cfgServers[1]["stduser"] = ""; // MySQL standard user (only needed with advanc ed auth) $cfgServers[1]["stdpass"] = ""; // MySQL standard password (only needed with ad vanced auth) $cfgServers[1]["user"] = "Pippo"; // MySQL user (only needed with basic auth) $cfgServers[1]["password"] = "Topolino"; // MySQL password (only needed with ba sic auth) $cfgServers[1]["only_db"] = "Minnie"; // If set to a db-name, only this db is a ccessible $cfgServers[1]["verbose"] = ""; // Verbose name for this host - leave blank to show the hostname $cfgServers[1]["bookmarkdb"] = ""; // Bookmark db - leave blank for no bookmark support $cfgServers[1]["bookmarktable"] = ""; // Bookmark table - leave blank for no bo okmark support In the config.inc.php you will find more configuration parameters that are repeated. They serve to manage DBs in various hosts with the same interface. _________________________________________________________________ 3.4. phpMyAdmin: How to administer MySQL via Web Once you have opened your phpMyAdmin (to do this, if you are working locally, you would have to open http://localhost/phpmyadmin with your browser), you will get a screen that offers you the possibilities of * Select a database through a drop-down list. * Create a new database as in Figure 3-7. Figure 3-7. phpMyAdmin: Select database. phpMyAdmin: Select database. phpMyAdmin: Select database. Once you have chosen the desired operation, you arrive at the administration interface of your phpMyAdmin. Newer versions contain a navigation bar, located at the top (Figure 3-8), offering the following options: * Structure: See the database structure. * SQL: Execute SQL operations (e.g. load an existing database). * Export: Make a backup of the database. * Search: Search for data. * Query: Display the structure of an SQL query (useful for programmers). * Drop: Delete a database (be careful!). Figure 3-8. phpMyAdmin: Navigation bar. phpMyAdmin: Navigation bar. phpMyAdmin: Navigation bar. As far as we are concerned here, we only need to explain the first 3 items: _________________________________________________________________ 3.4.1. phpMyAdmin navigation bar: Structure "Structure" presents a list of the available tables in the database, with the follwing accompanying options: * Browse: shows the content of the table. * Select: is used to make SQL queries to the table. * Insert: is used to insert new data into the table. * Properties: displays the structure of the table, ie. its fields, their type, length etc. * Drop: deletes the table (be careful!). * Empty: empties the content of the table, but does not delete the table itself, it leaves it empty (be careful again!). The most frequently asked questions in this context are: How do I delete a single record of the table? Select the table, click on "Browse" and select "Delete" for the record in question. If the password is stored encrypted with MD5, how do I change it? Select the table, click on "Browse", then on "Edit" and enter, in clear text, the desired password. Select from the drop-down "Function" menu besides the field the desired function, in our case "MD5" (see Figure 3-9). See also Section 3.9.17. Figure 3-9. phpMyAdmin: field functions. phpMyAdmin: field functions. phpMyAdmin: field functions. _________________________________________________________________ 3.4.2. phpMyAdmin navigation bar: SQL "SQL" serves the purpose of "loading" whole datasets or already existing databases with one action. The datasets (or the database) are presumed to be already available in a MySQL "dump file". This is a text file containing all the necessary SQL queries that must be sent to the database server, in order for the datasets or database to be created. An example of such a dump file is the nuke.sql file that comes with PHP-Nuke and contains all the database instructions for the tables to be created during installation (see Section 3.4.5). The use of this function is very simple: just search your system for the dump file you want to load, by hitting the "Browse" button (Figure 3-10). MySQL dump files usually come with the ".sql" ending, but ".sql.php", ".txt" or even ".php" are also in use. Whether the file is a MySQL dump file or not, can only be told by inspection: open it with a decent text editor (see Chapter 11) and if the first lines look like # MySQL dump 6.6 # ... # # Table structure for table 'xxxxx' # CREATE TABLE xxxxx ... ... # # Dumping data for table 'xxxxx' # INSERT INTO xxxxx ... i.e. if it contains CREATE and/or INSERT SQL statements, then it is a dump file (see also Section 3.4.3). This function is useful when you want to create whole databases and fill them with data in one step, but it is also very useful when you want to add data to an existing database. However, this does not mean that it will always succeed: especially if the dump files are very large, this operation my exceed the PHP CPU limit (usually set to 30 sec. by the ISPs). (see, for example, Section 27.16) Figure 3-10. phpMyAdmin: SQL function. phpMyAdmin: SQL function. phpMyAdmin: SQL function. Caution Beware of long .sql files! You can of course use phpMyAdmin to comfortably import any MySQL dump file, i.e. from a previous backup of an existing installation with thousands of forums posts. In this case, the import may take longer than the limit on the execution time of PHP scripts that most ISPs set (usually 30 sec.). You will end up with a half-filled database! In this case, either cut the file up into smaller chucks and use phpMyAdmin to load the smaller files, or insert the text piecewise for execution in the text area field of phpMyAdmin that is there for this purpose, or, as a last resort, do it from the command line, as shown in Section 3.2.4. See also how to import a '.sql' (>3M) file to mysql database with phpmyadmin?, Importing .sql files into an existing database in phpmyadmin. _________________________________________________________________ 3.4.3. phpMyAdmin navigation bar: Export Figure 3-11. phpMyAdmin: database dump. phpMyAdmin: database dump. phpMyAdmin: database dump. The "Export" function is useful for obtaining backups of our database (we recall that this is also possible to do from the administration panel of PHP-Nuke, see Section 7.1). The management console we get for this function is quite detailed (Figure 3-11): In the central area, we have a list of the database tables, while to the right we have the backup options: * Structure only: backs up the structure of the database (tables, their fields and their properties), but not the data it contains (i.e. the tables are left empty). * Structure and data: will save not only the structure, as above, but the data in the tables as well. * Data only: will save only the data, but not the structure. * XML: saves the database in an XML format. The options that appear in the lower part of the screen have to do with the extra features the created backup file should have: * Add 'Drop Table': Prepends an instruction to destroy any existing table with that name to the instructions that create that table. For example, if we already have a table "nuke_authors" in our database, this option will take care of removing it, before it loads the structure and/or data for a table with the same name. Otherwise, attempting to import a file that contains structure and/or data for nuke_authors will result in an error, since the table will already exist. You should check this option if you are reinstalling PHP-Nuke over a previous unsuccessful instalation and you think you might already have some tables there. * Save as file: will save the backup as a file (which will be compressed accordingly, with either ZIP or GZIP, if the "zipped" or "gzipped" boxes are checked - other versions of phpMyAdmin may only offer a "bzip" compression). If we don't select any table from the table list, phpMyAdmin will deduce that we want to save all tables. In case you want to select only some of them, just click on the ones you want with the left mouse button, keeping the CTRL button pressed. To export a database from the command-line, without the use of the graphical tool of phpMyAdmin, you just do: mysqldump -u dbuser -h dbhost -p dbname > dbdump.sql where dbuser, dbhost and dbname are the database user, host and name respectively, exactly as entered in config.php (Section 3.7). _________________________________________________________________ 3.4.4. phpMyAdmin: other commands Yet another couple of instructions: In order to see the structure of a table, you only need to click on the one that is marked in the left bar and you will see all its fields and modification options appear in the central part (Figure 3-12). Figure 3-12. phpMyAdmin: table forum_topics. phpMyAdmin: table forum_topics. phpMyAdmin: table forum_topics. Caution ATTENTION! The DROP command eliminates all the contents of the DB, the table or the single field, use it with caution. To learn more about the possibilities that phpMyAdmin offers you in administering your databases, see Doing More With phpMyAdmin (Part 1) and Doing More With phpMyAdmin (Part 2). The first part explains how to obtain the software, install and configure it for secure access, and use it for tasks such as managing multiple servers, manipulating user privileges, viewing reports on server activity, and exporting MySQL records into different formats. The second part explains the more advanced aspects of the application, including using it for transformations, maintaining a history of all the SQL queries executed in the phpMyAdmin session, defining relations between tables to create JOINs automatically, creating E-R diagrams in PDF format, and bookmarking important queries for future reference. _________________________________________________________________ 3.4.5. How to install the DB of PHP-Nuke with PHPMyadmin Create a database that will contain the PHP-Nuke tables (see Figure 3-13). The name of the database should be the same name as the one you entered in config.php (see Section 3.7). Figure 3-13. phpMyAdmin: Create database. phpMyAdmin: Create database. phpMyAdmin: Create database. To populate the database, you have to import the nuke.sql file, exactly as we showed in Section 3.4.2 for general database dump files. Clicking on the left bar, depending on the database you selected, you will see a list menu coming up, showing the structure of the database (and, on the same time, the central page will show the enlarged structure of the database), with a series of options, all of them in the bottom of the page (see Figure 3-14). It is these options we are interested in when installing PHP-Nuke. Figure 3-14. phpMyAdmin: table structure and selection. phpMyAdmin: table structure and selection. phpMyAdmin: table structure and selection. What you have to do now, is to click on "browse" and go search for the .sql file that contains the instructions that build the structure of the PHP-Nuke database (see Figure 3-15). Once found, it suffices to click on "Go" and the database will be installed. Of course, if there are errors, they will be reported at the end of the installation procedure. And of course, the same holds for the message "operation succeeded". Caution Don't delete the whole database on the ISP! If you have bought some hosting space on your ISP's servers, you may not be able to create databases at your will, but be constrained to use only the one that your ISP created for you. In this case, you can create, delete and modify its tables and their contents, but not the database itself! Don't drop the whole database, as you may not be allowed to recreate it! Figure 3-15. phpMyAdmin: SQL query. phpMyAdmin: SQL query. phpMyAdmin: SQL query. You can verify that the tables were populated with data by browsing their contents (Figure 3-16) - click on the small icons besides their names in the left frame for this (if you click on their names, you will only see their structure). Figure 3-16. phpMyAdmin: table data. phpMyAdmin: table data. phpMyAdmin: table data. Other options of PHPMyAdmin that are not relative to the installation of PHP-Nuke, but still useful for the administration of the database, can be found in Section 3.3. _________________________________________________________________ 3.5. How to install PHP-Nuke using nukesql.php If fiddling with the database from the MySQL command line does not make you feel comfortable, you can use one of the Web Installers for PHP-Nuke available for your version, in the form of the nukesql.php script. This file will install all required database tables for a fresh installation of PHP-Nuke. It works a follows: Simply enter your database login information in config.php (see Section 3.7), upload all PHP-Nuke files (Section 3.2.2), then upload this file to PHP-Nuke's root directory and point your browser to it (e.g. http://yoursite.com/nukesql.php). nukesql.php proceeds in an interactive way to populate the database tables and test your settings in config.php. Some of its features: * Checks that you are not using the default $sitekey (Figure 23-2). * Lists existing database tables if any. * Installs tables on a empty database. * Replaces existing tables with new ones. * Creates duplicate tables for a second nuke site using one database by using a different prefix in config.php (see also Section 3.7.1). * Will help you troubleshoot installation by testing connection to the MySQL server and selection of database (see also Section 3.9.1). _________________________________________________________________ 3.6. How to install PHP-Nuke locally A PHP-Nuke installation on your own computer will give you the opportunity to test the whole spectrum of functionalities offered, as if you were online and your system were hosted in your ISP. But in order to start working on PHP-Nuke locally, you must have a web server installed on your box. In this section we will cover the necessary steps towards a working PHP-Nuke environment (Apache + PHP + MySQL ) under Windows and Linux. For Windows, there are various packages you can choose from - they will install Apache, PHP and even MySQL for you and will provide a ready-to-use environment for the installation of PHP-Nuke. Among them, there are easyPHP (Section 3.6.1), XAMPP (Section 3.6.2) and Apache2Triad (Section 3.6.3). _________________________________________________________________ 3.6.1. easyPHP After the download of easyPHP (version 1.6 or later), istallation is really easy: just click the setup icon to start it. You will be asked a few questions in the processes and that's all. The first screen is a welcome message and you only have to click on "next" ("suivant"). You will then be presented with screens like licence etc. and you can continue clicking on "next" ("suivant"), until you reach the screen that asks you where you want to install easyPHP (Figure 3-17), in which case you just choose the right path (if you have doubts about the right path, you can leave it to the default just as well). Figure 3-17. easyPHP: Installation screen. easyPHP: Installation screen. easyPHP: Installation screen. Continue clicking on "suivant" until the end of the installation, when you have to click on "terminer" to end it. easyPHP is now installed. But where should you install PHP-Nuke in a system with easyPHP installed? Suppose you installed easyPHP in a folder like c:\easyphp. Open that folder and you will find various subdirectories. The one that is important is www. It is under the www folder that the local copy of Apache will expect the files to process - and it is exactly there where you should install PHP-NukeI in the c:\easyphp\www folder. We must still explain a couple of elements of easyPHP's functioning. Once you start the easyPHP application, you will find an icon in the bottom bar, to the right of your screen, that resembles an "e" with a small red point (Figure 3-18). If the red point is lighting, the server is active, if it is dimmed out, the server is shut down. Figure 3-18. easyPHP icon in the bottom bar. easyPHP icon in the bottom bar. easyPHP icon in the bottom bar. To administrate easyPHP, you only have to click on that black "e". A right click with the mouse will offer a menu with all commands available for the server administration, a double click with the left mouse button will instead offer an information screen. _________________________________________________________________ 3.6.1.1. How to check a successful installation To make sure that Apache and PHP have been installed correctly on our system, we will use the phpinfo() function of PHP, which asks the server to give information about the PHP configuration. If we get a screen like the one of Figure 3-19, then everything is working correctly. Figure 3-19. phpinfo: PHP screen for a Windows system. phpinfo: PHP screen for a Windows system. phpinfo: PHP screen for a Windows system. To construct a file that uses the phpinfo() function, you can either use the text.php script of Section 3.9.1.1, or, even more simply, create a text file (with a decent text editor, see also Chapter 11) that contains only the line Save the file under the name, say, info.php and move it to the www folder of the easyPHP directory (we talked about it above). Then enter the URL http://localhost/info.php in the address bar of your browser and you should get (among other information) the screen of Figure 3-19. _________________________________________________________________ 3.6.2. XAMPP XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start. The distribution for Linux system (tested for SuSE, RedHat, Mandrake and Debian) contains: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, gdbm, zlib, expat, Sablotron, libxml, Ming, Webalizer, pdf class, ncurses, mod_perl, FreeTDS, gettext, mcrypt, mhash, Turck MMCache, SQLite and IMAP C-Client. The distribution for Windows 98, NT, 2000 and XP contains: Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, JpGraph, FileZilla FTP Server, mcrypt, Turck MMCache, SQLite, and WEB-DAV + mod_auth_mysql. The versions of the programs included in the latest version for Windows are: * Apache 2.0.48 * MySQL 4.0.16 * PHP 4.3.4 * Openssl 0.9.7c * SQLite 2.8.6 * mod_php 4.3.4 + mod_perl 1.99_10 + mod_ssl 2.0.48 To install XAMPP you only need to download and extract XAMPP, that's all. There are no changes to the Windows registry and it's not necessary to edit any configuration files. It couldn't be easier! To check that XAMPP is working some sample programs are included, there is a small CD collection program (written in PHP using MySQL) and a small guest book software (written in Perl) and several other utilities. If you decide that XAMPP isn't needed any more just delete the XAMPP directory and it's completely removed from your system. Important On the press: Call for donations On December 19, 2003, someone applied to the German Patent and Trademark Office for the rights to the "XAMPP" name. This person was not one of the XAMPP developers, but someone totally unknown to them. The trademark application is a danger for the project's future, since the applicant could - if no legal measures are taken - forbid that the XAMPP developers use that name for their software or do business taking advantage of the name's popularity. The XAMPP developers call on the project's website for donations to help counter this threat with legal means. Whether you are a new XAMPP user, a friend of Apache Friends, or just someone who would like to help, please take the time and make a donation to the XAMPP project. _________________________________________________________________ 3.6.3. Apache2Triad Apache2Triad offers the following goodies, according to the Description: Apache 2.0.47 , MySQL 4.0.13 , OpenSSL 0.9.7b PHP 4.3.3 , Perl 5.8.0 , Tcl 8.4.2 , Python 2.2.2 plus PHP-Nuke 6.8 , PHPmyadmin 2.5.2 , AWStats 5.7 plus Stunnel 4.04 , SSLCert 1.0 plus Xmail 1.1.6 and SlimFTPd 3.13 plus UebiMiau 2.7.2 and PHPXmail 0.33 all configured and easy to install and easy to customize as it has the cleanest layout and structure there is and is updated for every new release of the software it contains plus The Apache2triad Control Pannel suite of tools plus Full documentations plus Unparalelled Installer. The homepage of the program is Apache2Triad. Apache2Triad is not free for commercial usage: if your company wants to use Apache2Triad you must purchase it for 15$, which is certainly worth the money if you only think at the frustration it saves you by installing all the above packages for you. _________________________________________________________________ 3.6.4. Apache, PHP and MySQL on Mandrake Linux We will describe how to get a functioning, local installation of the Apache-PHP-MySQL trio on a Linux system - we chose Mandrake Linux for this purpose, but the process is similar with other distributions. We will use visual tools for our purposes, making the assumption that, whoever is capable of compiling the binaries from the source code himself, will not need our guidance. Figure 3-20. RPMdrake: selecting the Apache package(s) for installation. RPMdrake: selecting the Apache package(s) for installation. RPMdrake: selecting the Apache package(s) for installation. The most simple thing to do to get Apache, PHP and MySQL installed under Linux, is to install the appropriate packages from the CD. For this, we will use the software application tool called RPMdrake; upon execution, it will ask for the root password; after we enter it, we will be presented a screen that asks us what we want to install. We enter "Apache" in the aproppriate field and in the sequence we choose the main Apache package (Figure 3-20). RPMdrake will ask us if we also want to install the packages of the "dependencies" (i.e. packages which the main package we selected depends on). It is important to answer with "yes" here. We then click on "install" and we are asked to insert the CD (or the CDs) containing the RPM packages. Once Apache has been installed, we open the Mandrake Control Center and click on "Start" for the httpd service (Figure 3-21). Figure 3-21. Mandrake Control Center. Mandrake Control Center. Mandrake Control Center. The last control step is to open our browser and instruct it to open http://localhost/. If the browser's response is Apache's Welcome Page, we are done. We have to repeat the above operations in the same identical way for the PHP and MySQL packages. In order to make the MySQL database service available, we have again to go to Mandrake Control Center and click on "Start" for the mysql service - PHP does not need this step, it is available immediately after installation. But where is the folder for the HTML files and our PHP-Nuke? It turns out that this is under /var/www/html and we should use phpMyAdmin (Section 3.3) to give this folder the permissions of 777 (for more on file permissions, see Section 3.2.3). This way all users will be able to add, modify and delete files there, not only root. To verify that everything has gone well, we use the info.php file of Section 3.6.1.1. If we get a screen similar to that of Figure 3-19, then everything is fine. _________________________________________________________________ 3.6.5. Apache, PHP and MySQL on Red Hat Linux For some obscure reason, Red Hat 8.0 does not connect the PHP package to that of MySQL and we have to resort to some tricks to make them work together. Thus, for Red Hat, you have to proceed as follows: If Apache, PHP and MySQL are not already installed, install the appropriate packages. For Red Hat 8.0, choose the "Packages" menu entry as shown in Figure 3-22. Figure 3-22. Red Hat Menu: Packages. Red Hat Menu: Packages. Red Hat Menu: Packages. Once you have entered the system (as root), you can choose the three necessary pieces (Apache, PHP and MySQL): * Apache is found under "Web Server". * PHP is found under "Web Server". * MySQL is found under "SQL database Server". To see what is contained in each section, click on the "Details" link (Figure 3-23). Figure 3-23. Red Hat: Package Sections. Red Hat: Package Sections. Red Hat: Package Sections. After the selection of packages, you must click on "Update" and Red Hat will go on to install them, after it has checked their dependencies. Now, Apache, PHP and MySQL are installed, but unfortunately, we are not yet done: we must ensure that PHP will talk to MySQL. To this end, we must do 2 things: 1. Edit the php.ini file, so that PHP supports also files that start with " Terminal) * Login as root (command "su", then enter the password) * Start our preferred text editor (see Chapter 11). The editor will start with root privileges, so you can edit the php.ini file, usually located under /etc, and set the short_open_tag parameter to ON: ; Allow the tags are recognized. short_open_tag = On * For your local experiments, it is comfortable to also set safe_mode to OFF and register_globals to ON (but see Section 23.4.2 for the security related point of view on this). * Save everything and you are done with operation 1 above. * Operation 2 is simple: just copy the mysql.so file brutally into /usr/lib/php4/. You should do this with root permissions. The only thing that remains now, is to restart the services. We can do this from the command-line of a terminal window and also through a graphical tool. For the novice user, we will describe the graphical way - again, an advanced user will know how to do this from the comm