PHP 7 vs 5.6 in Ubuntu 14.04


#1

I’m new to php and I’m having problems which I think is related to php versions. I’m getting errors with composer saying

 is missing from your system. Install or enable PHP's gd extension.
  Problem 3
    - The requested PHP extension ext-mbstring * is missing from your system. Install or enable PHP's mbstring extension.
  Problem 4
    - The requested PHP extension ext-mcrypt * is missing from your system. Install or enable PHP's mcrypt extension.
  Problem 5
    - The requested PHP extension ext-mysqlnd * is missing from your system. Install or enable PHP's mysqlnd extension.
  Problem 6
    - The requested PHP extension ext-pdo_mysql * is missing from your system. Install or enable PHP's pdo_mysql extension.
  Problem 7
    - The requested PHP extension ext-simplexml * is missing from your system. Install or enable PHP's simplexml extension.
  Problem 8
    - The requested PHP extension ext-xmlwriter * is missing from your system. Install or enable PHP's xmlwriter extension.[/code]
This is what I've done to install php
[code]sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get install -y language-pack-en-base
sudo apt-get update
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php                                                         
sudo apt-get update                                               
sudo apt-get install php5.6
sudo apt-get install php5 php5-cli php5-dev php5-json php-pear php5-gd php5-mysqlnd php5-curl
sudo ln -sfn /usr/bin/php5.6 /etc/alternatives/php
PHP 5.6.24-1+deb.sury.org~trusty+1 (cli) 
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

I have no idea what the problem is as I believe I have the required extensions installed. Any help would be appreciated (assume I know nothing).


#2

Are you trying to install PHP 7? Do you have a /var/www directory where you can create a php file with just

[php]<?php
phpinfo();[/php]

And check if those errors are actually installed?


#3

so I should create a file info.php and place that code into it and then type the ipaddress/info.php into my browser?
I had previous done the above and didn’t get anything to show up I don’t remember the error msg in the browser.


#4

Run it and give us the error message of there is one


#5

File not found.
http://192.168.1.20/info.php where 192.168.1.20 is the ip of the server and info.php is saved in /var/www directory.


#6

localhost/info.php or 127.0.0.1/info.php

And is your apache service running?


#7

I’m running nginx and it appears to be running.
nginx version: nginx/1.10.1

sudo service nginx restart nginx stop/waiting nginx stop/pre-start, process 2730


#8

localhost/info.php or 127.0.0.1/info.php
nothing happens no error.


#9

Two different ways to do this…

This:
[php]<?php phpinfo(); [/php]

Should produce something similar to the info.PNG image.

Another route would be to run a file thru commandline. Same code in the file, but you would run it as

php /path/to/file/info.php


info.PNG


#10

When I run php info.php I get

XDG_SESSION_ID => 3
TERM => xterm
SHELL => /bin/bash
SSH_CLIENT => 192.168.1.9 53450 22
SSH_TTY => /dev/pts/0
USER => warren
LS_COLORS => rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
MAIL => /var/mail/warren
PATH => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD => /var/www
LANG => en_US.UTF-8
SHLVL => 1
HOME => /home/warren
LOGNAME => warren
SSH_CONNECTION => 192.168.1.9 53450 192.168.1.20 22
LESSOPEN => | /usr/bin/lesspipe %s
XDG_RUNTIME_DIR => /run/user/1000
LESSCLOSE => /usr/bin/lesspipe %s %s
_ => /usr/bin/php
OLDPWD => /home/warren

PHP Variables

Variable => Value
_SERVER["XDG_SESSION_ID"] => 3
_SERVER["TERM"] => xterm
_SERVER["SHELL"] => /bin/bash
_SERVER["SSH_CLIENT"] => 192.168.1.9 53450 22
_SERVER["SSH_TTY"] => /dev/pts/0
_SERVER["USER"] => warren
_SERVER["LS_COLORS"] => rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
_SERVER["MAIL"] => /var/mail/warren
_SERVER["PATH"] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
_SERVER["PWD"] => /var/www
_SERVER["LANG"] => en_US.UTF-8
_SERVER["SHLVL"] => 1
_SERVER["HOME"] => /home/warren
_SERVER["LOGNAME"] => warren
_SERVER["SSH_CONNECTION"] => 192.168.1.9 53450 192.168.1.20 22
_SERVER["LESSOPEN"] => | /usr/bin/lesspipe %s
_SERVER["XDG_RUNTIME_DIR"] => /run/user/1000
_SERVER["LESSCLOSE"] => /usr/bin/lesspipe %s %s
_SERVER["_"] => /usr/bin/php
_SERVER["OLDPWD"] => /home/warren
_SERVER["PHP_SELF"] => info.php
_SERVER["SCRIPT_NAME"] => info.php
_SERVER["SCRIPT_FILENAME"] => info.php
_SERVER["PATH_TRANSLATED"] => info.php
_SERVER["DOCUMENT_ROOT"] => 
_SERVER["REQUEST_TIME_FLOAT"] => 1470452136.571
_SERVER["REQUEST_TIME"] => 1470452136
_SERVER["argv"] => Array
(
    [0] => info.php
)

_SERVER["argc"] => 1

PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file:  LICENSE

#11

Yeah, things aren’t right.

Try installing php7 from here https://github.com/kasparsd/php-7-debian do a git clone to grab it, then run the bash file.


#12

I gete these errors on the last step

sudo ./install.sh mkdir: cannot create directory ‘/usr/local/php7/etc/conf.d’: No such file or directory ln: failed to create symbolic link ‘/usr/local/php7/sbin/php7-fpm’: No such file or directory cp: cannot stat ‘php-src/php.ini-production’: No such file or directory cp: cannot create regular file ‘/usr/local/php7/etc/php-fpm.d/www.conf’: No such file or directory cp: cannot create regular file ‘/usr/local/php7/etc/php-fpm.conf’: No such file or directory cp: cannot create regular file ‘/usr/local/php7/etc/conf.d/modules.ini’: No such file or directory Adding system startup for /etc/init.d/php7-fpm ... /etc/rc0.d/K20php7-fpm -> ../init.d/php7-fpm /etc/rc1.d/K20php7-fpm -> ../init.d/php7-fpm /etc/rc6.d/K20php7-fpm -> ../init.d/php7-fpm /etc/rc2.d/S20php7-fpm -> ../init.d/php7-fpm /etc/rc3.d/S20php7-fpm -> ../init.d/php7-fpm /etc/rc4.d/S20php7-fpm -> ../init.d/php7-fpm /etc/rc5.d/S20php7-fpm -> ../init.d/php7-fpm sed: can't read /usr/local/php7/etc/php-fpm.conf: No such file or directory

It also says that the extension are not compatible with php 7 and I think I need them. Should I use php 5.6 instead?


#13

Okay. I Will look at their install script and what I have on my debian system, and may modify it to work