Applies To:

[ Zend Server on Linux ]

Overview

Follow the below procedure to change the Apache user when Zend Server has already been installed.

If you have not yet installed Zend Server, configure the Apache (from distro) settings to  your specifications before installing Zend Server.

Instructions

Linux admin activities for the Apache side

Before running this procedure make sure that you:

  1. Record old user and group information before changing anything.
  2. Modify the Apache user and group.
  3. Make sure the document root and all web resources are owned by the new Apache user/group.
If there are still resources owned by the old Apache user you might get permission errors in Apache and PHP logs, and have a problem running your web applications.

Zend Server modifications

For this article we will be using as example values:


  1. Get the UID and GID by running the following command:


    # id <old Apache username>
    # id <new Apache username>


  2. Stop all Apache and Zend Server processes by running the command:


    # /usr/local/zend/bin/apachectl stop
    # /usr/local/zend/bin/zendctl.sh stop


  3. Make sure no processes are running using the following command:


    # /usr/local/zend/bin/zendctl.sh status
    # ps aux | grep -e zend -e apache -e httpd


  4. Modify /usr/local/zend/etc/conf.d/ZendGlobalDirectives.ini to match new UID/GID:


    ; UID of httpd process
    zend.httpd_uid=1001
    
    ; GID of httpd process  
    zend.httpd_gid=1002


  5. Modify /etc/zce.rc to match new Apache username:


    WEB_USER=momo


  6. Change ownership on all files formerly owned by the old Apache user to the new Apache user.


    # find /usr/local/zend -user apache -exec chown momo {} \;
    # find /usr/local/zend -group apache -exec chgrp momo {} \;


  7. Add the user 'zend' to the new Apache group:


    # usermod -A momo zend


  8. Start Zend Server and Apache:


    # /usr/local/zend/bin/zendctl.sh start


Result

After performing the procedure, everything runs with the new Apache user.

Please verify the changes by checking:

1. That all services are up and running.

2. Execute zendctl.sh status.

3. Check the Admin GUI thoroughly.