简体   繁体   中英

Adding a script to index.php

Dear stackflower users,

A few days ago there was a power outage and my mysql database was lost... (I did have a one month old backup)

So I started looking for a program that makes backups of my mysql database automatically. I found a script that does exactly this, its called phpMyBackupPro

According to the readme I had to add:

    require_once("phpMyBackupPro/schedule_backup.php");

To a page that gets loaded frequently (for example index.php)

So I tried adding this to my index.php page of joomla and clearing my joomla and browser cache. However the backup files are not being created when I load the index.php, when I run the script manually they are however.

So I started looking for some addons that could load php files in joomla, but they either didn't work or they where not compatible with joomla 1.7.

is their anyone who knows how to get this script to work, or knows a better way of automatically backing up mysql databases on windows?

calling this script from the index.php is bad coding practice. God knows what does this script do!

I recommend Akeeba Backup , I used it with small and large Joomla installations and it works like charm.

What I recommend more is to have periodic full account backup (ex cpanel), these backups holds more info (cron jobs, emails, ...) and are easier and faster to restore (if you have sufficient privilege of course).

EDIT: You don't have to have cpanel to make account backups. You can use shell scripts like this or that and use cron job to activate them.

I would avoid trying to what you mentioned and instead use a Joomla specific extension such as this:

http://extensions.joomla.org/extensions/access-a-security/site-security/backup/15682?qh=YToxOntpOjA7czoxMDoibGF6eWJhY2t1cCI7fQ%3D%3D

I have used this for years and it has saved my ass on multiple occasions so happily recommend it!

Having said that if you're dead set on what you've mentioned simply add it to the BOTTOM of your template file located: templates/your_templates/index.php

Hope this helps,

Andy

I made a solution for windows uswers:

I made a bat file script:

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" --result-file=E:\mysql\backup.sql "-uroot" "-password" --databases joomla server phpbb

This is an example where you replace the text password with your own password and root with the username(in most cases this is root) the database names are joomla, server and phpbb.

This program runs every 1 hour be using the task schedule in windows.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM