cover photo

elmussol

elmussol@elsmussols.org

php 7 vs php 5.6

elmussol
 Xerta 
@Hubzilla Support Forum+ The machine I run this Hubzilla instance has this:

root@pendle:~# php -v                                                                                                                                                       
PHP 5.6.30-0+deb8u1 (cli) (built: Feb  8 2017 09:49:20)                                                                                                                    
Copyright (c) 1997-2016 The PHP Group                                                                                                                                      
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies                                                                                                              
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies


At the moment it also runs email, Nextcloud and Red Matrix (which will be taken down as soon as the Hubzilla instance is 100% ready for use).

I want to run php 7, it is an apt-get install away. What are the issues I need to think about in advance of this transition generally, and specifically with respect to Hubzilla and Red Matrix?
Andrew Manning
  
This reminds me, are the Debian dependencies listed in these detailed instructions still accurate?

My Vagrant provisioning script installs the following:

echo "Installing Apache.."
sudo apt-get install -y apache2
echo "Installing MariaDB.."
sudo apt-get install -y mariadb-server
echo "Installing git.."
sudo apt-get install -y git
echo "Installing php7.."
sudo apt-get install -y php7.0-zip php7.0-cli php7.0-curl php7.0-gd php7.0-mysql php7.0-mbstring php7.0-xml libapache2-mod-php7.0 php7.0-mcrypt
echo "Installing sendmail.."
sudo apt-get install -y mailutils sendmail-bin
Waitman Gobble
  
maybe mcrypt is a package in 7.0 but it goes away at some point in 7. it becomes just part of base php AFAIK

is sendmail still a thing? it's been years since i haven't used postfix :)
Mike Macgirvin
  
mcrypt is dead and buried.
PHP help

elmussol
 Xerta last edited: Wed, 21 Mar 2018 13:30:48 +0100  
Putting my very first PHP into a page and I have slightly confused myself. I've taken someone else's snippet and forming to my own purposes. So three variables $name, $email and $skype that are sent by email. I want one line of the email to be a comma-delimited line of the variables for easy copy and paste purposes into a CSV file that's being imported into a spreadsheet. I am using the concatenate operator and came up with this:

"Data: " . $name . "," . $email . "," $skype . "\n\n" . $otherstuff;

but it's choking on the commas I think.

How should thus be done?
 tech  PHP
Waitman Gobble
  
it's missing a contatenation,
"," $skype

should be
"," . $skype

You should probably escape quotes in strings and quote the strings.

function esq($v)
{
return str_replace('"','""',$v);
}

echo 'data: "'.esq($v).'","'.esq($email).'","'.esq($skype).'","'."\n\n".$otherstuff;
Waitman Gobble
  last edited: Tue, 14 Jul 2015 04:53:56 +0200  
oops, thomas' message was obscured in the fold, i missed it :)
elmussol
  
Thanks all.