poniedziałek, 25 czerwca 2018

WebEngine - Cron Jobs

I believe that you have Apache with Linux. Ofc you can do it with MS Windows as well and it's called Windows Task Scheduler.

We just need to make script which will be executed periodically by our Linux.

Let's start!

Add following line by using command: crontab -e
*/1 * * * * /usr/bin/php -f /var/www/html/includes/cron/cron.php

Add this line with your real path of cron.php and if you don't know where is php use try command:
whereis php

That line in crontab will let execute cron php every minute.

If you want to configure it more specify then google it how it works. It's not super hard!

czwartek, 21 czerwca 2018

MuOnline WebEngine on CentOS 7 - easy guide !

Used files in guide:
- PuTTY
- WebEngine 1.0.9
- PHP 5.6.14
- MSSQL 2008 R2 SP2
- MuOnline S6 database scheme (MuOnline.bak)

Install Apache on CentOS7

Clean all in yum service and install Midnight commander
yum clean all
yum -y update
yum -y install mc

Install Apache
yum -y install httpd

Open port in firewall. You can open HTTPS port if you want, just replace 80 with 433.
Method I:
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables restart
Method II:
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload

Start Apache service and enable autostart with system

systemctl start httpd
systemctl enable httpd

You can check if Apache service is running
systemctl status httpd

You can stop this service as well but why??
systemctl stop httpd

List of sorted Apache installed modules
apachectl -M | sort

You can edit Apache configurations like for example a directory for website files or port for listening, but you need to AllowOverwrite to all
/etc/httpd/conf/httpd.conf
find and replace: AllowOverwrite None -> all
If file doesnt exist, try to search
find / -name httpd.conf

We can upload our Website files. I prefer WinSCP (download)
cd /var/www/html

Let's finally install PHP !
yum install php php-mysql php-devel php-gd php-pecl-memcache php-pspell php-snmp php-xmlrpc php-xml  
systemctl restart httpd

==== short_open_tag FIX ====
/etc/php.ini
If file doesnt exist, try to search
find / -name php.ini

Find: short_open_tag = Off
Replace: short_open_tag = On
systemctl restart httpd

==== BC Math Extension FIX ====
yum install php-bcmath
systemctl restart httpd

==== PDO dblib (linux) FIX ====
yum install epel-release
yum upgrade ca-certificates --disablerepo=epel
yum install php-mssqlsystemctl restart httpd

==== DBLIB can't connect to database :( SEND HELP ! ====
Check if SELinux is blocking our database connection
getsebool -a | grep httpd_can_network_connect

Enable if it's Off
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1 
systemctl restart httpd
==== DONE ====


Now you can go to your website following this path /install/install.php to start configure !

==== Writable Directories and Files (chmod) FIX ====
setsebool -P httpd_unified 1
cd /var/www/html/includes
chmod 776 cache/
chmod 777 cache/
chmod 777 cache/news/
chmod 777 cache/profiles/guilds/
chmod 777 cache/profiles/players/
chmod 777 cache/castle_siege.cache
chmod 777 cache/cron.cache
chmod 777 cache/downloads.cache
chmod 777 cache/news.cache
chmod 777 cache/plugins.cache
chmod 777 cache/rankings_gens.cache
chmod 777 cache/rankings_gr.cache
chmod 777 cache/rankings_guilds.cache
chmod 777 cache/rankings_level.cache
chmod 777 cache/rankings_master.cache
chmod 777 cache/rankings_online.cache
chmod 777 cache/rankings_pk.cache
chmod 777 cache/rankings_pvplaststand.cache
chmod 777 cache/rankings_resets.cache
chmod 777 cache/rankings_votes.cache
chmod 777 cache/server_info.cache
chmod 777 config/email.xml
chmod 777 config/navbar.json
chmod 777 config/usercp.json
chmod 777 config/webengine.json
chmod 777 config/modules/castlesiege.xml
chmod 777 config/modules/contact.xml
chmod 777 config/modules/donation.paymentwall.xml
chmod 777 config/modules/donation.paypal.xml
chmod 777 config/modules/donation.superrewards.xml
chmod 777 config/modules/donation.westernunion.xml
chmod 777 config/modules/donation.xml
chmod 777 config/modules/downloads.xml
chmod 777 config/modules/forgotpassword.xml
chmod 777 config/modules/login.xml
chmod 777 config/modules/news.xml
chmod 777 config/modules/profiles.xml
chmod 777 config/modules/rankings.xml
chmod 777 config/modules/register.xml
chmod 777 config/modules/usercp.addstats.xml
chmod 777 config/modules/usercp.buyzen.xml
chmod 777 config/modules/usercp.clearpk.xml
chmod 777 config/modules/usercp.clearskilltree.xml
chmod 777 config/modules/usercp.myaccount.xml
chmod 777 config/modules/usercp.myemail.xml
chmod 777 config/modules/usercp.mymasterkey.xml
chmod 777 config/modules/usercp.mypassword.xml
chmod 777 config/modules/usercp.reset.xml
chmod 777 config/modules/usercp.resetstats.xml
chmod 777 config/modules/usercp.unstick.xml
chmod 777 config/modules/usercp.vip.xml
chmod 777 config/modules/usercp.vote.xml

==== LEAVE A COMMENT IF IT HELPS YOU ! ====
==== ENJOY ==== 


==== FOR LAZY ASS ====
Copy and paste code below, but short_open_tag you need to do by yourself!

yum clean all
yum -y update
yum -y install mc
yum -y install httpd
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables restart
systemctl start httpd
systemctl enable httpd
systemctl status httpd
yum -y install php php-mysql php-devel php-gd php-pecl-memcache php-pspell php-snmp php-xmlrpc php-xml
systemctl restart httpd
yum -y install php-bcmath
systemctl restart httpd
yum -y install epel-release
yum -y upgrade ca-certificates --disablerepo=epel
yum -y install php-mssql
systemctl restart httpd
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1
setsebool -P httpd_unified 1
systemctl restart httpd
BYE !

Problem with Cron Jobs? Click here!