
wget https://downloads.sourceforge.net/project/pcre/pcre2/10.35/pcre2-10.35.tar.gz
wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
wget https://curl.haxx.se/download/curl-7.73.0.tar.gz
wget https://www.php.net/distributions/php-7.3.25.tar.gz
tar -xzf pcre2-10*
tar -xzf openssl-1*
tar -xzf curl-7*
tar -xzf php-7*

zypper -n install libexpat-devel
zypper -n install libxml2-devel
zypper -n install zlib-devel
zypper install -t pattern devel_C_C++

cd pcre2-10.35
./configure --disable-cpp --prefix=/usr/local/pcre2
make -j2
make install
cd ..

cd openssl-1.1.1h
./config  --prefix=/usr/local/openssl
make -j2
make install
cd ..
wget https://curl.haxx.se/ca/cacert.pem -P /usr/local/lib/

cd curl-7.73.0
./configure --prefix=/usr/local/curl
make -j2
make install
cd ..

cd php-7.3.25
./configure --with-pcre-dir=/usr/local/pcre2 --with-pcre-regex=/usr/local/pcre2 --enable-pdo --with-pdo-mysql=mysqlnd --with-openssl=/usr/local/openssl --with-curl=/usr/local/curl
make -j2
make install
cp php.ini-development /usr/local/lib/php.ini

# cacert.pem for SSL support, also you need to enable extension you want to use
#nano /usr/local/lib/php.ini
	#openssl.cafile = "/usr/local/lib/cacert.pem"
cd ..


wget https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.56.tar.gz
tar -xzf lighttpd-1*
cd lighttpd-1.4.56
./configure --prefix=/usr/local/lighttpd --disable-ipv6 --with-zlib --without-pcre --without-bzip2
make
make install
cd ..


# ------------------------------------------- autorun

zypper -n install nano
nano /usr/local/lighttpd/lighttpd.conf
nano /etc/init.d/boot.local
	/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/lighttpd.conf



# ------------------------------------------- optional

# may be usefull, turn off firewall only for development purposes
#SuSEfirewall2 off

# if you have problems with ipv6, may attempt on few hostings
nano /etc/init.d/boot.local
	sysctl -w net.ipv6.conf.all.disable_ipv6=1
	sysctl -w net.ipv6.conf.default.disable_ipv6=1

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/DOMAIN_ID/settings/ipv6" -H "X-Auth-Email: ACCOUNT_EMAIL" -H "X-Auth-Key: ACCOUNT_APIKEY" -H "Content-Type: application/json" --data '{"value":"off"}'


# optionally you can also edit
nano /etc/motd
nano /etc/HOSTNAME
