September, 2013Archive for

Backup mysql database with php and zip

Many php applications prefer to backup the mysql database from within the application and save it as an archive. The mysqldump commandline utility can be used to perform this function of backing up a mysql database as sql file. The command would be like this : The above command shall dump the database named $db_name into a sql file in directory $dir. This sql file shall be next zipped using php's Ziparchive class. In the above example backups/backup.sql is the path to the sql fil...

用.htaccess设置禁止显示Apache目录列表

注意:使用此方法不当时,设置的.htaccess文件会引起403 Forbidden 禁止访问的问题 如何禁止 Apache 显示目录列表呢? 缺省情况下如果你在浏览器输入地址:http://localhost:8080/ 并且你将你的目录索引文件设置为 index.html,且你的文件根目录里有 index.html,浏览器就会显示 index.html的内容,如果没有 index.html,浏览器就会显示文件根目录的目录列表,目录列表包括文件根目录下的文件和子目录。(注:索引文件的设置:)#在这里,你可以设置某个目录被请求时,首先执行的文件 同样你输入一个虚拟目录的地址:http://localhost:8080/b/ 如果该虚拟目录下没有 index.html,浏览器也会显示该虚拟目录的目录结构,列出该虚拟目录下的文件和子目录。 如何禁止 Apache 显示目录列表呢? 在 httpd.conf文件里找到类似这样指令: 将指令作这样的修改: 方法一:在Options Indexes FollowSymLinks在Indexes前面加...