WebDev

SMF Modifications => Releases & Version Updates => Topic started by: Chen Zhen on April 22, 2018, 11:49:22 PM

Title: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on April 22, 2018, 11:49:22 PM
SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Version 1.1 released April 22/2018.

This update includes many more code changes to facilitate PHP 7.2+ compatibility.

Pending:
Changes to ../Sources/Subs-Db-sqlite.php to replace sqlite_create_function with modern standard.
ie. PDO::sqliteCreateFunction or SQLite3::createFunction





Please uninstall and delete v1.0 prior to using this version.
Report any issues with this modification in this thread.

Enjoy.


Available to members only.

DOWNLOAD MODIFICATION (https://web-develop.ca/index.php?action=downloads;area=stable_smf_modifications;file=48)
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on April 23, 2018, 07:09:36 AM
Hmmm, I didn't know there was a first version. LOL

So is this SMF 2.0.15 with updated code or a mod to be installed as usual?

EDIT: Nevermind, I answered my own question. LOL I'll check it out.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on April 23, 2018, 09:52:19 AM
Ok, been playing with this and it doesn't work on my server for PHP 7.1 or 7.2. There may be something causing this on my server but not sure what yet...
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on April 23, 2018, 04:24:47 PM

Can you be more specific?

What do you mean it does not work?
Is your SMF installation functioning after installing this modification?
It should work for either PHP 7.1 or PHP 7.2.

It replaces code that would otherwise flag a warning for PHP 7.2.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on April 25, 2018, 08:04:38 AM
Sorry, been a bit busy... What I get when I switch to php 7.1 or 7.2 is:

Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on April 25, 2018, 06:34:01 PM
QuoteWhat I get when I switch to php 7.1 or 7.2 ...

That statement sounds like you attempted to enable (/switch to) PHP 7.2 after having a previous version working.

Please make sure you have PHP 7.2 installed and enabled then install SMF 2.0.15 with no modifications.
If everything is working fine at that point then install this mod and if you have issues at that point then report back.
 

Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on April 26, 2018, 08:57:14 AM
That's exactly what I did. I did it that way because I was using Docskillz.com and it would screw up my forum when I switched to it. So, I'll try one of my domains i'm not using for this sometime this weekend and see how it goes...
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on April 26, 2018, 05:42:50 PM
If no php will work after switching to the newer version then that means you do not have it set up properly in Apache or Nginx.
You need specific modules and commands to run different versions of PHP at the same time.

You can use mod_php, cgi or fcgi.
mod_php will only let you run 1 version of php for all your domains.
cgi or fcgi are more secure (fcgi is recommended) and will let you run different versions of php for each virtual server domain.

When everything is installed properly you can use Virtualmin -> [domain] -> Server Configuration -> Website Options to opt FCGI mode.
Virtualmin -> [domain] -> Server Configuration -> PHP Versions will let you select PHP 7.2.5 (<- latest).

What OS are you using? Is it Centos 7?
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on April 26, 2018, 05:53:38 PM

Centos 7
Assuming you have yum installed...

install Webmin & Virtualmin:
cd /tmp
wget http://software.virtualmin.com/gpl/scripts/install.sh
/bin/sh install.sh
install PHP 7.2:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi-php72
yum update
yum search php72 | more
yum search php72 | egrep 'fpm|gd|mysql|memcache'
yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache php72-php-pecl-zip php72-php-pecl-apcu curl libzip libzip5
yum install php72-php-common
php --version
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on April 27, 2018, 06:13:39 PM
Actually, I can use different PHP versions for different domains and was using WHM. The problem was I was using it in a test site in a subdirectory under docskillz. I'm just used to creating test sites there and wasn't thinking about using a separate domain. LOL I just needed to setup on off my domains that i'm not using for this. But i
m still thinking something is not setup right if php 7.2 makes my site not work at all...I'm missing something and will investigate.

Btw, I do have cent 7 minimal and yum is installed. I already have webmin installed on a vps but have not put any sites/domains on it yet until I get everything setup properly.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on April 27, 2018, 08:50:55 PM
Thank you for the instructions as it saved me a ton of work installing each one in webmin manually. Everything is finally installed and I just need to make sure it's all configured properly. I had to do it 3 times because a command or dependency was missing and needed to be installed before continuing. But it finally worked and I've learned a few things in the process which is always a good thing. :)
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on April 27, 2018, 09:07:45 PM

No problem. I've had some experience with installing newer PHP versions where things I needed were not installed.
I've kept the above install notes so that I can do it quickly each time I reinstall an OS or move to a new host.
Some of the above modules may be disabled by default in PHP in which case you need to enable them in php.ini.
For your multiple virtual servers they may be configured in apache or nginx to use their own specific php.ini file.
There will be a master php.ini file but it won't use that one if configured to use another.
 
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on April 27, 2018, 09:32:28 PM
In WHM there is a master php.ini and you can can use individual ones.

Tonight I've been playing with webmin/virtualmin. I just need to get let's encrypt working properly then I can set the site up.

Getting a little tired and hungry so I'll eat and rest and come back to this in a few hours...
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: bigguy on April 27, 2018, 09:54:16 PM
Man this brings back memories.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on April 27, 2018, 10:12:06 PM
Install certbot to use Letsencrypt.

Assuming you are using apache:
yum install certbot-apache
certbot --apache certonly

Then you need to tell it what domains you want to use it for and where to put the files:

ie.
example.com located in a site directory named example
also if the host and fqdn are set up properly it will be something like: example.example.com as well
certbot certonly --webroot -w /home/example/public_html/ -d example.com -d www.example.com -d example.example.com


It needs to be renewed every 90 days but I believe letsencrypt will let you renew every 30 days.
You can set a cron job at the first of every month with the following command:
certbot renew

... which will renew all you certificates that you entered via certbot




It will tell you where it put the certificate files.. make sure you note the directory.
Then you need to configure apache or nginx to use those files in apache/nginx configuration for each wesbite.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on April 27, 2018, 10:17:36 PM
This is an apache example from within the main configuration file.
Assuming the encryption files are located in: /etc/letsencrypt/live/example

Within a virtual host configuration (this is for every virtual domain/website in its part of the config.. "example" is just one domain):
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example/privkey.pem
SSLCACertificateFile /etc/letsencrypt/live/example/fullchain.pem
SSLCACertificatePath /etc/letsencrypt/live/example/
SSLUseStapling on
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1

outside of the virtual host configuration (this edit is only applied once prior to any of the above and not within any vitrual server config commands):
SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on April 29, 2018, 03:37:50 PM
Ok, I've been at this since last Monday, I think. LOL I've had to install it 4-5 times cause I've either locked myself out, did something and couldn't access ssh or virtualmin, or screwed up a setting and couldn't fix it. LOL But, I've stuck with it all weekend and I think I've almost got everything setup right... Except, I can't access the site I setup in my browser. I can access it via FTP and see the files in File Manager but there's something still not set properly.

As far as LE goes, Go to Webmin -> Webmin Configuration -> SSL Encryption and then the Let's Encrypt tab and adjust the settings from there. I'm not sure what version you have but it was already added to it when I installed Virtualmin. It works:

https://www.mytesterz.pw - that should show a blank page cause I've put an empty index.php in there.

I think my problem is I can't see anything in any subdirectories for some reason. I've put the SMF files in /test directory and it cannot see them.

https://www.mytesterz.pw/test

EDIT: I forgot to mention I'm trying to figure out how to get virtualmin to use LE...
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on April 29, 2018, 09:17:14 PM

Everything is up to date but I prefer to use certbot.
Webmin/Virtualmin do not set up everything properly all the time so I have learned.
Make sure it set www and non www for your websites because even though you set Apache/Nginx or use a .htaccess file to direct it as you wish it still needs both registered to work without error.

Perhaps you are having a permission/owner issue.
Try this command for you website directory...
(replace USERNAME with the user name you used + its path):
setfacl -R -m u:USERNAME:rwx /home/USERNAME/public_html

.. this will allow apache and ftp to gain access under your user name.

Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on May 01, 2018, 09:25:06 AM
Permissions for directories are 775 and files are 674? WTH? LOL I've been on so many servers and hosting I've lost count but this is the first time I've seen 674 for files.

However, the code you gave did not seem to work. I still can't see the site and the permissions are still screwed up. Ownership is correct.

I just realized I can easily change them in webmin and fixed them. But I still can't see that link... LOL

Well, I think it's going to take some time for me to get used to using Virtualmin/Webmin. It's very different from WHM which is much easier to use and automates a lot of things. I do plan on switching from WHM (paid) to this (free) eventually but it's just going to take some time to get adjusted.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on May 01, 2018, 05:03:44 PM

It's been a bumpy road for me going through the learning curve of self managed VPS using a free panel.
I made a few mistakes along the way & some people are really p*ssed at me (possibly permanently).  :(  :(

0775 for directories is ok or you can try 0755.
For files I think it is 0666.

Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on May 03, 2018, 12:09:37 AM

It might be 0644 for files.. I can't remember atm.

Here are commands to change permissions.
Opt the octet to what you want.


change USERNAME to the appropriate directory
find /home/USERNAME/public_html -type d -exec chmod 755 {} +
find /home/USERNAME/public_html -type f -exec chmod 644 {} +
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on May 03, 2018, 09:05:32 AM
I usually used 755 for directories and 664 for files. Most webservers and hosting use that although I've had some that don't but those tend to give me problems with installs, uploads, etc. so I stick with 755 and 644.

I've used those commands for changing permissions as well. I've forgot I had used them and them in a file so I can remember if I forget. LOL
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Chen Zhen on May 10, 2018, 11:09:22 PM
I updated this a few weeks ago mostly for the SMF 2.0.X branch.
It seems to be working very smoothly now on both SMF 2.0.15 & SMF 2.1 Beta4.
No issues thus far after the latest update.

I suppose I am the only one able to test it in a production environment so far?

FYI - local testing of SMTP email & PHP 7.2 is possible if you modify the local server software you are using.
I found some basic instruction for Wampserver which serves me very well.
Title: Re: SMF 2.0 - Enable PHP7.2+ Compatibility version 1.1
Post by: Skhilled on May 12, 2018, 05:27:51 PM
Sorry, but I've been very busy lately. Had some server issues we've been working on. However, I did create a new VPS and installed whm on it. I have just a few more things to fix and I'll give this a test on that server.
EhPortal 1.39.6 © 2024, WebDev