Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Multiple Site Support

  1. #1
    enyartd is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    14

    Default Multiple Site Support

    I am tring to load Surgar onto Suse 10.0 that has an existing internal web site which is using SSL for email.
    When I install the software everything works like it should but if i reboot the computer Sugar is no longer accessable.
    the ports i'm trying to use are 8081 and 8078(secure) but it only seems to work right after install.
    Thank you for your help
    Dave

  2. #2
    rlbyrd is offline Sugar Community Member
    Join Date
    Jul 2006
    Posts
    40

    Default Re: Multiple Site Support

    I'll ask a dumb question or two--since you're using nonstandard ports, do you have Apache permanently configured to listen on those ports? Are you getting a "connection refused" or a Sugar error?

    regards,
    r

  3. #3
    enyartd is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    14

    Default Re: Multiple Site Support

    I've figured out my problem, now i just need to figure out how to fix it.
    Sugar does not restart when the computer restarts. I must run sugarctlr.sh restart after a reboot.

    The error that I'm getting is connection refused.
    If you have a suggestion on getting it to restart after reboot please let me know.
    thanx

  4. #4
    rlbyrd is offline Sugar Community Member
    Join Date
    Jul 2006
    Posts
    40

    Default Re: Multiple Site Support

    MIght you post or attach sugarctlr.sh? Sugar shouldn't have to "start" since it's just a pile o' php waiting for the webserver to execute it. If you're getting connection refused, then the web server (Apache?) simply isn't listening on your ports. Should be straightforward to make it do so on startup with a few entries in /etc/httpd/conf/httpd2.conf...

    Or, I could be an idiot.

  5. #5
    enyartd is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    14

    Default Re: Multiple Site Support

    No, your probably not an idiot. I may be just confused as to what i'm doing exactly.
    I've been a windows guru for years and over the last year i've jumped headlong into the linux scene and sometime i get things confused as to what it is i'm doing exactly.

    the error i gave you was wrong but here is the correct one.


    Code:
    Unable to connect
    Firefox can't establish a connection to the server at linuxmail:8443.
        *   The site could be temporarily unavailable or too busy. Try again in a few
              moments.
    
        *   If you are unable to load any pages, check your computer's network
              connection.
    
        *   If your computer or network is protected by a firewall or proxy, make sure
              that Firefox is permitted to access the Web.

  6. #6
    enyartd is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    14

    Default Re: Multiple Site Support

    Here is the file you requested.

    Code:
    #!/bin/sh
    # 
    # the path to your PID file
    HTTPD_PIDFILE=/srv/apache2/logs/httpd.pid
    HOSTNAME=`hostname`
    MYSQL_PIDFILE=/srv/mysql/data/mysqld.pid
    #
    # the path to your httpd binary, including options if necessary
    HTTPD="/srv/apache2/bin/httpd -f /srv/apache2/conf/httpd.conf"
    MYSQL_START="/srv/mysql/bin/safe_mysqld --port=3306 --socket=/srv/mysql/tmp/mysql.sock --old-passwords --datadir=/srv/mysql/data --err-log=/srv/mysql/data/mysqld.log --pid-file=/srv/mysql/data/mysqld.pid"
    MYSQL_STOP="/srv/mysql/bin/mysqladmin --socket=/srv/mysql/tmp/mysql.sock -u root -p shutdown"
    MYSQL_PASSWORD="FZ9G201"
    #
    # a command that outputs a formatted text version of the HTML at the
    # url given on the command line.  Designed for lynx, however other
    # programs may work.  
    LYNX="lynx -dump"
    #
    # the URL to your server's mod_status status page.  If you do not
    # have one, then status and fullstatus will not work.
    STATUSURL="http://localhost/server-status"
    
    MYSQL_STATUS=""
    HTTPD_STATUS=""
    MYSQL_PID=""
    HTTPD_PID=""
    
    PID=""
    ERROR=0
    SERVER=both
    export LD_LIBRARY_PATH="/srv/apache2/lib:/srv/common/lib:$LD_LIBRARY_PATH"
    export PATH=$PATH:/srv/php/bin
    export PHPRC=/srv/php/etc
    
    
    get_pid() {
        PID=""
        PIDFILE=$1
        # check for pidfile
        if [ -f $PIDFILE ] ; then
            PID=`cat $PIDFILE`
        fi
    }
    
    get_apache_pid() {
        get_pid $HTTPD_PIDFILE
        if [ ! $PID ]; then
            return 
        fi
        if [ $PID -gt 0 ]; then
            HTTPD_PID=$PID
        fi
    }
    
    get_mysql_pid() {
        get_pid $MYSQL_PIDFILE
        if [ ! $PID ]; then
            return 
        fi
        if [ $PID -gt 0 ]; then
            MYSQL_PID=$PID
        fi
    }
    
    is_service_running() {
        PID=$1
        if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
            RUNNING=1
        else
            RUNNING=0
        fi
        return $RUNNING
    }
    
    is_mysql_running() {
        get_mysql_pid
        is_service_running $MYSQL_PID
        RUNNING=$?
        if [ $RUNNING -eq 0 ]; then
            MYSQL_STATUS="mysql not running"
        else
            MYSQL_STATUS="mysql already running"
        fi
        return $RUNNING
    }
    
    is_apache_running() {
        get_apache_pid
        is_service_running $HTTPD_PID
        RUNNING=$?
        if [ $RUNNING -eq 0 ]; then
            HTTPD_STATUS="apache not running"
        else
            HTTPD_STATUS="apache already running"
        fi
        return $RUNNING
    }
    
    test_apache_config() {
        if $HTTPD -t; then
            ERROR=0
        else
            ERROR=8
            echo "apache config test fails, aborting"
            exit $ERROR
        fi
    }
    
    start_mysql() {
        is_mysql_running
        RUNNING=$?
        if [ $RUNNING -eq 1 ]; then
            echo "$0 $ARG: mysql  (pid $MYSQL_PID) already running"
            exit
        fi
        $MYSQL_START &
        if [ $? -eq 0 ]; then
            echo "$0 $ARG: mysql started at port 3306"
            sleep 2
        else
            echo "$0 $ARG: mysql could not be started"
            ERROR=3
        fi
    }
    
    stop_mysql() {
        NO_EXIT_ON_ERROR=$1
        is_mysql_running
        RUNNING=$?
        if [ $RUNNING -eq 0 ]; then
            echo "$0 $ARG: $MYSQL_STATUS"
            if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then
                exit
            else
                return
            fi
    	fi
        echo "MySQL will prompt you for the root password."
        if [ "x$MYSQL_PASSWORD" != "x" ]; then
            MYSQL_STOP="$MYSQL_STOP --password=$MYSQL_PASSWORD"
        fi
        $MYSQL_STOP
        
        is_mysql_running
        RUNNING=$?
        if [ $RUNNING -eq 0 ]; then
    	    echo "$0 $ARG: mysql stopped"
    	else
    	    echo "$0 $ARG: mysql could not be stopped"
    	    ERROR=4
    	fi
    }
    
    start_apache() {
        test_apache_config
        is_apache_running
        RUNNING=$?
    
        if [ $RUNNING -eq 1 ]; then
            echo "$0 $ARG: httpd (pid $HTTPD_PID) already running"
            exit
        fi
        if $HTTPD ; then
            echo "$0 $ARG: httpd started at port 8081"
        else
            echo "$0 $ARG: httpd could not be started"
            ERROR=3
        fi
    }
    
    stop_apache() {
        NO_EXIT_ON_ERROR=$1
        test_apache_config
        is_apache_running
        RUNNING=$?
    
        if [ $RUNNING -eq 0 ]; then
            echo "$0 $ARG: $HTTPD_STATUS"
            if [ "x$NO_EXIT_ON_ERROR" != "xno_exit" ]; then
                exit
            else
                return
            fi
    	fi
        get_apache_pid
    	if kill $HTTPD_PID ; then
    	    echo "$0 $ARG: httpd stopped"
    	else
    	    echo "$0 $ARG: httpd could not be stopped"
    	    ERROR=4
    	fi
    }
    
    help() {
    	echo "usage: $0 help"
    	echo "       $0 (start|stop|restart)"
    	echo "       $0 (start|stop|restart) apache"
    	echo "       $0 (start|stop|restart) mysql"
    	cat <<EOF
    
    help       - this screen
    start      - start the service(s)
    stop       - stop  the service(s)
    restart    - restart or start the service(s)
    
    EOF
    exit 0
    }
    
    noserver() {
           echo -e "ERROR: $1 is not a valid server. Please, select 'mysql' or 'apache'\n"
           help
    }
    
    [ $# -lt 1 ] && help
    
    if [ ! -z ${2} ]; then
           [ "${2}" != "mysql" ] && [ "${2}" != "apache" ] && noserver $2
           SERVER=$2
    fi
           
    
    if [ "x$3" != "x" ]; then
        MYSQL_PASSWORD=$3
    fi
    
    
    case $1 in
           help)   help
                   ;;
           start)
                   if [ "${SERVER}" != "both" ]; then
                           start_${2}
                   else
                           start_mysql
                           start_apache
                   fi
                   ;;
           stop)   if [ "${SERVER}" != "both" ]; then
                           stop_${2}
                   else
                           stop_apache "no_exit"
                           stop_mysql
                   fi
                   ;;
           restart)        if [ "${SERVER}" != "both" ]; then
                                   stop_${2} "no_exit"
                                   sleep 2
                                   start_${2}
                           else
                                   stop_apache "no_exit"
                                   stop_mysql "no_exit"
                                   start_mysql
                                   start_apache
                           fi
                   ;;
    esac
    
    exit $ERROR

  7. #7
    enyartd is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    14

    Default Re: Multiple Site Support

    Ok I did an uninstall using bitrock installer.
    Reinstalled using bitrock installer.
    after the install everything is working like it should with no problems. Default ports (8080 and 8443)
    install dir is /srv/www/htdocs (this has made no difference where it is installed at)
    after reboot nothing....... I get the same error in firefox as before
    restart using "surgarctrl.sh start"
    Code:
    linuxmail:/srv/www/htdocs # ./sugarctl.sh start
    ./sugarctl.sh : mysql started at port 3306
    Starting mysqld daemon with databases from /srv/www/htdocs/mysql/data
    STOPPING server from pid file /srv/www/htdocs/mysql/data/mysqld.pid
    060912 10:51:21  mysqld ended
    
    Syntax OK
    ./sugarctl.sh : httpd started at port 8080
    After running this I retry firefox and get this error.

    Code:
    Could not connect to server localhost as root.Can't connect to local MySQL server through socket '/srv/www/htdocs/mysql/tmp/mysql.sock' (111)

    I'm really confused at this point but hopefully with your help we can get this working.

    Thanx

  8. #8
    kpit's Avatar
    kpit is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Dec 2005
    Location
    Memphis, TN
    Posts
    996

    Default Re: Multiple Site Support

    Have you configured your system to run the init scripts to start mysql and apache in your default runlevel? This would simplfy everything.
    Cheers,

    Max W. Blackmer, Jr.

    Blog
    Phone: +1 (901) 672-2694



  9. #9
    enyartd is offline Sugar Community Member
    Join Date
    Sep 2006
    Posts
    14

    Default Re: Multiple Site Support

    Is it possible to run two different versions of php running at the same time?
    It seems that my email server (Scalix) is running 4.4.0
    Using the Bitrock installer it installs version 4.4.2

    I think i may just do another reinstall install Sugar first and then install scalix.

  10. #10
    kpit's Avatar
    kpit is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Dec 2005
    Location
    Memphis, TN
    Posts
    996

    Default Re: Multiple Site Support

    The short answer is yes.

    What you do is create an init script to call that shell script to start and stop sugar that you are currently are using. It should work pretty easy just by doing that once it is in the your default run level it should restart automatically on reboot of your server.
    Cheers,

    Max W. Blackmer, Jr.

    Blog
    Phone: +1 (901) 672-2694



Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •