You are not logged in.

#1 2020-08-18 20:31:32

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

[SOLVED] XAMPP and Mariadb

XAMPP starts and functions perfectly and so does mariadb, except for the part where XAMPP tries to start mysql and eventually returns "/opt/lampp/bin/mysql.server: line 264: kill: (10031) - No such process". After I run chmod 777 on the entire /opt/lampp folder, everything works perfectly.

Last edited by Flavoured-Goo (2020-08-19 04:56:37)

Offline

#2 2020-08-18 20:43:27

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] XAMPP and Mariadb

Please give an example of a package not running as intended and what files did you chmod 777?

Offline

#3 2020-08-18 20:54:14

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

Right now it was when I built XAMPP and it could't start mysql  via mariadb. It constantly said "/opt/lampp/bin/mysql.server: line 264: kill: (10031) - No such process". None of the solutions online worked so eventually I decided to try chmod -R 777 on the entire /opt/lampp/ which solved the problem. This isn't the first time I've had to chmod 777 package files but it was strange because unlike previous times it didn't return the common "don't have permission" error and it would mostly be a single config file or something like that.

Offline

#4 2020-08-18 20:55:42

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: [SOLVED] XAMPP and Mariadb

Running 'chmod 777' is one of the many definitions of 'messing up'. There are VERY few situations where running that is a good idea.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2020-08-18 20:58:28

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: [SOLVED] XAMPP and Mariadb

"/opt/lampp/bin/mysql.server: line 264: kill: (10031) - No such process" means the script tried to kill a PID that didn't exist. chmod'ing 777 had nothing to do w/ the changed behavior.

Offline

#6 2020-08-18 21:02:51

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

I'm aware it's unsafe but I really couldn't find another way. Is there a way to have all files that need 777 permissions automatically get them without having to manually do it? Did I mess up something during user creation?

Offline

#7 2020-08-18 21:07:29

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: [SOLVED] XAMPP and Mariadb

There's so far no indication that your actions were sane measures to begin with and it is highly unlikely that a file comes w/ the wrong permissions, let alone that it requires 777.

Offline

#8 2020-08-18 21:08:21

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] XAMPP and Mariadb

Had you installed the mariadb package from the repositories before you installed xammp?

Offline

#9 2020-08-18 21:09:01

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

seth wrote:

"/opt/lampp/bin/mysql.server: line 264: kill: (10031) - No such process" means the script tried to kill a PID that didn't exist. chmod'ing 777 had nothing to do w/ the changed behavior.

Maybe I did mess up but this is the only thing I could do to get it working. I tried reinstalling mariadb, XAMPP but none of that worked. What do you think would fix it?

Last edited by Flavoured-Goo (2020-08-18 21:09:54)

Offline

#10 2020-08-18 21:14:37

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] XAMPP and Mariadb

@seth chmod 777 would fix a conflict caused by xammp expecting the user mysql to have uid 992 while the mariadb package creates the user with a dynamic UID.

Last edited by loqs (2020-08-18 21:15:09)

Offline

#11 2020-08-18 21:18:17

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

loqs wrote:

Had you installed the mariadb package from the repositories before you installed xammp?

Yes!

Offline

#12 2020-08-18 21:20:54

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

seth wrote:

There's so far no indication that your actions were sane measures to begin with and it is highly unlikely that a file comes w/ the wrong permissions, let alone that it requires 777.

I agree, that's why I feel I've probably gone wrong somewhere in the actual install I did of arch a few weeks ago or probably later during user creation? I'm fairly new to Arch and previously used Fedora which did everything for you.

Offline

#13 2020-08-18 21:22:21

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

So I reinstalled XAMPP and it's now back to default permissions (root) and the same error is back, once again sql no longer starts.

Offline

#14 2020-08-18 21:23:32

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: [SOLVED] XAMPP and Mariadb

The error is probably coincidental and loqs assuptiom about the UID mismatch being the ultimate cause is correct, https://aur.archlinux.org/packages/xamp … ent-732310

Offline

#15 2020-08-18 21:30:16

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

@seth Is there a solution to the UID mismatch or would installing it directly from the website be the way to go?

Offline

#16 2020-08-18 21:34:45

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: [SOLVED] XAMPP and Mariadb

If the xampp package creates and relies on the 992 mysql user you need to get rit of the dynamic user setup by /usr/lib/sysusers.d/mariadb.conf
Otherwise you can just remove the mysql user (and block its creation in the PKGBUILD)

Offline

#17 2020-08-18 21:41:59

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] XAMPP and Mariadb

Can you create the mysql database using:

		mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Although personally I would recommend using apache ,  mariadb,  php from the official repositories.

Last edited by loqs (2020-08-18 21:44:04)

Offline

#18 2020-08-18 21:58:24

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

loqs wrote:

Can you create the mysql database using:

		mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Although personally I would recommend using apache ,  mariadb,  php from the official repositories.

Yep done this too, just after installing MariaDB

Offline

#19 2020-08-18 22:01:54

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] XAMPP and Mariadb

Can you start lampp / xammp?

Offline

#20 2020-08-18 22:03:34

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] XAMPP and Mariadb

Please fix your title to refer to your actual problem.  Nothing in this thread indicates a "constant" need or pervasive problem, you just have a specific situation in which chmoding something to 777 coincidentally helped.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#21 2020-08-18 22:03:35

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

Okay it's late here, tomorrow I'm going to take @seth's advice and if all else fails, then installing from the website seems to be the way to go.  Will update in a few hours and mark as solved if any of those methods work successfully.

Offline

#22 2020-08-18 22:05:37

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

Trilby wrote:

Please fix your title to refer to your actual problem.  Nothing in this thread indicates a "constant" need or pervasive problem, you just have a specific situation in which chmoding something to 777 coincidentally helped.

Like I mentioned in the title, I have needed to chmod things in the past too to get them working. I'm not mentioning them now as I can't recollect the specific details. But i'm going to change the title because it's more solving the XAMPP-mysql issue and not the whole chmod 777 one.

Last edited by Flavoured-Goo (2020-08-18 22:09:22)

Offline

#23 2020-08-18 22:06:38

Flavoured-Goo
Member
Registered: 2020-08-17
Posts: 31

Re: [SOLVED] XAMPP and Mariadb

loqs wrote:

Can you start lampp / xammp?

Yes, it starts and everything works perfectly except for mysql

Offline

#24 2020-08-18 22:11:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] XAMPP and Mariadb

The fact that the same bad solution temporarily brushed some other problem under the rug as well, doesn't mean that's what this thread is about and more than the fact that you were using a keyboard to interact with your computer justifies putting "keyboard error" in the title.  This is especially the case if you don't even recall what those other situations were, there's no way anyone can help you with them.

If you really want to just ask whether you should chmod 777 on package contents, the answer is a clear and simple NO.  So either mark the thread solved as that question has been answered, or if you really want this thread to continue in the productive direction it's currently going to solve the problems with XAMPP, edit the title to represent THAT goal.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#25 2020-08-18 22:25:44

loqs
Member
Registered: 2014-03-06
Posts: 17,194

Re: [SOLVED] XAMPP and Mariadb

From the xammp PKGBUILD

.....
	msg 'Creating a temporary mysql user/group with fakeadd...'

	getent group mysql > /dev/null || fakeadd -G -n mysql -g "${_mysql_uuid}" || _fakeadd_error
	getent passwd mysql > /dev/null || fakeadd -U -n mysql -g "${_mysql_uuid}" -u "${_mysql_uuid}" -s /bin/false || _fakeadd_error

	# Remove unused folder
	rm -rf "${pkgdir}/xampp_core_files/"
	rm -rf "${pkgdir}/xampp_developer_files/"
	rm -rf "${pkgdir}/native_mysql_adapter/"
	rm -rf "${pkgdir}/native_apache_adapter/"
	rm -rf "${pkgdir}/native_proftpd_adapter/"
	rm -rf "${pkgdir}/manager/"
	rm -rf "${pkgdir}/common_native_adapter/"

It seems to not need the fakeuser.
Edit:
Why does the package depend on mariadb when it bundles mysql and provides symlinks in opt/lampp/bin from maridb bins to mysql bins?
Edit2:
The shell script that fails to start mysql:

#!/bin/bash
#
# For RedHat (thanks to Sudhaker Raj):
# chkconfig: 345 95 05
# description: Starts and stops the XAMPP \
#              used to control Apache, MySQL, ProFTPD.
# For SuSE:
### BEGIN INIT INFO
# Provides:                     apache2 httpd2 xampp
# Required-Start:               $local_fs $remote_fs $network
# Required-Stop:                $local_fs $remote_fs $network
# Default-Start:                3 5
# Default-Stop:                 0 1 2 6
# Short-Description:            XAMPP
# Description:                  Starts and stops XAMPP
### END INIT INFO
###############################################################################
# Copyright 2002-2009 by Apache Friends, GPL-licensed
# Authors:
#   - Kai 'Oswald' Seidler, oswald@apachefriends.org
#   - Kristian W. Marcroft, kris@apachefriends.org 
#   - Christian Speich, kleinweby@apachefriends.org

osguess() {
	if test -f /etc/redhat-release
	then
		if egrep "9 " /etc/redhat-release > /dev/null
		then
			echo "rh9"
			return 0
		else
		        echo "linux"
			return 0
		fi
	elif test "$(uname)" = "Darwin"
	then
		echo "macosx"
		return 0
	else
		if test -f /etc/vfstab
		then
			echo "solaris"
			return 0
		else
			echo "linux"
			return 0
		fi
	fi
}

case $(osguess) in
	solaris)
		XAMPP_OS="Solaris"
		XAMPP_ROOT="/opt/xampp"
		;;
	linux|rh9)
		XAMPP_OS="Linux"
		XAMPP_ROOT="/opt/lampp"
		;;
	macosx)
		XAMPP_OS="Mac OS X"
		XAMPP_ROOT="/Applications/XAMPP/xamppfiles"
		;;
esac

export XAMPP_OS
export XAMPP_ROOT

. $XAMPP_ROOT/share/xampp/xampplib

version=$(cat $XAMPP_ROOT/lib/VERSION)
bon="[1m"
boff="[m"
lc="$XAMPP_ROOT/etc/xampp"
de="false"
case $LANG in
        de*) de="true";;
esac
export de

function startApache() {
	apachedefines=""
	ssl=0
	php=0
	
	if test -f $lc/startssl
	then
		ssl=1
		apachedefines="$apachedefines -DSSL"
	fi
	
	if true
	then
		php=1
		apachedefines="$apachedefines -DPHP"
	fi
	
	printf "XAMPP: $($GETTEXT 'Starting %s...')" "Apache"
	
	if testrun "$XAMPP_ROOT/logs/httpd.pid" httpd
	then
		$GETTEXT -s "already running."
		return 0
	fi
	
	if testport 80
	then
		$GETTEXT -s "fail."
		echo "XAMPP: " $($GETTEXT 'Another web server is already running.')
		return 1
	fi
	
	if test $ssl -eq 1 && testport 443
	then
		$GETTEXT -s "fail."
		echo "XAMPP: " $($GETTEXT 'Another web server with SSL is already running.')
		return 1
	fi
	
	syntaxCheckMessage=$($XAMPP_ROOT/bin/httpd -t $apachedefines 2>&1)
	
	if test $? -ne 0
	then
		$GETTEXT -s "fail."
		echo "$syntaxCheckMessage"
		return 1
	fi
	
	"$XAMPP_ROOT/bin/apachectl" -k start -E "$XAMPP_ROOT/logs/error_log" $apachedefines > /dev/null 2>&1 
	
	if test $? -ne 0
	then
		$GETTEXT -s "fail."
		
		## TODO: run the diagnose script
		
		$XAMPP_ROOT/share/xampp/diagnose
		
		return $?
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function startMySQL() {
	
	printf "XAMPP: $($GETTEXT 'Starting %s...')" "MySQL"

	if testrun "$XAMPP_ROOT/var/mysql/$(hostname).pid" mysqld
	then
		$GETTEXT -s "already running."
		return 0
	fi
	
	if testport 3308
	then
		$GETTEXT -s "fail."
		echo "XAMPP: " $($GETTEXT 'Another MySQL daemon is already running.')
		return 1
	fi
	
	$XAMPP_ROOT/bin/mysql.server start > /dev/null &
	
	if test $? -ne 0
	then
		$GETTEXT -s "fail."
				
		printf "$($GETTEXT -s 'Last 10 lines of \"%s\":')\n" "$XAMPP_ROOT/var/mysql/$(hostname).err"
		
		tail -n 10 "$XAMPP_ROOT/var/mysql/$(hostname).err"
		
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function startProFTPD() {
	
	printf "XAMPP: $($GETTEXT 'Starting %s...')" "ProFTPD"

	if testrun "$XAMPP_ROOT/var/proftpd.pid" proftpd
	then
		$GETTEXT -s "already running."
		return 0
	fi
	
	if testport 21
	then
		$GETTEXT -s "fail."
		echo "XAMPP: " $($GETTEXT 'Another FTP daemon is already running.')
		return 1
	fi
	
	$XAMPP_ROOT/sbin/proftpd > $XAMPP_ROOT/var/proftpd/start.err 2>&1
	
	if test $? -ne 0
	then
		$GETTEXT -s "fail."
				
		printf "$($GETTEXT -s 'Contents of \"%s\":')\n" "$XAMPP_ROOT/var/proftpd/start.err"
		
		cat "$XAMPP_ROOT/var/proftpd/start.err"
		
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function startWebmin() {
	
	printf "XAMPP: $($GETTEXT 'Starting %s...')" "Webmin"

	if testrun "$XAMPP_ROOT/var/webmin/miniserv.pid" miniserv
	then
		$GETTEXT -s "already running."
		return 0
	fi
	
	$XAMPP_ROOT/etc/webmin/start quiet 2>&1
	
	if test $? -ne 0
	then
		$GETTEXT -s "fail."
		
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function stopApache() {
	
	printf "XAMPP: $($GETTEXT 'Stopping %s...')" "Apache"
	
	if ! test -f "$XAMPP_ROOT/logs/httpd.pid"
	then
		$GETTEXT -s "not running."
		return 0
	fi
	
        if test -f $lc/startssl
	then
	    ssl=1
	    apachedefines="$apachedefines -DSSL"
	fi
	
	if true
	then
	    php=1
	    apachedefines="$apachedefines -DPHP"
	fi

	$XAMPP_ROOT/bin/apachectl -k stop $apachedefines > /dev/null 2>&1
	
	error=$?
	
	if test $error -ne 0
	then
		$GETTEXT -s "fail."
		echo "apachectl returned $error."	
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function stopMySQL() {
	
	printf "XAMPP: $($GETTEXT 'Stopping %s...')" "MySQL"
	
	if ! test -f "$XAMPP_ROOT/var/mysql/$(hostname).pid"
	then
		$GETTEXT -s "not running."
		return 0
	fi
	
	$XAMPP_ROOT/bin/mysql.server stop > /dev/null 2>&1
	error=$?
	
	if test $error -ne 0
	then
		$GETTEXT -s "fail."
		echo "mysql.server returned $error."	
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function stopProFTPD() {
	
	printf "XAMPP: $($GETTEXT 'Stopping %s...')" "ProFTPD"
	
	if ! test -f "$XAMPP_ROOT/var/proftpd.pid"
	then
		$GETTEXT -s "not running."
		return 0
	fi
	
	kill $(cat $XAMPP_ROOT/var/proftpd.pid)
	error=$?
	
	if test $error -ne 0
	then
		$GETTEXT -s "fail."
		echo "kill returned $error."	
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function stopWebmin() {
	
	printf "XAMPP: $($GETTEXT 'Stopping %s...')" "Webmin"
	
	if ! test -f "$XAMPP_ROOT/var/webmin/miniserv.pid"
	then
		$GETTEXT -s "not running."
		return 0
	fi
	
	$XAMPP_ROOT/etc/webmin/stop quiet
	error=$?
	
	if test $error -ne 0
	then
		$GETTEXT -s "fail."
		echo "stop returned $error."	
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function reloadApache() {
	
	printf "XAMPP: $($GETTEXT 'Reload %s...')" "Apache"
	
	if ! test -f "$XAMPP_ROOT/logs/httpd.pid"
	then
		$GETTEXT -s "not running."
		return 1
	fi
	
	kill -USR1 $(cat "$XAMPP_ROOT/logs/httpd.pid")
	
	error=$?
	
	if test $error -ne 0
	then
		$GETTEXT -s "fail."
		echo "kill returned $error."	
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function reloadMySQL() {
	
	printf "XAMPP: $($GETTEXT 'Reload %s...')" "MySQL"
	
	if ! test -f "$XAMPP_ROOT/var/mysql/$(hostname).pid"
	then
		$GETTEXT -s "not running."
		return 1
	fi
	
	kill -HUP $(cat "$XAMPP_ROOT/var/mysql/$(hostname).pid")
	
	error=$?
	
	if test $error -ne 0
	then
		$GETTEXT -s "fail."
		echo "kill returned $error."	
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

function reloadProFTPD() {
	
	printf "XAMPP: $($GETTEXT 'Reload %s...')" "ProFTPD"
	if ! test -f "$XAMPP_ROOT/var/proftpd.pid"
	then
		$GETTEXT -s "not running."
		return 1
	fi
	kill -HUP $(cat "$XAMPP_ROOT/var/proftpd.pid")
		
	error=$?
	
	if test $error -ne 0
	then
		$GETTEXT -s "fail."
		echo "kill returned $error."	
		return 1
	fi
	
	$GETTEXT -s "ok."
	return 0
}

# XAMPP is currently 32 bit only
case `uname -m` in
	*_64)
	if $XAMPP_ROOT/bin/php -v > /dev/null 2>&1
	then
		:
	else
		$GETTEXT -s "XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library for your system."
		exit 1
	fi
	;;
esac

# do we have that new red hat linux 9 with posix native threads?
if test $(osguess) = "rh9"
then
	# for now disable PNTL. if PNTL gets more popular we will support it. - oswald [8apr3]
	export LD_ASSUME_KERNEL=2.2.5
	#echo "XAMPP: DISABLE PNTL..."
fi

LIBRARY_PATH="$XAMPP_ROOT/lib"
# Do we use Oracle? If yes, add Oracle's lib directory to LD_LIBRARY_PATH - oswald [6jul5]
if test -f $XAMPP_ROOT/etc/xampp/oraclelib
then
    export LIBRARY_PATH="$(cat $XAMPP_ROOT/etc/xampp/oraclelib):$LIBRARY_PATH"
fi

if test "$(osguess)" = "macosx"
then
    # Thanks to drosenbe! - oswald [3sep10]
    if test -z $DYLD_LIBRARY_PATH
    then
	export DYLD_LIBRARY_PATH="$LIBRARY_PATH"
    else
	export DYLD_LIBRARY_PATH="$LIBRARY_PATH:$DYLD_LIBRARY_PATH"
    fi
else
    # Thanks to drosenbe! - oswald [3sep10]
    if test -z $LD_LIBRARY_PATH
    then
	export LD_LIBRARY_PATH="$LIBRARY_PATH"
    else
	export LD_LIBRARY_PATH="$LIBRARY_PATH:$LD_LIBRARY_PATH"
    fi
fi

iswebmin="false";
if test -d $XAMPP_ROOT/webmin
then
	iswebmin="true";
fi

# Hack to let XAMPP run with SELinux (for Fedora)
if test "$(osguess)" = "linux"; then
	 $XAMPP_ROOT/share/xampp/selinux
fi

if test "$(osguess)" = "macosx" && ! test -f "$lc/rights_fixed" && test $(id -u) -eq 0
then
	$GETTEXT -s -n "File permissions are being checked..."
	$XAMPP_ROOT/bin/fix_rights
	if test $? -eq 0
	then
		$GETTEXT -s "ok."
	else
		$GETTEXT -s "fail"
	fi
fi

case $1 in
	"start")
		printf "$($GETTEXT 'Starting XAMPP for %s %s...')\n" "$XAMPP_OS" "$version"

		checkRoot
		
		error=0
		
		startApache || error=1
		startMySQL || error=1
		if test -f $lc/startftp
		then
			startProFTPD || error=1
		fi
		if $iswebmin && test -f $lc/startwebmin
		then
			startWebmin || error=1
		fi
		
		exit $error
		;;

	"reload")
		printf "$($GETTEXT 'Reload XAMPP for %s %s...')\n" "$XAMPP_OS" "$version"
		
		checkRoot
		
		error=0
		reloadApache || error=1
		reloadMySQL || error=1
		reloadProFTPD || error=1
		exit $error
		;;
		
	"enablessl")
		checkRoot
		
		echo -n "XAMPP: " $($GETTEXT 'XAMPP: Enable SSL...')
		
		if test -f "$lc/startssl"
		then
			$GETTEXT -s "already enabled."
			exit 0
		fi
		
		errmsg=$(touch "$lc/startssl" 2>&1)
		
		if test $? -ne 0
		then
			$GETTEXT -s "fail."
			echo $errmsg
			exit 1
		fi
		
		$GETTEXT -s "ok."
		
		if ($XAMPP_ROOT/share/xampp/statusraw | grep -q "APACHE RUNNING")
		then
			$0 restartapache
			exit $?
		fi
		
		exit 0
		
		;;
	
	"disablessl")
		checkRoot
		
		echo -n "XAMPP: " $($GETTEXT 'Disable SSL...')
		
		if ! test -f "$lc/startssl"
		then
			$GETTEXT -s "already disabled."
			exit 0
		fi
		
		errmsg=$(rm "$lc/startssl" 2>&1)
		
		if test $? -ne 0
		then
			$GETTEXT -s "fail."
			echo $errmsg
			exit 1
		fi
		
		$GETTEXT -s "ok."
		
		if ($XAMPP_ROOT/share/xampp/statusraw | grep -q "APACHE RUNNING")
		then
			$0 restartapache
			exit $?
		fi
		
		exit 0
		
		;;

	"startapache")
	
		checkRoot
	
		startApache
		exit $?
		;;

	"startmysql")
	
		checkRoot
	
		startMySQL
		exit $?
		;;
		
	"startwebmin")
		if ! $iswebmin
		then
			echo "XAMPP: " $($GETTEXT -s "Webmin isn't installed.")
			exit 1
		fi
		
		checkRoot
		
		if test "$2" != "%"
		then
			touch $lc/startwebmin
		fi

		startWebmin
		exit $?
		;;

	"startftp")
	
		checkRoot
	
		if test "$2" != "%"
		then
			touch $lc/startftp
		fi
		if test -f $lc/startftp
		then
			startProFTPD
		fi
		;;

	"stop")
		printf "$($GETTEXT 'Stopping XAMPP for %s %s...')\n" "$XAMPP_OS" "$version"

		checkRoot

		error=0

		stopApache || error=1
		stopMySQL || error=1
		if test -f $lc/startftp
		then
			stopProFTPD || error=1
		fi
		if $iswebmin && test -f $lc/startwebmin
		then
			stopWebmin || error=1
		fi

		exit $?
		;;

	"stopapache")
		checkRoot
		
		stopApache
		exit $?
		;;

	"reloadapache")
		checkRoot
		
		reloadApache
		exit $?
		;;

	"stopmysql")
		stopMySQL
		exit $?
		;;
		
	"stopwebmin")
		if ! $iswebmin
		then
			echo "XAMPP: " $($GETTEXT "Webmin isn't installed.")
			exit 1
		fi
		
		checkRoot
		
		if test "$2" != "%"
		then
			rm $lc/startwebmin
		fi
			
		stopWebmin
		exit $?
		;;

	"reloadmysql")
	
		checkRoot
	
		reloadMySQL
		exit $?
		;;


	"stopftp")
		checkRoot
	
		if test "$2" != "%"
		then
			rm $lc/startftp 2> /dev/null
		fi
		stopProFTPD
		exit $?
		;;

	"reloadftp")
		checkRoot
	
		reloadProFTPD
		exit $?
		;;

	"wizard")
		checkRoot
	
		$XAMPP_ROOT/bin/php $XAMPP_ROOT/share/xampp/wizard.php
		;;

	"restartapache")
		checkRoot
		
		stopApache
		sleep 1
		startApache
		exit $?
		;;

	"restart")
		printf "$($GETTEXT 'Restarting XAMPP for %s %s...')\n" "$XAMPP_OS" "$version"
		
		checkRoot
		
		stopApache
		stopMySQL
		if test -f $lc/startftp
		then
			stopProFTPD
		fi
		if $iswebmin && test -f $lc/startwebmin
		then
			stopWebmin
		fi
		
		sleep 1
		error=0
		
		startApache || error=1
		startMySQL || error=1
		if test -f $lc/startftp
		then
			startProFTPD || error=1
		fi
		if $iswebmin && test -f $lc/startwebmin
		then
			startWebmin || error=1
		fi
		exit $?
		;;

	"security")
		checkRoot
	
		$XAMPP_ROOT/share/xampp/checkall
		;;
	"oci8")
                checkRoot

		$XAMPP_ROOT/share/xampp/oci8install
		;;
	"backup")
		checkRoot
		
		$XAMPP_ROOT/share/xampp/backup $2
		;;
		
	"status")
		$XAMPP_ROOT/share/xampp/status
		;;

	"statusraw")
		$XAMPP_ROOT/share/xampp/statusraw
		;;

#	"php4")
#		$XAMPP_ROOT/share/xampp/activatephp @PHP4_VERSION@
#		;;
#
#	"php5")
#	        $XAMPP_ROOT/share/xampp/activatephp 5.4.16
#	 	;;

        "phpstatus")
		$XAMPP_ROOT/share/xampp/phpstatus
		;;
	
	start*|stop*|reload*|status*|restart*)
		checkRoot
		
		$XAMPP_ROOT/share/xampp/addons $*
		;;

	"version")
		printf "$($GETTEXT 'Version: XAMPP for %s %s')\n" "$XAMPP_OS" "$version"
		;;

	"fix_rights")
		checkRoot
		
		echo -n "XAMPP: " $($GETTEXT 'File permissions are being checked...')
		$XAMPP_ROOT/bin/fix_rights
		error=$?
		if test $error -eq 0
		then
			$GETTEXT -s "ok."
		else
			$GETTEXT -s "fail."
		fi
		exit $error
		;;

	*)	
		printf "$($GETTEXT 'Usage: %s <action>')\n" "$(basename $0)"
		echo ""
		echo "	start        " $($GETTEXT "Start XAMPP (Apache, MySQL and eventually others)")
		echo "	startapache  " $($GETTEXT "Start only Apache")
		echo "	startmysql   " $($GETTEXT "Start only MySQL")
		echo "	startftp     " $($GETTEXT "Start only ProFTPD")
		$iswebmin && echo "	startwebmin  " $($GETTEXT "Start only Webmin")
		echo ""
		echo "	stop         " $($GETTEXT "Stop XAMPP (Apache, MySQL and eventually others)")
		echo "	stopapache   " $($GETTEXT "Stop only Apache")
		echo "	stopmysql    " $($GETTEXT "Stop only MySQL")
		echo "	stopftp      " $($GETTEXT "Stop only ProFTPD")
		$iswebmin && echo "	stopwebmin   " $($GETTEXT "Stop only Webmin")
		echo ""
		echo "	reload       " $($GETTEXT "Reload XAMPP (Apache, MySQL and eventually others)")
		echo "	reloadapache " $($GETTEXT "Reload only Apache")
		echo "	reloadmysql  " $($GETTEXT "Reload only MySQL")
		echo "	reloadftp    " $($GETTEXT "Reload only ProFTPD")
		echo ""
		echo "	restart      " $($GETTEXT "Stop and start XAMPP")
		echo "	security     " $($GETTEXT "Check XAMPP's security")
		echo ""
		echo "	enablessl    " $($GETTEXT "Enable SSL support for Apache")
		echo "	disablessl   " $($GETTEXT "Disable SSL support for Apache")
		echo ""
		echo "	backup       " $($GETTEXT "Make backup file of your XAMPP config, log and data files")
		echo ""
                echo "	oci8         " $($GETTEXT "Enable the oci8 extenssion")
                echo ""
		if test $(osguess) = "linux" || test $(osguess) = "rh9"
		then
			echo "	panel        " $($GETTEXT "Starts graphical XAMPP control panel")
		fi
		if test $(osguess) = "macosx"
		then
			echo "	fix_rights   " $($GETTEXT "Resets file permissions.")
		fi
		echo ""
		;;
esac

/opt/lampp/share/xampp/xampplib

export GETTEXT=$XAMPP_ROOT/bin/gettext
export TEXTDOMAIN=xampp

bon="[1m"
boff="[m"

function checkRoot() {
	description="$1"
	
	if test $(id -u) -ne 0; then
		if test -z "$description"; then
			description=$($GETTEXT 'perform this action')
		fi
		
		printf "$($GETTEXT 'You need to be root to %s.')\n" "$description"
		exit 2
	fi
}

function testport() {
	if netstat -an | egrep "[.:]$1 .*LISTEN" > /dev/null
	then
		return 0
	else
		return 1
	fi
}

function testrun() {
	# if Solaris use BSD's ps
	if test -f /usr/ucb/ps
	then
		ps=/usr/ucb/ps
	else
		ps=ps
	fi

	if test -f $1
	then
		pid=`cat $1`
		if [ "x$pid" != "x" ] && $ps ax 2>/dev/null | egrep "^ *$pid.*$2" > /dev/null
		then
			return 0
		else
			rm $1
			return 1
		fi
	else
		return 1
	fi
}

for i in gawk mawk nawk awk
do
	for j in /usr/bin /bin /usr/local/bin
	do
		if test -f $j/$i
		then
			awk="$j/$i"
			break
		fi
	done

	if test "$awk" != ""
	then	
		break
	fi
done

if test "$awk" = ""
then
	echo "XAMPP: " $($GETTEXT 'Please install gawk or mawk. I need this to continue...') >&2
	exit 1
fi

function askn
{
	while true
	do
		$de && echo -n "XAMPP: $@ [nein] "
		$de || echo -n "XAMPP: $@ [no] "
		read a
		if test -z "$a"
		then
			a="n"
		fi
		case $a in
			y|j|ja|yes) return 0;;
			n|no|nein) return 1;;
		esac
	done
}

function asky
{
	while true
	do
		$de && echo -n "XAMPP: $@ [ja] "
		$de || echo -n "XAMPP: $@ [yes] "
		read a
		if test -z "$a"
		then
			a="y"
		fi
		case $a in
			y|j|ja|yes) return 0;;
			n|no|nein) return 1;;
		esac
	done
}

function askp
{
	while true
	do
		echo -n "XAMPP: $1 " >&2
		stty -echo
		read a
		stty echo
		echo "" >&2

		echo -n "XAMPP: $2 " >&2
		stty -echo
		read b
		stty echo
		echo "" >&2

		if test "$a" = "$b"
		then
			if test "$3" = "nocrypt"
			then
				echo "$a"
				return 0;
			else
				$XAMPP_ROOT/bin/php $XAMPP_ROOT/share/xampp/crypt "$a"
				return 0;
			fi
		fi

        echo "XAMPP: " $($GETTEXT "Passwords doen't match. Please try again.") >&2
	done
}

after being modified by the following from the PKGBUILD

	# start from xampp manager
	find ${pkgdir}/opt/lampp/mysql/scripts -type f -exec sed -i 's/\/opt\/lampp\/lampp\ startmysql/systemctl\ start\ mysqld/gI' {} \;

/opt/lampp/mysql/scripts  now uses systemctl to start a service the package does not provide

#!/bin/sh

HOSTNAME=`hostname`
MYSQL_PIDFILE=/var/lib/mysql/$HOSTNAME.pid

MYSQL_STATUS=""
MYSQL_PID=""
PID=""
ERROR=0

get_pid() {
    PID=""
    PIDFILE=$1
    # check for pidfile
    if [ -f "$PIDFILE" ] ; then
        PID=`cat $PIDFILE`
    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
}

start_mysql() {
    is_mysql_running
    RUNNING=$?
    if [ $RUNNING -eq 1 ]; then
        echo "$0 $ARG: mysql  (pid $MYSQL_PID) already running"
	exit
    fi
    systemctl start mysqld > /dev/null &

    COUNTER=40
    while [ $RUNNING -eq 0 ] && [ $COUNTER -ne 0 ]; do
        COUNTER=`expr $COUNTER - 1`
        sleep 3
        is_mysql_running
        RUNNING=$?
    done
    if [ $RUNNING -eq 0 ]; then
        ERROR=1
    fi

    if [ $ERROR -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
	
    kill $MYSQL_PID

    COUNTER=40
    while [ $RUNNING -eq 1 ] && [ $COUNTER -ne 0 ]; do
        COUNTER=`expr $COUNTER - 1`
        sleep 3
        is_mysql_running
        RUNNING=$?
    done

    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
}

cleanpid() {
    rm -f $MYSQL_PIDFILE
}

if [ "x$1" = "xstart" ]; then
    start_mysql
elif [ "x$1" = "xstop" ]; then
    stop_mysql
elif [ "x$1" = "xstatus" ]; then
    is_mysql_running
    echo "$MYSQL_STATUS"
elif [ "x$1" = "xcleanpid" ]; then
    cleanpid
fi

exit $ERROR

Edit 3:
What is the output of

stat /opt/lampp/var/mysql/

Also please post the command you use to start xammp and its output.

Last edited by loqs (2020-08-19 01:19:13)

Offline

Board footer

Powered by FluxBB