PHP+Apache+MySQL

To develop the site necessary expertise and software. Today, they reminded me of myself, because I decided to switch from work on a remote server to work on the localhost, for which it was necessary to just simply put the three applets:

Apache server itself (apache_1.3.31-win32-x86-no_src)
Base Mysql database (mysql-4.0.21-win32)
PHP programming language (php-5.2.3-win32)

Che seemed so tough, guided, ponazhimat run everything ready. And no, for the second hour has gone and I’m still trying to coordinate the work of all these programs. Even had time to dilute the pool table, so as not to lose the last nerves. :)

The beginning was the installation of Apache, everything is simple: never use another config! 🙂 Better Edit the default configuration. And it will be useful to you – remember that where and for what purpose, and the other will ensure restful sleep :)

With the Apache configuration is simple:

Prescribes a DocumentRoot
Rules ServerRoot, if you put the server in the default directory
Prescribed connection php:

AddType application / x-httpd-php php
ScriptAlias / php / “C: / PHP /”
#Action Application / x-httpd-php “/php/php.exe”
Action application / x-httpd-php “/php/php-cgi.exe”
SetEnv PHPRC C: / php

Appended to the DirectoryIndex index.php
And of course you are setting up a VirtualHost

<VirtualHost *>
ServerName Site
ServerAlias * .Site
AddDefaultCharset windows-1251
ServerAdmin none @ none
DocumentRoot “D: / WWW / Site /”
</ VirtualHost>

Since then, the Apache server you are armed. The case for small – to set the Mysql. Handle it any, but run it does not always work, if you do not do it with a constant periodicity. Start Mysql, you can:

c: \ mysql \ bin \ mysqld-nt.exe -s

Check the operation at this stage of the installation and configure the server on localhost is possible only with the help of different Tools. I suppose yuzayu MySQL-Front – nothing easier to come up with probably can not. Easy and convenient programmulina.

PHP is usually placed in the folder c: \ php \, and then, if you put him fifth version in php.ini uncomment the line:

extension = php_mysql.dll

To open the library for working with a Mysql database.

Theoretically, after all these steps, the server should start by simply pressing on the Start.exe, if you have filled in the base and the site itself, of course. But I have such a miracle did not happen even once in my life. This fact was not very happy, but that’s why I want to hear comments about your mistakes or nuances of how you set your server.

And while all this action takes place until the music was playing, Yandex mad and decided to ban the local proksik:

Yandex – proxy ban

Molodchaga. I found the enemy.

MySQL backup / MySQL restore

For each site owner who values their projects it is very important to be able to regularly backup your mysql databases, protect yourself from data loss. This post will help you to easily make backup & restore all your MySQL databases. And also help to export the data to make their import on another server.

MySQL backup / MySQL restore
MySQL
Backup
of
team
lines

Using SSH or Telnet access to your server, you can make a backup of databases using mysqldump commands. This command connects to the MySQL server and creates an SQL dump file. The dump file contains the SQL, necessary in order to be able to restore the database. Here is an example:

$ Mysqldump –opt -u [uname] -p [pass] [dbname]> [backupfile.sql]

Wherein:

[Uname] User Name Database
[Pass] Password to bazedannyh (after the -p do not need to use the space bar to enter a password)
[Dbname] The database name
[Backupfile.sql] The file name for the backup
[–opt] Mysqldump setting

For example, to export a backup database called as root without a password blogitcross blogitcross.sql file write the following command:

$ Mysqldump -u root -p blogitcross> blogitcross.sql

Using mysqldump commands so it is possible to back up specific tables from your database. For example, to export a table node and users from the database itcross can use the following command:

$ Mysqldump -u root -p itcross node users> itcrossbackup.sql

Let’s say you are driving and your blog and blogging help with your girlfriend :) Then of course you want to export two databases from MySQL:

$ Mysqldump -u root -p –databases crossblog yurmaryblog> backup.sql

And if you want to make a backup for the whole family you next use the command:

$ Mysqldump -u root -p –all-databases> all.sql

Now consider what options have mysqldump commands:

–add-drop-table – do so that the import mysql database is not a problem, and all of the existing tables have been previously removed;
–no-data – Allows you to make a database dump, without content, only the structure of the tables;
–add-locks – Creates a dump in extra LOCK TABLES and UNLOCK TABLES commands that will secure the import base on a live site against data loss.

Backup
base
data
MySQL
with
compression

One of my sites SOM – site on women’s issues 39-5.ru has a huge database, which makes the use of unrealistic backup without compression:

$ Mysqldump -u [uname] -p [pass] [dbname] | gzip -9> [backupfile.sql.gz]

To uncompress a dump file using a simple command:

$ Gunzip [backupfile.sql.gz]
Restore
MySQL
base
data

If previously we did backup databases, now let’s try to make the existing dump import base. First, create a database, for example it will be called blogitcross.

And now we do restore database:
$ Mysql -u [uname] -p [pass] [db_to_restore] <[backupfile.sql]

where

[Db_to_restore] – just be blogitcross
the rest you already know

To restore the base and at the same time it dekompressovat:

gunzip <[backupfile.sql.gz] | mysql -u [uname] -p [pass] [dbname]

This is perhaps all that is needed for correct work with databases. I hope it will be useful to you.

The Hacker Webzine