Web Entwicklung: Unterschied zwischen den Versionen
Aus Vosp.info
F (Diskussion | Beiträge) (→drop all tables per bash) |
F (Diskussion | Beiträge) (→Datenbank&Benutzer anlegen) |
||
Zeile 128: | Zeile 128: | ||
create user 'USERNAME'@'localhost' identified by 'PASSWORD'; | create user 'USERNAME'@'localhost' identified by 'PASSWORD'; | ||
grant all on DATABASE.* to 'USERNAME'@'localhost'; | grant all on DATABASE.* to 'USERNAME'@'localhost'; | ||
+ | </source> | ||
+ | |||
+ | === Datenbank&Benutzer anzeigen === | ||
+ | <source lang="bash"> | ||
+ | mysql -u root -p | ||
+ | </source> | ||
+ | <source lang="sql"> | ||
+ | show databases; | ||
+ | SELECT User,Host FROM mysql.user; | ||
+ | SHOW GRANTS FOR 'bloguser'@'localhost'; | ||
+ | </source> | ||
+ | |||
+ | === Datenbank&Benutzer löschen === | ||
+ | <source lang="bash"> | ||
+ | mysql -u root -p | ||
+ | </source> | ||
+ | <source lang="sql"> | ||
+ | delete databases; | ||
+ | REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'bloguser'@'localhost'; | ||
+ | DROP USER 'bloguser'@'localhost'; | ||
</source> | </source> | ||
Version vom 21. April 2019, 09:06 Uhr
svg
- http://www.mediaevent.de/2013/04/svg-in-html-seiten/
- http://stackoverflow.com/questions/6793312/how-to-use-jquery-in-svg-scalable-vector-graphics
apache
Installation
apt-get install mysql-server mysql-client apache2 php5 php5-mysql libapache2-mod-php5 phpmyadmin
/usr/bin/mysqladmin -u root password 'enter-your-good-new-password-here'
/etc/init.d/apache2 restart
Konfiguration für die Entwicklung
/etc/php5/apache2/php.ini
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = On
php
php4 nogoes in php5
fehlende Hochkommatas in Arrays
- php4
if ($quote)
$val[value]="'".addslashes($val[value])."'";
$this->fields.="`$val[key]`";
$this->values.="$val[value]";
- php5
if ($quote)
$val['value']="'".addslashes($val['value'])."'";
$this->fields.="`".$val['key']."`";
$this->values.="".$val['value']."";
SESSIONS
in php5 wurden folgende Funktionen entfernt
- session_is_registered
- session_register
function session_is_registered($x){
if (isset($_SESSION['$x']))
return true;
else
return false;
}
globale Variablen aus _POST, _GET, _FILES, _SESSIONS
- in php4 waren globale Variablen aus _POST, _GET, _FILES, _SESSIONS nicht im jeweiligen Array gekapselt
aus
$var_post
$var_get
$var_file
$var_sessions
wird
$_POST['var_post']
$_GET['var_get']
$_FILES['var_file']
$_SESSIONS['var_sessions']
pear
apt-get install php5-dev make php-pear
- http://blog.jerrevds.be/article/install-apc-or-pecl-debian
- wp:PEAR - PHP Extension and Application Repository
- wp:PEAR#PECL - PHP Extension Community Library
cairo
Installation
pecl install cairo
pecl install cairo channel://pecl.php.net/cairo-0.3.2
echo "extension=cairo.so" >> /etc/php5/apache2/php.ini
/etc/init.d/apache2 restart
Beispiel
$s = new CairoImageSurface(CairoFormat::ARGB32, 400, 400);
$c = new CairoContext($s);
$c->fill();
$c->setSourceRGB(1, 0, 0);
$c->setLineWidth(50);
$c->arc(200, 200, 100, 0, 2 * M_PI);
$c->stroke();
$c->setSourceRGB(0, 0, 0.6);
$c->rectangle(0, 160, 400, 75);
$c->fill();
$s->writeToPng(dirname(__FILE__) . '/test.png');
Probleme
falls das php nicht interpretiert wird, sondern stumpf ausgegeben wird
/etc/php5/apache2/php.ini da nicht "<?php" verwendet wird, muss der short_open_tag aktiviert werden!!!!
short_open_tag = On
mysql
Datenbank&Benutzer anlegen
mysql -u root -p
create database DATABASE;
create user 'USERNAME'@'localhost' identified by 'PASSWORD';
grant all on DATABASE.* to 'USERNAME'@'localhost';
Datenbank&Benutzer anzeigen
mysql -u root -p
show databases;
SELECT User,Host FROM mysql.user;
SHOW GRANTS FOR 'bloguser'@'localhost';
Datenbank&Benutzer löschen
mysql -u root -p
delete databases;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'bloguser'@'localhost';
DROP USER 'bloguser'@'localhost';
export import
# export
mysqldump --single-transaction --default-character-set=utf8 -u _username_ -p _databasename_ > mysql.yyyymmdd.sql
# import
mysql -u _username_ -p _databasename_ < mysql.yyyymmdd.sql
drop all tables per bash
#!/bin/bash
MUSER="$1"
MPASS="$2"
MDB="$3"
MHOST="$4"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
if [ $# -ne 4 ]
then
echo "Usage: $0 {MySQL-User-Name} {MySQL-User-Password} {MySQL-Database-Name}"
echo "Drops all tables from a MySQL"
exit 1
fi
TABLES=$($MYSQL -u $MUSER -h $MHOST -p$MPASS $MDB -e 'show tables' | $AWK '{ print $1}' | $GREP -v '^Tables' )
for t in $TABLES
do
echo "Deleting $t table from $MDB database..."
$MYSQL -u $MUSER -h $MHOST -p$MPASS $MDB -e "drop table \`$t\`"
done