wiki:GetStartedWithTheCode

Version 25 (modified by lemon-head, 11 years ago) (diff)

how do i get the database running?

Developers who offer to help with:

Micha (lupochen): CSS-structure (including YAML-Framework), simple questions about PT

Developers who need help with:

Step by step instruction

Reading

Information that has yet to be copied from BV wiki (in progress)

  • Software_Development - workplace#Short introduction to the framework|Short intro to the framework
  • BW development environment
  • Subversion info
  • Programming guideline
  • Travelbook *getting started with the TB code

New style

Coordinated by guaka

We want to make it a lot easier to get started.

Windows

See

#106
Test and improve the GetStartedWithTheCode zip package and instructions.
#169
update / cleanupt INSTALL information

We're working on a one-file installer, that includes WAMP. You will be able to just unzip the file, launch a batch file, and off you go. It will come with read-only access to the repository, but you can send patches to developers with write access or request write access.

  1. Download the file https://www.bewelcome.org/svn/develstuff/trunk/wamp/bw-rox_wamp.zip
  1. unzip it in C:\wamp (It has to be exactly this path, unless you want to twiddle with the Apache configuration.)
    • Maybe someone can add what exactly needs to be changed, if you want a different path?
  1. edit C:\wamp\wampmanager.ini
    • Find the section named [Menu.Left]
    • In this section, there are some filesystem paths that are supposed ot point to your browser. You need to check if they are correct, and modify them if necessary. Otherwise, some menu items in wamp tray menu will not work. ("Could not execute menu item")
  1. run any *.bat files, until you see the wamp icon in the tray menu, saying "both services running". There are four of them that look promising:
    • C:\wamp\install_mysql_service.bat
    • C:\wamp\install_services.bat
    • C:\wamp\install_services_auto.bat
    • C:\wamp\launch_wampserver.bat Anyways, guaka (and lemonhead as well) can get the wamp tray icon.
  1. Left-click on the wamp icon, and try "phpMyAdmin" and "localhost" in the menu
  1. rename htdocs/config.inc.php.example to config.inc.php and modify the configuration settings (FUTURE: This should be done for you in the .zip file.)

Someone needs to explain point 6 please !!! I don't find any "htdocs" folder with this file. -- lemonhead

  1. How do I get the database running? This should be a part of these instructions!!

Troubleshooting - Conflicts with older versions of PHP

One problem I (lemonhead) ran into was "GD lib required!", when trying to launch http://localhost/bewelcome. (yes, php_gd2 is already running..)

If something doesn't work (for instance, "GD lib required"), the reason can be that you have older installs of PHP somewhere.

  • check http://localhost/?phpinfo=1 with your browser (with wamp running)
  • find-in-page (Ctrl-F) for "php.ini"
  • There should be a line saying "Loaded Configuration File - C:\wamp\Apache2\bin\php.ini"
  • If you have another path instead, then there is something wrong.

The following solution assumes that you are no longer interested in these old versions of PHP stuff. So, what I tried (lemon-head):

  • disable older stuff by changing "foldername" to "foldername_disabled".
  • change paths in Windows setup.

I don't know which of them did the job. If you can find out, please add this here!

Mac OS X, GNU/Linux, other Unices

  • Get the latest from subversion.
  • Please refer to INSTALL.

Current, old style: Steps to take

Install Apache, PHP, MySQL

<small>Apache is webserver software, PHP is a programming languages used to create websites, and MySQL is a database server. You need all three to run BeWelcome on your own machine. Fortunately there are convenient ways to get all 3 at once.</small>

  • <small>Do NOT use XAMPP on Windows - you end up with strange problems and nobody can help. (And on GNU/Linux you need root access to use XAMPP, in which case you better properly install the stuff.)</small>
  • Try WAMPSERVER on Windows before digging deeper or asking questions. Additional steps needed for WAMP: *enable gd lib in <tt>php\php.ini</tt> in the directory where wamp was installed (just remove the ";" comment symbol): extension=php_gd2.dll
  • easyPHP is also a good option. You'll need to: download at least v2.0beta set <tt>DocumentRoot</tt> in <tt>easyPHP/conf_files/http.conf</tt> to the htdocs directory of your repository don't forget to update the Directory directive some lines below to the same path! alter <tt>conf_files/php.ini</tt> and set short_open_tag = on restart Apache afterwards create a DB and fill the tables with phpMyAdmin, accessible via <tt>http://localhost/home</tt>

Install Subversion, Get the Code

command line tool

On GNU/Linux, MacOS X and Cygwin you'll probably want to use the commandline tool:

Set up the Database

  1. Download the test-database dump from https://www.bewelcome.org/svn/develstuff/trunk/testdb/
  2. Create a new database, e.g. <tt>mtb</tt>

# Close Skype, if you have it running (Skype is known for taking over the ports Apache would use otherwise, Apache ports can can be set in apache config files but a quick workaround is to shut down Skype while you start up WAMP - you can restart Skype after that) # Go to http://localhost/phpmyadmin/ # On the right side of the screen, you should see "Create new database"

| Please explain more!!! I'm using WAMP5 on WinXP, and it says "All services running - server offline". Kasper said I should launch phpMyAdmin from the leftclick menu on WAMP tray icon, which sends my browser to http://localhost/phpmyadmin/, an address that is not found!!

What needs explanation:

  • How do I "create a new db" ? Is this a command in WAMP, or what?
  • What are the steps to do this (do I need some services to run before that can happen, etc).

-- User:Lemon-head|lemon-head 02:10, 13 September 2007 (CEST)

  1. Create a new user, e.g. <tt>mtb</tt>
  2. Add geographical data to the database by importing the files <tt>geonames_admincodes.sql.bz2</tt> and <tt>geonames_cache.sql.bz2</tt> from the folder <tt>/maintenance/mysql/</tt> of your svn repository into the database. This step is necessary to be able to create new profiles and users with your local website. <small>Note 1: This step might cause problems, if you use phpMyAdmin: Older versions of phpMyAdmin couldn't import large files; if you run a new version, check upload_max_filesize and post_max_size in your php.ini file; furthermore, if you want to import bz2 files with phpMyAdmin uncompressed, php modules [bzip2] might be missing to do so. With files large as these, it is always a much better idea to use the mysql command line utility instead of phpMyAdmin. (e.g. <tt>bzcat geonames_admincodes.sql.bz2 | mysql mtb -u mtb -p</tt>)</small> <small>Note 2: If you haven't made the svn checkout, download the files from <tt>https://www.bewelcome.org/svn/hcvol/trunk/maintenance/mysql</tt>.</small> (attention, this directory doesn't exist in the repository anymore, following paragraph might be the correct one? [[User:Narnua|Anu]] 20:50, 23 August 2007 (CEST))

phpMyAdmin

  • set it up (e.g. within phpMyAdmin create a new database and import the files from this directory) and an account for it (or if you use WAMP, you can just use root and an empty password).

command-line

svn checkout https://www.bewelcome.org/svn/develstuff/trunk/testdb/
cd testdb
$ mysql -u username -p
mysql> CREATE DATABASE mtb
mysql> Ctrl-D
$ gzip -d hcvoltest.sql.gz
$ mysql -u username -p mtb < hcvoltest.sql

Provide and Edit Configuration Files

In the following replace [repository] with the folder that contains your svn repository. Configure:

  • Set DocumentRoot in wamp/Apache2/conf/httpd.conf to the htdocs directory of your repository.
  • On Unices you can try to <tt>cp setup/apache2/sites-enabled/001-bewelcome /etc/apache2/sites-enabled/</tt>
  • Don't forget to update the Directory directive some lines below to the same path.
  • Copy [repository]/htdocs/.htaccess.example to [repository]/htdocs/.htaccess .
  • Be sure RewriteBase? in [repository]/htdocs/.htaccess points to "/" (without quotationmarks) or whereever you want to run your BeWelcome site from. Eg. if /htdocs is not your webserver root, but a subdirectory of it, RewriteBase? should point to "/htdocs/".
  • Copy [repository]/htdocs/bw/lib/config.php.dist to [repository]/htdocs/bw/lib/config.php.
  • Edit [repository]/htdocs/bw/lib/config.php. Modify the following variables. (These are relevant eg. when you experiment with the signup process.) $_SYSHCVOLEmailDomainName? should point to your prefered host, which is probably "localhost". $_SYSHCVOLMailToNotifyWhenNewMemberSignup? should point to your prefered e-mail address, which is something like "myusername@localhost".
  • Copy [repository]/inc/config.inc.php.example to [repository]/inc/config.inc.php .
  • Edit [repository]/inc/config.inc.php. Modify at least the following variables: $dbdsn? $dbuser? $dbpassword? $envbaseuri? : Example with wamp standard installation, using the root account:
  // database dsn
  $db['dsn']  = 'mysql:host=localhost;dbname=bewelcome';
  // username
  $db['user']     = 'root';
  // password
  $db['password'] = '';
  .
  .
  $env['baseuri']       = 'http://localhost/[repository]/htdocs/';

Run BeWelcome

Now you should be able to make a request to the start page of BW and see the appropriate page in your browser. The login should be working. For login and testing purposes you can use one of the existing users (username/password):

It's probably easiest to make all passwords into "password", i.e. in MySQL you can do

 UPDATE  members SET password = PASSWORD("password")
 :::<small>''This should be done for the test database that is given to developers.''</small>
  • admin/password : full rights
  • accepter/password : can accept your newly created member
  • username/password : several usernames (such as hkroger, jeanyves) with different sets of rights. In case of problems please read the list of problems carefully (??). If this doesn't help, please contact one of the active programmers.

Problems

See #Troubleshooting

See also

Communication

Mailinglists

==Troubleshooting==

Some common issues and solutions...

  • In general, if you get errors regarding certain requirements, just try to modify your php and webserver setting files and turn on certain modules/libraries that are needed. Two important needed modules are GD for php (if you're using WAMP, check that php_gd2 is on under php extensions) and the rewrite module (this one is found under apache modules in WAMP).
  • If you get a "Data dir error!" message, change all permissions for the directory /data to 777 (= read, write and execute for everybody). chmod 777 data
  • For WAMP, make sure that safe mode is not on, or you might have some problems accessing the DB through mysql.
  • In case of a "GD lib required!" message, install the php-gd - libs (occured under ubuntu/Linux and under Windows with WAMP)
  • If you get the message "System error, please report the following timestamp along the error", try to set "magic quotes gpc" to "Off" in your php.ini and restart Apache. If this doesn't help, have a look into the error log of your Apache.
  • If you want photo uploading working manually, modify this line in /bw/htdocs/bw/lib/config.php
 ->$_SYSHCVOL['IMAGEDIR'] = "/var/www/BeWelcome/htdocs/bw/memberphotos/";

where /var/www/BeWelcome/ is the directory where you have stored your files.

  • If you click on "Community" and get an HTTP error 404 ("Object not found" or something similiar), something is wrong with your file [repository]/htdocs/.htaccess . Are you sure it is read by your webserver? Include some smut in the first row of the file to check, that the webserver does indeed pay attention for it.

Fatal error: Class 'DOMDocument' not found

Error

Fatal error: Class 'DOMDocument' not found in /path/to/bw/trunk/inc/base.inc.php on line 12

Solution

Create a new php file with this code in it:

 <?php phpinfo(); ?>

Then load the page in your browser, and search for "--disable-dom". If it's present, then XML functions are not installed on your PHP version. On an RPM based system (Linux) this command should work:

 # yum install php-xml

This worked for me. Chmac|Callum</small></sup>