Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am creating a free shared hosting service for fun and learning. I made a simple form where the user enters the subdomain and ftp password. When the user hits submit, a script generates a linux user encrypts the entered password with crypt() then sends the data to a linux script. Here is the wrong part of the full script:

echo "[$1]
user = $1
group = $1
listen = /var/run/sock_$1.sock
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
php_value[disable_functions] = \"phpinfo, system, exec, shell_exec, passthru , ini_alter, dl, pfsockopen, openlog, syslog, readlink, symlink, link, leak, fsockopen, popen, escapeshellcmd, apache_child_terminate apache_get_modules, apache_get_version, apache_getenv, apache_note,apache_setenv,virtual\"
php_value[open_basedir] = \"/home/$1:/home/$1/tmp\"" | sudo /usr/bin/tee /etc/php5/fpm/pool.d/$1.conf;

sudo /usr/sbin/service php5-fpm reload;

As you can see it creates a PHP-FPM pool then reloads the service. When I manually create the pool and also manually reload FPM, it works fine, the new website loads with no problem. The problem that I noticed if I comment out the reload line it creates the pool so there is no problem with file writing but with reloading.

So when I submit the post with all the data, it has Internal server error 500.

Apache log:

[Thu Aug 08 01:43:44 2013] [error] [client xxx.xxx.xxx.xxx] (104)Connection reset by peer: FastCGI: comm with server "/vhost_asd_tld" aborted: read failed, referer: http://asd.tld/
[Thu Aug 08 01:43:44 2013] [error] [client xxx.xxx.xxx.xxx] FastCGI: incomplete headers (0 bytes) received from server "/vhost_asd_tld", referer: http://asd.tld/

The asd.tld pool:

[asd_tld]
user = asd_tld
group = asd_tld
listen = /var/run/sock_asd_tld.sock
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

The asd.tld vhost:

<VirtualHost *:80>
ServerAdmin asd@asd.tld
ServerName asd.tld
DocumentRoot /var/www
<Directory /var/www>  
  AllowOverride All
  Order Allow,Deny
  Allow from all
</Directory>
ErrorLog "/var/www/log/asd.tld-error.log"
CustomLog "/var/www/log/asd.tld-access.log" combined
CustomLog "/var/www/log/asd.tld-bandwidth.log" common
<IfModule mod_fastcgi.c>
  <FilesMatch \.php$>
    SetHandler php-script
  </FilesMatch>
  Action php-script /php5-fpm-handler
  Alias /php5-fpm-handler /vhost_asd_tld
  FastCGIExternalServer /vhost_asd_tld -socket /var/run/sock_asd_tld.sock
</IfModule>
</VirtualHost>

OS: Ubuntu Desktop 13.04

share

migration rejected from webapps.stackexchange.com Aug 9 '13 at 14:46

This question came from our site for power users of web applications. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Stephen Ostermiller Aug 9 '13 at 14:46

  • This question does not appear to be about webmastering within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

    
This question would be more appropriate on serverfault.com but it cannot be migrated there because it was already incorrectly migrated here. If you still need an answer, re-ask the question there. –  Stephen Ostermiller Aug 9 '13 at 14:46

Browse other questions tagged or ask your own question.