• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Error creating domain through CLI

jorfermo

Regular Pleskian
Hi

I'm trying to create a new domain with the CLI tools and I'm getting this error:

/usr/local/psa/bin/domain -c jopontie.alumnos.upv.es -clogin jopontie -ip 158.42.250.241 -hosting true -hst_type phys -www true -login jopontie -passwd je8ujy6y -passwd_type encrypted
PHP Notice: Undefined variable: cl_id

An error occured during domain creation: MySQL query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND (d.name IN ('alumnos.upv.es','upv.es') OR da.name IN ('alumnos.upv.es','upv.' at line 1

Any idea why?

Thanks
 
Try to enable mysql logging and investigate SQL queries in /var/log/mysqld.log after this command.
 
This is what i get:

101216 9:10:24 76 Connect admin@localhost on
76 Init DB psa
76 Query SHOW VARIABLES LIKE 'version'
76 Query select param, val from misc
76 Query SET NAMES utf8
77 Connect admin@localhost on psa
77 Query SELECT 1
77 Query SET NAMES utf8
76 Query SELECT id FROM locales WHERE id = 'en-US'
76 Query SELECT id FROM locales WHERE active = "true" AND id <> "en-US"
76 Query delete from lockout where (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(last_wrong)) > (30 * 60)
76 Init DB psa
76 Query SHOW VARIABLES LIKE 'version'
76 Query SET NAMES utf8
76 Query SELECT s.sess_id, s.type, s.login_time, s.login, s.ip_address, s.click_time FROM sessions s WHERE 1 = 1
76 Query delete from sessions where click_time < NOW() - INTERVAL 1800 SECOND
76 Query SELECT COUNT(*) FROM clients where type <> "admin"
76 Query SELECT * FROM clients WHERE type = 'admin'
76 Query SELECT `param`, `val` FROM cl_param WHERE cl_id = 1
76 Query select `id`,`name`,`place` from Skins where `id`=1
76 Query SELECT `key`, `uid` FROM PersistentCache WHERE `events` LIKE '%api_update%'
77 Query DESCRIBE `clients`
77 Query SELECT `clients`.* FROM `clients` AS `clients` WHERE (`login` = 'jopontie')
76 Query SELECT id FROM domains WHERE name='jopontie.alumnos.upv.es'
77 Query DESCRIBE `clients`
77 Query SELECT `clients`.* FROM `clients` AS `clients` WHERE (`id` = 1) LIMIT 1
76 Query select `id`,`parent_id`,`vendor_id`,`type`,`cr_date`,`cname`,`pname`,`login`,`account_id`,`status`,`phone`,`fax`,`email`,`address`,`city`,`state`,`pcode`,`country`,`locale`,`limits_id`,`params_id`,`perm_id`,`pool_id`,`logo_id`,`tmpl_id`,`sapp_pool_id`,`guid`,`external_id`,`overuse` from clients where `id`=5
76 Query select `id`,`type`,`password` from accounts where `id`=4
76 Query SELECT id FROM domains WHERE name = "jopontie.alumnos.upv.es"
76 Query SELECT count(*) FROM subdomains sd, domains d WHERE d.id = sd.dom_id AND CONCAT(sd.name, ".", d.name)="jopontie.alumnos.upv.es" AND sd.id !="0"
76 Query SELECT count(*) FROM domainaliases WHERE name ="jopontie.alumnos.upv.es" AND id !="0"
76 Query SELECT COUNT(*) FROM dns_recs WHERE type in ("CNAME", "A", "MX", "NS", "TXT") AND host="jopontie.alumnos.upv.es."
76 Query SELECT c.pname, d.displayName, da.displayName FROM (domains d INNER JOIN clients c ON (c.id=d.cl_id)) LEFT OUTER JOIN domainaliases da ON (d.id=da.dom_id) WHERE c.id <> 5 AND (d.name IN ('alumnos.upv.es','upv.es') OR da.name IN ('alumnos.upv.es','upv.es'))
76 Query SELECT c.pname, d.displayName, da.displayName FROM (domains d INNER JOIN clients c ON (c.id=d.cl_id)) LEFT OUTER JOIN domainaliases da ON (d.id=da.dom_id) WHERE c.id <> AND (d.name IN ('alumnos.upv.es','upv.es') OR da.name IN ('alumnos.upv.es','upv.es'))
78 Connect pp_sb_db@localhost on sitebuilder5
78 Query SELECT 1
78 Query SET NAMES utf8
78 Query SELECT `config_section`.`name` AS `section`, `config_param`.`name` AS `name`, `config_param`.`value` AS `value` FROM `config_param` AS `config_param`
LEFT JOIN `config_section` AS `config_section` ON config_param.config_section_id = config_section.id
76 Query delete from sessions where sess_id="9f7a00bdd584315ef000e9f9c3ee4bba"
77 Quit
78 Quit
76 Quit
 
The command line error doesn't read there's any insert or update.

MySQL query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND (d.name IN ('alumnos.upv.es','upv.es') OR da.name IN ('alumnos.upv.es','upv.' at line 1

It could be any of these queries:

76 Query SELECT c.pname, d.displayName, da.displayName FROM (domains d INNER JOIN clients c ON (c.id=d.cl_id)) LEFT OUTER JOIN domainaliases da ON (d.id=da.dom_id) WHERE c.id <> 5 AND (d.name IN ('alumnos.upv.es','upv.es') OR da.name IN ('alumnos.upv.es','upv.es'))
76 Query SELECT c.pname, d.displayName, da.displayName FROM (domains d INNER JOIN clients c ON (c.id=d.cl_id)) LEFT OUTER JOIN domainaliases da ON (d.id=da.dom_id) WHERE c.id <> AND (d.name IN ('alumnos.upv.es','upv.es') OR da.name IN ('alumnos.upv.es','upv.es'))
 
Did you check these selects directly in psa database?
 
Yes, second one raises this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND (d.name IN ('alumnos.upv.es','upv.es') OR da.name IN ('alumnos.upv.es','upv.' at line 1
 
Yes, the problem in "WHERE c.id <> AND (d.name IN"
<> without parameter because:

PHP Notice: Undefined variable: cl_id

So, are you sure that client login 'jopontie' is really exists and associated with any cl_id? You can check it in 'clients' table.
 
this querys are identical only the integer "5" is missing in second query. the question is why is this query executed twice? one time correct one time with this missing integer?
 
Back
Top