webapp-skeleton icon indicating copy to clipboard operation
webapp-skeleton copied to clipboard

Problematic setup in Windows with MySQL

Open darkWolf-PR opened this issue 4 months ago • 1 comments

I´ve been messing with this Skeleton few years ago, which lead to literally having to remove like 90% of the stuff to at least get it working...so I´ve kind of logged some errors u get when trying to set this up on Windows machine.

I´m using Windows with Wamp(same with Xampp/whatever else) server, many different PHP versions and VirtualHosts and this is pretty much the only working line from whole installation: composer create-project -s dev contributte/webapp-skeleton acme

Makefile is not available in Win-and even if u get make from gnuwin32, it runs anly these:

	composer install
	
	mkdir -p var/tmp var/log

Copying neon file fails:

cp config\local.neon.example config\local.neon
process_begin: CreateProcess(NULL, cp config\local.neon.example config\local.neon, ...) failed.
make (e=2): Systém nemůže nalézt uvedený soubor.
make: *** [init] Error 2

Setup fails on Chmod

mkdir -p var/tmp var/log
The syntax of the command is incorrect.
make: *** [setup] Error 1

cs or phpstan fails with:

vendor/bin/codesniffer app tests
'vendor' is not recognized as an internal or external command,
operable program or batch file.
make: *** [cs] Error 1

phpstan can be run on Win like:
php vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=512M

but I did not found a way, how to run codesniffer, runing it like this php vendor/bin/codesniffer app tests leads to this(I have no idea, what it means or where´s problem):

# Support bash to support `source` with fallback on $0 if this does not run with bash
# https://stackoverflow.com/a/35006505/6512
selfArg="$BASH_SOURCE"
if [ -z "$selfArg" ]; then
    selfArg="$0"
fi

self=$(realpath $selfArg 2> /dev/null)
if [ -z "$self" ]; then
    self="$selfArg"
fi

dir=$(cd "${self%[/\\]*}" > /dev/null; cd ../contributte/qa/bin && pwd)

if [ -d /proc/cygdrive ]; then
    case $(which php) in
        $(readlink -n /proc/cygdrive)/*)
            # We are in Cygwin using Windows php, so the path must be translated
            dir=$(cygpath -m "$dir");
            ;;
    esac
fi

export COMPOSER_RUNTIME_BIN_DIR=$(cd "${self%[/\\]*}" > /dev/null; pwd)

# If bash is sourcing this file, we have to source the target as well
bashSource="$BASH_SOURCE"
if [ -n "$bashSource" ]; then
    if [ "$bashSource" != "$0" ]; then
        source "${dir}/codesniffer" "$@"
        return
    fi
fi

"${dir}/codesniffer" "$@"

I have phpcs in global Composer, but running it with default config leads to thousands of errors(wrong use of spaces-tabs etc.) and pointing to "ruleset.xml" leads to this error(which I have no idea, how to repair):

>phpcs --standard=ruleset.xml app
ERROR: Referenced sniff "SlevomatCodingStandard.Arrays.TrailingArrayComma" does not exist

And of course, BUILD codes(if u manage to change Postgres to MySQL) can be only run like this: php bin/console orm:schema-tool:drop --force --full-database

Keeping the NETTE_DEBUG=1 fails all these codes with "NETTE_DEBUG not recognized as any command".

I´ve also did not found a way, how to set ENV variable with VirtualHosts in Wamp, so I had to put it in htaccess to activate debug and Tracy - and that can be easilly forgotten and uploaded to production...

Most of these points seems to be valid for all Contributte skeletons. I just think using Windows should not be completely ignored.

darkWolf-PR avatar Feb 26 '24 21:02 darkWolf-PR