Questions fréquement posées sur dacode

# Da FAQ

- General issues
  - What are the differences between topics and sections?
- Hosting
  - Can daCode be installed on my.provider.com?
  - My provider uses PHP4 and only allows for .php exentsions. How can I get daCode to run?
  - I don't have acces to the mysql client program. How can I create the database?
  - Can I use daCode on Free.fr (french-centric question:-) )?
  - There is a problem with the mail() function. Seems like it does not work.
  - I get many "Maximum execution time exceeded" errors. What can I do?
  - daCode displays : Fatal error: Forbidden port in your script on line 97
- Configuration
  - Is there a way to configure the location of the daCode files?
- Various problems

  - I get an error "Cannot redefine class ..."

    I use phplib. Can I use dacode with it?

  - I can only get empty pages. What happend?
  - I cannot connect to MySQL as root. Still I'm pretty sure of the root password.
- Customization
  - How can I change the site's look? How can suppress some elements on the pages?
- Using daCode
  - I changed te admin password in the database, and I cannot log in anymore.

## General issues

### What are the differences between topics and sections?

#### Answer

Well, the topics tell you what the news is about. The sections allow you to move off-topic news out of the front page. For exemple, on Linuxfr.org, all news about cinema are put in a special section. Very seldomly does one of this news appear on the front page (only if it has a direct connexion with Linux). There is also a section to allow users to ask their questions: these news concern about any topic, but their type is inherently different from the standard, informative news. Thus they have been grouped in a section.

## Hosting

### Can daCode be installed on my.provider.com?

#### Answer

Most probably, yes. daCode is known to run with PHP on safe mode, which is the case of most hosting providers. Some providers also have forbidden the use of the mail function. If you're in this case, see below.

### My provider uses PHP4 and only allows for .php exentsions. How can I get daCode to run?

#### Answer

daCode can work with any extension. For common extensions, if you arev running a Unix-like operationg system, just cd to the daCode directory and type

    $ make php

to change the extensions as well as the links inside the files. This will work with php, php3 and php4 extensions.

If you need some excentric extension, you'll have to modify the makefile. Ask on dacode-user list if you have a problem.

Warning (big one in red, with flashing lights): CVS will only work with original extensions, thus you'll have to switch back to .php3 (make php3) before getting the last changes with CVS.

### I don't have acces to the mysql client program. How can I create the database?

#### Answer

Simply use phpMyAdmin. Probably your provider has already set this up for you. See with him how to acces the database adminstration interface. Alternatively, you can download a copy (it' free software, too) and install it.

Once you are in the administration interface of phpMyAdmin, select your database, then "run queries on database". Choose the file sql/daCode.mysql and validate the form.

### Can I use daCode on Free.fr (french-centric question:-) )?

#### Answer

Yes, it works... If you've got an account on Free.fr, we can assume you're french, so got read to french version. Maybe there are the same problems on non-french hosting providers... if so, please let us know.

### There is a problem with the mail() function. Seems like it does not work.

#### Answer

Probably the mail() function has been disabled. Ask your provider to find out, and to find if a replacement is available. The BIG problem is that without a way to automatically send mails, users will never get their passwords, and thus will never be created at all...

If there is a replacement function, seach the calls to the mail function in the source and replace it with the specific function for your provider. Be careful: the number of arguments an their order may not be the same.

If there's no replacement available, or if you can just send a mail to yourself, there are some ugly turnarounds, described below.

First solution (by Matthieu Ros): if you have a way to send mails to yourself, use this to send the passwords to yourself... Of course you will know the passwords of all your users...

Second solution (by Guillaume Postaire): you print the password instead of sending it.

### I get many "Maximum execution time exceeded" errors. What can I do?

#### Answer

Drop out any feature you don't really use. Also disable all functions in src/phplib/backends.php3. Just add "return;" at the begining of every function there. Once you are satisfied with the speed, you may reintroduce some features...

### daCode displays : Fatal error: Forbidden port in your script on line 97

#### Answer

A classical problem. In the file newsindex.tmpl of the linuxfr theme, daCode calls a fonction which gets the latest versions of the Linux kernel. This uses finger(???) and your provider may very well forbid any outgoing connexion on this port.

Just comment (with a hash mark on the begining of the line) the offending line in the template.

## Configuration

### Is there a way to configure the location of the daCode files?

#### Answer

What you can do is to put phplib into htdocs/. Better put someting hard to guess (for the exemple sake, secret):

    mv phplib htdocs/secret

And then edit htdocs/daCode.php3 to change $libdir:

    $libdir = $topdir . "./secret";

and this should work.

## Various problems

###

I get an error "Cannot redefine class ..."

I use phplib. Can I use dacode with it?

#### Answer

This applies only if there's a auto_prepend statement in php.ini file. If you are using Apache, you can move the statement to .htaccess (that is a file that you put into your directories that are using phplib). To work properly, you need to check the directory tag/AllowOverride from httpd.conf to be sure that the file .htaccess is parsed. Exemple .htacces file for php4

    <IfModule mod_php4.c>
        #
        # local settings for php in this domain
        # include path is the path where PHP looks for
        # required and included files
        #
    #php_value include_path
    ".:/home/httpd/lib/externs/phplib/php/:/home/httpd/lib/php/internal/"
      php_value auto_prepend_file
    /home/httpd/lib/externs/phplib/php/prepend.php3
    </IfModule>

### I can only get empty pages. What happend?

#### Answer

This comes probably from the database, which is ignored by PHP. Just look at the file php.ini or php3.ini to see if the database extensions are loaded.

If the extension is not loaded, you'll have to modify the config file, and restart the web server.

ANother way to see if the extension is loaded is to create a small file containing only

### I cannot connect to MySQL as root. Still I'm pretty sure of the root password.

#### Answer

The root password for MySQL is different from the unix root password. By default, the MySQL root password is empty. You may want to specify one with mysqladmin -u root password new_password

## Customization

### How can I change the site's look? How can suppress some elements on the pages?

#### Answer

You'll have to create your own template. If you can read french, you should definitively have a look at the template.html file in the doc/html directory. (and maybe you could also translate it...)

## Using daCode

### I changed te admin password in the database, and I cannot log in anymore.

#### Answer

The passwords are crypted. You cannot change it directly in the database. If the admin email in the table "users" has a valid email field, just use "I forgot my password" on the front page. A new one will be mailed to you.