$reader = new XMLReader();
$reader->XML($data);
while ($reader->read()){
echo $reader->name;
if ($reader->hasValue) {
echo “: ” . $reader->value;
}
}
$reader->close();
Category Archives: Hosting
sql – default value when no match found
SELECT COALESCE((SELECT name FROM users WHERE id = 1), ‘Unavailable’) FROM DUAL;
modsecurity: error – PCRE limits exceeded
vi /usr/local/apache/conf/pcre_modsecurity_exceeded_limits.conf
SecPcreMatchLimit 150000
SecPcreMatchLimitRecursion 150000
chmod 600 /usr/local/apache/conf/pcre_modsecurity_exceeded_limits.conf
vi /usr/local/apachec/conf/modsec2.user.conf
in section IfModule mod_security2:
include "/usr/local/apache/conf/pcre_modsecurity_exceeded_limits.conf"
/etc/init.d/httpd restart
cPanel – DBI connect(‘modsec:localhost’,’modsec’,…) failed: Can’t connect to local MySQL server through socket
If you have error like:
/etc/cron.hourly/modsecparse.pl:
DBI connect(‘modsec:localhost’,’modsec’,…) failed: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) at /etc/cron.hourly/modsecparse.pl line 19
Unable to connect to mysql database at /etc/cron.hourly/modsecparse.pl line 19.
Fix:
less /etc/cron.hourly/modsecparse.pl
mysql;
use mysql;
UPDATE user SET Password=PASSWORD(‘$dbpassword’) WHERE USER=’modsec’;
flush privileges;
exit;
cpanel rndc: ‘reload’ failed: unexpected end of input
It usually means you have some syntax errors in your named.conf. And there are many chances after reboot bind will not start.
Ok lets fix it:
service named status
WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
version: 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1
you can try: /scripts/rebuildnamedconf
This script is deprecated. Please use /usr/local/cpanel/scripts/rebuilddnsconfig instead.
Executing /usr/local/cpanel/scripts/rebuilddnsconfig
Named could not be restarted, any obvious config errors should show up below this line.
WARNING: /etc/named.conf appears to contain errors which could not be corrected automatically!
/etc/named.conf:14394: unknown option ‘.tk.db’
/etc/named.conf:17217: unexpected end of input
Please correct these errors manually and rerun /usr/local/cpanel/scripts/fixrndc
you need manually check named.conf line 14394 and remove some incorrect entries from you configuration files.
then try to start named:
service named start
directadmin limit the number of emails sent by each user
if (open (LIMIT, “/etc/virtual/limit_$name”))
If you have that line in your exim.pl, then you’re good to go. If not, save it to /etc/exim.pl and restart exim. The same basic rules apply, you just need to type:
echo 300 > /etc/virtual/limit_username
where username is the User you wish to give the special limit to. This overrides the default /etc/virtual/limit file for that User.
If you think you might have a spammer, check your /etc/virtual/usage directory for a larger than normal filesize.
Any authenticated sends will show up with this command:
cd /var/log/exim
grep ‘A=login:’ mainlog* | less
which will show all emails sent from your server which used smtp-authentication. This is useful to find any email accounts who’s passwords may have been compromised (guessed), or simply just abusive Users.
With DA 1.42.0 and /etc/exim.pl version 13, you can use a per-email send limit, where you can limit each individual email account to a daily limit, eg:
echo 50 > /etc/virtual/user_limit
echo user_can_set_email_limit=1 >> /usr/local/directadmin/conf/directadmin.conf
/etc/init.d/directadmin restart
cPanel phpMyAdmin “Cannot start session without errors”
If you can’t access your phpmyadmin and have this error on all your acounts “Cannot start session without errors”, you should try:
rm -rf /tmp/sess_*
amavis – TROUBLE in pre_loop_hook: db_init: BDB no dbC: __fop_file_setup: Retry limit (100) exceeded, File exists. at (eval 80) line 283.
if you are getting some kind of error like this: delivery temporarily suspended: connect to 127.0.0.1[127.0.0.1]:10024: Connection refused.
In your logs you can find some errors like: TROUBLE in pre_loop_hook: db_init: BDB no dbC: __fop_file_setup: Retry limit (100) exceeded, File exists. at (eval 80) line 283.
its amavis bug, you can fix it:
/etc/init.d/amavis stop
rm -rf /var/lib/amavis/db/*
/etc/init.d/amavis start
sendmail -q
InnoDB: Reading tablespace information from the .ibd files…
InnoDB is designed to recover automatically in these cases, but it may take some time. Usually minutes, but possibly hours if the crash occurred when you had thousands of pages of modified data in memory, and your disks are slow.
mysql find ib_logfile location
lsof -c mysqld | grep ib_logfile
CageFS jail error Skeleton directory is not mounted: /usr/share/cagefs-skeletor
If you found this error in your suexec_log, it means you should remount all your accounts:
cagefsctl –remount-all
service mysqld restart
mysql restore all databases from backup
Do a mysqldump of all databases (mysqldump –event -A), procedures, triggers etc except the mysql and performance_schema databases
Drop all databases except the above 2 databases
Stop mysql
Delete ibdata1 and ib_log files
Start mysql
Restore from dump
generate a CSR SSL certificate request
openssl req -nodes -newkey rsa:2048 -keyout domain.key -out domain.csr
centos check SSL heartbleed vulnerability
rpm -q –changelog openssl | grep -B 1 CVE-2014-0160
cPanel remove user command line
/scripts/killacct username