• 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

PHP CLI execution get Error 324 - Connection reset

D

DarioG

Guest
---------------------------------------------------------------
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE
OS Linux 2.6.18-028stab069.6
Panel version 10.2.0
OS Template centos-5-x86_64
Applications Installed pp10,
pp10-postfix,
pp10-vps-optimized


PROBLEM DESCRIPTION
I'm trying to generate subdomain from a php scripts. I have this:

system("sudo /usr/local/psa/bin/subdomain --create sub1 -domain example.com.ar -www-root /example_root -php true 2>&1", $vars);

Curiously, when some error occurs I can get those in $vars (for example if user doesn't have permission or if subdomain already exist)

But if there isn't error, I got my subdomain created but my php script stop working in that line, browser send a 324 error, empty response. No logs in apache and also my app doesn't show any php error, very weird.

I know you can suggest to change my script in several format, I tried a thousand of these, like remove 2>&1 (I used this for get errors), I also tried exec and other php functions

Also, creation from a terminal working well, the problem is from PHP.

Thanks in advance!

STEPS TO REPRODUCE

ACTUAL RESULT
Subdomain created but script stopping

EXPECTED RESULT
Subdomain created and script getting "Success" message from cli

ANY ADDITIONAL INFORMATION
I'm using Drupal in a Hostgator VPS
--------------------------------------------------------------
 
Already upgraded

Thanks for reply, I asked to HG and they upgrade my plesk panel to 10.4.4, and now when I try to create a subdomain using command line (an also from php exec functions), I received this errors:

# /usr/local/psa/bin/subdomain --create aaa5 -domain example.com.ar -www-root /exampe_path -php true -cgi true
An error occurred during domain creation: Unable to accept the template: the following limitations are exceeded.
Description Requested Allowed
Run PHP as Apache module CGI application
The component Perl support was not installed switched on switched off
The component Python support was not installed switched on switched off
The component FastCGI support (required for Ruby on Rails) switched on switched off
was not installed
Webmail

Was upgrade change something in my settings that I need reconfigure?

Thanks!
 
You should check limits of your Service Plan for this domain at least.
 
Had quite the same problem on plesk 11. Answer is simple.
When you run plesk commands to manage domains and aliases, plesk restarts web server to apply new config. If you run such command from php script on working doman, plesk restarts apache and this script session just terminated by apache. So browser don't get response.
Solution: run plesk command with delay, to let apache finish current request.
You can write shell script, which will wait 20 seconds before execute command.
Here is example of code (just to show the idea, code is not tested):

$fp=fopen('script.sh', 'wb');

fwrite($fp, "sleep 20 \n");

fwrite($fp, "/usr/local/psa/bin/subdomain --create sub1 -domain example.com.ar -www-root /example_root -php true 2>&1 \n");

fclose($fp);

exec('nohup script.sh /dev/null 2>&1 &');
 
Last edited:
Back
Top