skip to main | skip to sidebar
Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Thursday, February 15, 2007

Eclipse, Php Ide and Gentoo

As I said yesterday, I successfully installed eclipse and phpide in my Gentoo box. I had also set up the link to mysql socket, as I had explained in my previous post.

However, as soon as I tried to run a php script that uses mysql functions I got this error:

Warning: mysql_connect() [function.mysql-connect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client in /home/bettini/workspaces/php/dbtophp/share/db.php on line 23
could not connect to database


Fortunately, this is a known error in mysql documentation: http://dev.mysql.com/doc/refman/5.0/en/old-client.html.

In fact, I just did what that page says, i.e., reset the password to the "old" style:

mysql> SET PASSWORD FOR 'some user'@localhost = OLD_PASSWORD('your password');

and the error went away.

Probably this was due to the fact that mysql is version 5.0, but the php engine that comes with phpide (and that I use for running and debugging scripts from within Eclipse) still uses the old mysql functions for connecting to the database.

Pubblicato da betto a 11:19 AM 2 commenti

Etichette: , , , ,

Wednesday, February 14, 2007

Apache2, PHP, MySql (Gentoo Linux)

I've just installed Apache, Php and MySql in my Gentoo box; I've always used these programs and servers only under Debian since they looked easier to install (or probably they looked harder to install in Gentoo :-). I actually found out that it's quite easy to install them in Gentoo either!

I followed some documents found on the web, but basically the installation procedure was even faster than that found on the web:

I put these lines in /etc/make.conf:

USE="apache2 mysql php pam ssl xml xml2 berkdb innodb jpeg png"


If you want to install also phpmyadmin, then you should also add pcre session unicode:

USE="apache2 mysql php pam ssl xml xml2 berkdb innodb jpeg png pcre session unicode"


then I simply ran:

emerge dev-db/mysql apache php

after few minutes (well... half an hour would be more appropriate) the installation terminated successfully.

I then changed the file /etc/init.d/apache2, in order to enable public_html folders for users (corresponding to the ~ directory), setting -D USERDIR:

APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D USERDIR"

Before starting mysql, you must create (once and for all) the mysql main database, and this can be done simply by running:

/usr/bin/mysql_install_db

then you're ready to start apache and mysql.

Pubblicato da betto a 11:50 AM 9 commenti

Etichette: , , ,

Wednesday, December 27, 2006

PhpBibliography 0.4 - web based bibliography system

I've released version 0.4 of PhpBibliography, http://phpbibliography.sourceforge.net, a web based bibliography system that allows you to publish your bibliography online (and to edit it via web). It is implemented in Php and uses MySql. This is free software, open source, released under GPL.

There are many new features in this release (I hope you find useful).

First of all, you can also modify a paper by using a bibtex (previously you could only insert a new paper by using a bibtex). For this reason, the bibtexkey field was added to the database (and w.t.r. I added also the function in the admin menu to automatically generate bibtex key for papers which do not have it yet). Furthermore, you can also upload an entire bib file; this will allow you to set up the bibliography site with only one action (of course you'll then be able to modify each inserted paper).

Papers can now be classified according to several criteria (called classifications), not only by using categories. You can add new classifications, and for each classification you'll be able to add values that can be associated to papers. For instance, you can have the classification "keyword", the classification "status" with values "submitted", "to appear", "published", etc. This is very useful also for (virtually) adding a new field to the paper table structure. Classifications can be related to a specific bibtex field, so that they can be retrieved from bibtexs (and also generated in the corresponding field, during the automatic bibtex generation).

A functionality was added (available from the admin menu) that allows you to "merge two authors" that, due to a mistake, represent the same author. (This usually happens when inserting a paper through a bibtex.) For instance you have two authors Foo Bar and Foo T. Bar that represent the same author. With this function, the system will replace the second author with the first author (i.e., the second author will be deleted and all the papers that were associated to the second author will be associated to the first author).

From the paper presentation point of view some customization features were added: you can pass additional parameters in the URL (you can also specify them in the config.php file, but the ones passed on the URL will take the precedence). Here we list these parameters (in the URL they must be passed without the ,ドル using the GET passing method syntax) and their default values:

  • $printfilenames = "1"
    This tells the paper formatter whether to name the link to the paper source using the complete name of the file (e.g., my_paper.ps.gz). If set to "0", then only the extension of the file will be shown (e.g., ps.gz).
  • $linktodetails = "1"
    The title of the paper will link to a separate page with complete details about that paper. If set to "0", no link will be generated.
  • $noheader = "0"
    If set to "1" the generated page will contain no header information (i.e., it will not even contain the css definitions). This is useful when you want to include the output of phpbibliography into another web page and you want customize it with your own css definitions.
  • $paperorder
    Specify the sorting criteria of the shown papers. For the moment the only possible value for this parameter is title (meaning that papers will be ordered according to their title).
For instance, the following screenshot shows the output where printfilenames is set to "1"
while the next one shows the output where printfilenames is set to "0"
Finally, some bugs were fixed (in particular the authentication problem in php 5, due to the use of wrong variable names, see also this post on this blog).

Hope you enjoy this new version of PhpBibliography (yeah, I know, the logo is not that beauty, but that's just the beginning :-)

Pubblicato da betto a 7:13 PM 2 commenti

Etichette: , ,

Wednesday, November 29, 2006

Cron and MySql Database Backups

This is nothing very special or exciting, it's just a script that I run as a cron job to make the backup of a mysql database. It can be customized according to several parameters. The script is intended to be run once a day, in fact the file name that is created contains the date in the shape of month_day_year. If you need to run this script more than once per day, you need to add also the time in the file name (otherwise the previous backup in the same day gets overwritten).

You can also customize the parameters that you pass to the programs, e.g., mysqldump and gzip. And of course, you need to set the right values for the username, the password and the database name (and also the path where the backup will be save, which, by default it's the backup directory in your home directory, so please make sure this directory exists).

Here's the script, hoping you find it useful somehow :-)

#!/bin/sh

DATABASE=bibliography
USER=root
PASSWORD=pippo
FILENAME=backup_
PATH=$HOME/backup
MYSQLDUMP=/usr/bin/mysqldump
GZIP="/bin/gzip --best"

BACKUP=$PATH/$FILENAME`/bin/date +%m_%d_%y`.sql.gz

if $MYSQLDUMP -u $USER -p$PASSWORD $DATABASE | $GZIP > $BACKUP; then
echo "backup successful: $BACKUP";
true;
else
echo "errors during backup";
false;
fi

Pubblicato da betto a 4:56 PM 0 commenti

Etichette: , ,

Thursday, October 05, 2006

PhpBibliography 0.3 - web based bibliography system

I've released version 0.3 of PhpBibliography, http://phpbibliography.sourceforge.net, a web based bibliography system.

PhpBibliography allows you to publish your bibliography online (and to edit it via web). It is implemented in Php and uses MySql. This is free software, open source, released under GPL.

The main features of the system are:

  • stores all papers details in a SQL database
  • handles uploads of files (e.g., .pdf of papers)
  • automatically generate bibitems
  • supports insertion of papers through existing bibitems
  • allows paper search and filter (e.g., authors, title, keywords, etc.) mechanisms
Papers are publicly visible but can be modified only via an authentication mechanism (based on users and passwords).

Papers are all stored in a common database, and can then later be filtered according to a specific authors so that each author can show his/her own papers in his/her own page (for instance at http://www.lorenzobettini.it/papers the papers shown are collected from two different phpbibliography installations; the papers are included in this webpage by using a remote URL inclusion mechanism by specifying, in URL the filter criteria -- in this case, the filter is to show only my papers).

Pubblicato da betto a 11:46 PM 0 commenti

Etichette: , ,

Subscribe to: Comments (Atom)
 

AltStyle によって変換されたページ (->オリジナル) /