ubuntu httpd: unrecognized service

Discussion in 'ISPConfig 3 Priority Support' started by budgierless, Jul 19, 2018.

  1. budgierless

    budgierless Member HowtoForge Supporter

    hi, i dont know why but i getting alot of email with the error message: WARNING - Reason for Apache restart failure: httpd: unrecognized service

    my ubuntu service is current using apache2 while im getting ready for an upgrage but i need to fix this,
    I have other php versions installed such as php 7.0, oho 5.6 etc, but if i try to chang to them nothing happends, this never happend before and dont know when it stopped woring.
    and emails says: WARNING - Apache did not restart after the configuration change for website domain.com. Reverting the configuration. Saved non-working config as /etc/apache2/sites-available/domain.com.vhost.err

    Here is the output of domain.com.vhost.err:
    Code:
    <Directory /var/www/domain.com>
            AllowOverride None
                    Order Deny,Allow
            Deny from all
            </Directory>
    
    <VirtualHost *:80>
    
                                        DocumentRoot /var/www/domain.com/web/clients
                            
            ServerName domain.com
            ServerAlias www.domain.com
            ServerAdmin [email protected]
    
    
            ErrorLog /var/log/ispconfig/httpd/domain.com/error.log
    
    
            <IfModule mod_ssl.c>
            </IfModule>
    
            <Directory /var/www/domain.com/web/clients>
                    # Clear PHP settings of this website
                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                            SetHandler None
                    </FilesMatch>
                    Options +FollowSymLinks
                    AllowOverride All
                                    Order allow,deny
                    Allow from all
                            </Directory>
            <Directory /var/www/clients/client0/web1/web/clients>
                    # Clear PHP settings of this website
                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                            SetHandler None
                    </FilesMatch>
                    Options +FollowSymLinks
                    AllowOverride All
                                    Order allow,deny
                    Allow from all
                            </Directory>
    
    
    
    
            # php as fast-cgi enabled
        # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
            <IfModule mod_fcgid.c>
                    FcgidIdleTimeout 300
                    FcgidProcessLifeTime 3600
                    # FcgidMaxProcesses 1000
                    FcgidMaxRequestsPerProcess 5000
                    FcgidMinProcessesPerClass 0
                    FcgidMaxProcessesPerClass 10
                    FcgidConnectTimeout 3
                    FcgidIOTimeout 600
                    FcgidBusyTimeout 3600
                    FcgidMaxRequestLen 1073741824
            </IfModule>
            <Directory /var/www/domain.com/web/clients>
                    <FilesMatch "\.php[345]?$">
                        SetHandler fcgid-script
                    </FilesMatch>
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php3
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php4
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php5
                    Options +ExecCGI
                    AllowOverride All
                                    Order allow,deny
                    Allow from all
                            </Directory>
            <Directory /var/www/clients/client0/web1/web/clients>
                    <FilesMatch "\.php[345]?$">
                        SetHandler fcgid-script
                    </FilesMatch>
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php3
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php4
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php5
                    Options +ExecCGI
                    AllowOverride All
                                    Order allow,deny
                    Allow from all
                            </Directory>
    
    
    
            # add support for apache mpm_itk
            <IfModule mpm_itk_module>
                AssignUserId web1 client0
            </IfModule>
    
            <IfModule mod_dav_fs.c>
            # Do not execute PHP files in webdav directory
                <Directory /var/www/clients/client0/web1/webdav>
                    <ifModule mod_security2.c>
                        SecRuleRemoveById 960015
                        SecRuleRemoveById 960032
                    </ifModule>
                    <FilesMatch "\.ph(p3?|tml)$">
                        SetHandler None
                    </FilesMatch>
                </Directory>
                DavLockDB /var/www/clients/client0/web1/tmp/DavLock
                # DO NOT REMOVE THE COMMENTS!
                # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
                # WEBDAV END
            </IfModule>
    
    </VirtualHost>
    
    Please advise, thanks
     
  2. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Code:
    mv /etc/apache2/sites-available/domain.com.vhost  /etc/apache2/sites-available/domain.com.vhost.ok
    mv /etc/apache2/sites-available/domain.com.vhost.err /etc/apache2/sites-available/domain.com.vhost
    apache2ctl -t
    mv /etc/apache2/sites-available/domain.com.vhost.ok  /etc/apache2/sites-available/domain.com.vhost
    
    what does it show
     
  3. budgierless

    budgierless Member HowtoForge Supporter

    it dose not saying anything other then what it should.
     
  4. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    what happens if you restart your php-fpm services?
    Does one not have a default config in it's configuration-pool? /etc/php/x.y/fpm/pool.d should always contain at least one file.
     
  5. budgierless

    budgierless Member HowtoForge Supporter

    the default config file from system php dose have a www.conf file, but the issues is with trying to use the addon php 5.6.4 fast-cgi or fpm none work anymore
     
  6. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

  7. budgierless

    budgierless Member HowtoForge Supporter

    i added the www.conf not i do get a n error message:
    Code:
    Starting php-fpm [19-Jul-2018 21:13:52] ERROR: unable to bind listening socket for address '/run/php/php5.6-fpm.sock': No such file or directory (2)
    [19-Jul-2018 21:13:52] ERROR: FPM initialization failed
    second thing is about php7, this dose not use a pool.d from what i understand so where would the www.conf go?
     
  8. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    oh maybe you don't have /run/php directory, just change that in the config or do a mkdir /run/php
    make sure all fpm services are running

    yes even php 7 uses a pool.d, it can have a different name though, check what is defned in the config.
     
  9. budgierless

    budgierless Member HowtoForge Supporter

    /run/php? where would i do this, /opt/php5.6/etc/?
    be advise that when i setup php5.6 i fellowed https://www.howtoforge.com/how-to-b...e-and-apcu-for-ispconfig-3-on-debian-7-wheezy
     
  10. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    ah I see, well I wouldn't recommend fastcgi build, use php-fpm with mod_fastcgi ( or if mod_fastcgi is not available, mod_fcgid which is also called fastcgi ).
    according to the tutorial you should have a configured first instance for php 5.6 /opt/php-5.6.36/etc/php-fpm.conf
    so the www.conf in the pool.d is not needed.

    I used /run/php as directory where the www.conf files should create their socket files since I don't want them to listen on tcp. Therefore you may want to change that - or not and create the directory.

    If ISPConfig is not able to stop/start php-fpm it will error out. This is given as soon as the fpm-config does not provice at least one config because else it won't (need to) start.

    What about your php 7?
     
  11. budgierless

    budgierless Member HowtoForge Supporter

    i was trying your steps with php7 too but since their is no need for www.conf, i will have to leave it, its very odd beacuse these addons where working and i have not touch them since i install and tested them, but the issues are for all my php addonds from php5.2 to 7.0, so i get to be somthing else which makes the problem
     
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Additional PHP versions should not be able to cause apache to fail, if they are broken, then normally just PHP does not work. In my experience, when apache fails without an error, then the reason is normally an SSL cert. The vhost you posted does not show an SSL cert, is it possible that you activated SSL and the .err vhost file contains an SSL vhost?
     
  13. budgierless

    budgierless Member HowtoForge Supporter

    You maybe right, I’m not meant to have ssl on that site so if it exists Then that’s not right, how can I find out? The odd thing is I only get issues when trying to use an different php versions.
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    I did not say that you have SSL in that site, I just said that SSL is a common reason when there is no error message at all from apache. Check the vhost and the .vhost.err file, if they do not contain any SSL related settings like SSLCertificate.

    And in regard to the error message " WARNING - Reason for Apache restart failure: httpd: unrecognized service" from your first post, the web service on an Ubuntu server is named apache2 and not httpd, so you might have just used a wrong command to restart apache.
     
  15. budgierless

    budgierless Member HowtoForge Supporter

    ok, so the main domain vhost has:
    Code:
    <IfModule mod_ssl.c>
           </IfModule>
    
           <Directory /var/www/clients.domain.com/web/clients>
                   # Clear PHP settings of this website
                   <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                           SetHandler None
                   </FilesMatch>
                   Options +FollowSymLinks
                   AllowOverride All
                                   Order allow,deny
                   Allow from all
                           </Directory>
           <Directory /var/www/clients/client0/web1/web/clients>
                   # Clear PHP settings of this website
                   <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                           SetHandler None
                   </FilesMatch>
                   Options +FollowSymLinks
                   AllowOverride All
                                   Order allow,deny
                   Allow from all
                           </Directory>
    
           # mod_php enabled
           AddType application/x-httpd-php .php .php3 .php4 .php5
           php_admin_value sendmail_path "/usr/sbin/sendmail -t -i [email protected]"
           php_admin_value upload_tmp_dir /var/www/clients/client0/web1/tmp
           php_admin_value session.save_path /var/www/clients/client0/web1/tmp
       # PHPIniDir /var/www/conf/web1_web/clients
           php_admin_value open_basedir /var/www/clients/client0/web1/web/clients:/var/www/clients/client0/web1/private:/var/www/clients/client0/web1/tmp:/var/www/clients.domain.com/web/clients:/srv/www/clients.domain.com/web/clients:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin
    
    when i look fior ssl terms.
    but the vhost.err file has:
    Code:
    <IfModule mod_ssl.c>
    </IfModule>
    
    # php as fast-cgi enabled
        # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
            <IfModule mod_fcgid.c>
                    FcgidIdleTimeout 300
                    FcgidProcessLifeTime 3600
                    # FcgidMaxProcesses 1000
                    FcgidMaxRequestsPerProcess 5000
                    FcgidMinProcessesPerClass 0
                    FcgidMaxProcessesPerClass 10
                    FcgidConnectTimeout 3
                    FcgidIOTimeout 600
                    FcgidBusyTimeout 3600
                    FcgidMaxRequestLen 1073741824
            </IfModule>
            <Directory /var/www/clients.domain.com/web/clients>
                    <FilesMatch "\.php[345]?$">
                        SetHandler fcgid-script
                    </FilesMatch>
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php3
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php4
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php5
                    Options +ExecCGI
                    AllowOverride All
                                    Order allow,deny
                    Allow from all
                            </Directory>
            <Directory /var/www/clients/client0/web1/web/clients>
                    <FilesMatch "\.php[345]?$">
                        SetHandler fcgid-script
                    </FilesMatch>
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php3
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php4
                    FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter_web32 .php5
                    Options +ExecCGI
                    AllowOverride All
                                    Order allow,deny
                    Allow from all
                            </Directory>
    so from what i think i see if that the vhost is fine when mod_php is active but the fastcgi has an issue bebecause that is in the err.file, please correct me if i am wrong.

    i get this error message via email fnom for terminal, so i thing is a config somwhere in the code where the httpd term is embeeded?
     
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Please run these two commands and post the output:

    ls -la /etc/httpd
    ls -la /etc/init.d/httpd
     
  17. budgierless

    budgierless Member HowtoForge Supporter

    # ls -la /etc/httpd
    total 20
    drwxr-xr-x 3 root root 4096 Jun 30 2017 .
    drwxr-xr-x 203 root root 12288 Jul 20 19:36 ..
    drwxr-xr-x 2 root root 4096 Jun 30 2017 conf.d
    root@mmg1:~# ls -la /etc/init.d/httpd
    ls: cannot access /etc/init.d/httpd: No such file or directory

    UPDATE: i checked this file /etc/httpd/conf.d and a file called psstream.ini which contains:
    Code:
    # Configuration for the PSStream PHP extension
    extension=psstream.so
    psstream.bandwidth_limit=1
    psstream.bandwidth_chunk_size=204800
    psstream.bandwidth_chunk_interval=0.2
    IM not sure if this is a hack file or part of my ffmpeg bundle, i will disable it be renaming it and test.

    UPDATE2: made no difference,

    these are all the apache mods i have installed:
    Code:
    Loaded Modules     
    
    core mod_log_config mod_logio prefork http_core mod_so mod_actions mod_alias mod_auth_basic mod_auth_digest mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dav mod_dav_fs mod_deflate mod_dir mod_env mod_expires mod_fastcgi mod_fcgid mod_flvx mod_geoip mod_h264_streaming mod_headers mod_include mod_mime mod_security2 mod_negotiation mod_version mod_instaweb mod_perl mod_php5 mod_reqtimeout mod_rewrite mod_ruby mod_setenvif mod_ssl mod_status mod_suexec mod_suphp mod_unique_id 
    Do you see a problem with any that may confict?
     
    Last edited: Jul 20, 2018
  18. till

    till Super Moderator Staff Member ISPConfig Developer

    There should be no folder /etc/httpd on an Ubuntu system, Ubuntu stores all apache config files in /etc/apache2/ and it's subfolders. A folder /etc/httpd is only used on Redhat based Distributions like CentOS. Due to the existence of that centOS specific folder on Ubuntu, the system switched to CentOS config mode and uses centOS specific service commands.

    To fix that, remove the folder /etc/httpd and place the file that you stored there, if you need it, into a location that matches the Ubuntu folder scheme /etc/apache2/....

    My guess is that you either followed a tutorial which is for CentOS or you used some kind of installer which did not check if your server runs CentOS or Ubuntu and therefore it created the config include folder for CentOS, which is not read by the Apache on Ubuntu as /etc/httpd/conf.d/ on CentOS translates to the folder /etc/apache2/conf.d on old Ubuntu versions and to /etc/apache2/conf-available/ on new Ubuntu versions (plus a symlink in /etc/apache2/conf-enabled/ folder).
     
    budgierless likes this.
  19. budgierless

    budgierless Member HowtoForge Supporter

    thanks you where right and i fixed that discovered problem, but that has had no effect on my main issue of getting the php alternatives to work
     
  20. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    as I already mentioned, most common thing would be no default config for one of your php-fpms.

    can you restart all of your addtional php-fpm services without one of them complaining or not starting a default pool and is it not because one config is from your current website you want to switch?
    How did you integrate the additional php versions ... is there any typo for the init-scriptname and the setting in your ispconfig?
    Is it only when you want to switch from php?-fpm to php?-fastcgi?
    Do you have by chance an issue with permissions? Try uncheck the "use sockets" options at php-settings tab for the website maybe.

    After you sorted out the issue with ISPConfig thinking it's centos, what is the reason for the error now in the datalog ( LOGLEVEL_WARN )?
     

Share This Page