How to upgrade (or install) from PHP v.5.4.x to PHP 7.x?

BlackThorn

Verified User
Joined
Feb 24, 2013
Messages
34
Location
Istanbul
Hi there,

I'm using a different PHP (5.4.x) version. Now I would like to upgrade that to PHP 7.x but I could not do it anymore. So, is there any article/item to install PHP 7.x or upgrade PHP 5.4.x to PHP 7.x.? I just wanted to install or upgrade PHP 7 on a clean install but still I can't see any article item or thread at forums. Thanks for support.

Regards,
 
Hello,




1.
Code:
cd /usr/local/directadmin/custombuild
./build update


2. Depending on your needs, run one of the following (a or b):

a.
Code:
./build set php1_release 7.0
b.
Code:
./build set php2_release 7.0


3. Install PHP:


Code:
./build php d
 
Thanks Alex, that's very useful

Does PHP 7.x have any advantages oer php5x? and I should update for my DA?
 
Hello,




1.
Code:
cd /usr/local/directadmin/custombuild
./build update


2. Depending on your needs, run one of the following (a or b):

a.
Code:
./build set php1_release 7.0
b.
Code:
./build set php2_release 7.0


3. Install PHP:


Code:
./build php d

Thank you very much but why does php -v on the command line still show my old version?
 
It might be because of two reasons:

1. PHP 7 failed to build
2. PHP 7 was installed as alternative version.

What do you see with:

Code:
ls -lad /usr/local/php*/
?

Code:
cd /usr/local/directadmin/custombuild/
./build options
?
 
It might be because of two reasons:

1. PHP 7 failed to build
2. PHP 7 was installed as alternative version.

What do you see with:

Code:
ls -lad /usr/local/php*/
?

Code:
cd /usr/local/directadmin/custombuild/
./build options
?

Here you go after run these commands.

First command results:
Code:
drwxr-xr-x 3 root root 4096 Şub 23  2015 /usr/local/php/

Second command results:
Code:
Apache: 2.2.31
Dovecot: 2.2.21
AWstats: no
Exim: no
exim.conf update: no
SpamAssassin: no
ClamAV: no
ClamAV: no
MySQL: no
MySQL backup: yes
MySQL backup directory: /usr/local/directadmin/custombuild/mysql_backups
PHP: 5.5.31 as CLI without mail() header patch
phpMyAdmin: 3.5.8.2-all-languages
ProFTPD: no
Pure-FTPd: no
Atmail webmail: no
RoundCube webmail: 1.1.4
Replace "php.ini" with './build all' and './build php-ini': no
Auto updates/notifications: no
Run "clean" every time: yes
Run "clean_old_webapps" every time: yes
Run "clean_old_tarballs" every time: no
Show texts in bold: yes
SquirrelMail: 1.4.22
UebiMiau: no
Zend Optimizer: no
ionCube loader: 5.0.17

Thank you for quick response.
 
PHP: 5.5.31 as CLI without mail() header patch

You did not install PHP 7.0. Follow the guide once more and post here results (10-20 final lines from console) of the last command:

Code:
cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.0
./build php d
 
You did not install PHP 7.0. Follow the guide once more and post here results (10-20 final lines from console) of the last command:

Code:
cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.0
./build php d

Problem still not solve and really I'm tired of trying to install it. Here 10-20 final lines from console:

Code:
Make Complete
Copying php.ini..
/usr/local/lib/php.ini already exists, skipping.
Increasing memory limit to 32M...
Installing php...
Installing PHP SAPI module:       apache2handler
/var/www/build/instdso.sh SH_LIBTOOL='/var/www/build/libtool' libphp5.la /usr/lib/apache
/var/www/build/libtool --mode=install cp libphp5.la /usr/lib/apache/
cp .libs/libphp5.so /usr/lib/apache/libphp5.so
cp .libs/libphp5.lai /usr/lib/apache/libphp5.la
libtool: install: warning: remember to run `libtool --finish /usr/local/directadmin/custombuild/php-5.5.31/libs'
chmod 755 /usr/lib/apache/libphp5.so
[activating module `php5' in /etc/httpd/conf/httpd.conf]
Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20121212/
Installing PHP CLI binary:        /usr/local/bin/
Installing PHP CLI man page:      /usr/local/php/man/man1/
Installing PHP CGI binary:        /usr/local/bin/
Installing PHP CGI man page:      /usr/local/php/man/man1/
Installing build environment:     /usr/local/lib/php/build/
Installing header files:          /usr/local/include/php/
Installing helper programs:       /usr/local/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/lib/php/
[PEAR] Archive_Tar    - already installed: 1.4.0
[PEAR] Console_Getopt - already installed: 1.4.1
[PEAR] Structures_Graph- already installed: 1.1.1
[PEAR] XML_Util       - already installed: 1.3.0
[PEAR] PEAR           - already installed: 1.10.1
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
/usr/local/directadmin/custombuild/php-5.5.31/build/shtool install -c ext/phar/phar.phar /usr/local/bin
ln -s -f phar.phar /usr/local/bin/phar
Installing PDO headers:          /usr/local/include/php/ext/pdo/
PHP 5.5.31 Installed.
Rewriting all users httpd.conf files, please wait...
Debug mode. Level 10

dataskq: command: action=rewrite&value=httpd
Restarting apache.
Stopping httpd:                                            [  OK  ]
Starting httpd:
 
You're running CustomBuild 1.x, to get PHP 7.0 installed you should switch your server to Custombuild 2.0.


Read CustomBuild 2.0 FAQ on how to do it:
https://forum.directadmin.com/showthread.php?t=44743


Then you can install PHP 7.0 following the guide

Hi,

Problem solved but now httpd stopped:

Code:
Stopping httpd:                                            [FAILED]
Starting httpd: httpd: Syntax error on line 50 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf/extra/httpd-phpmodules.conf: Cannot load /usr/lib/apache/mod_ruid2.so into server: /usr/lib/apache/mod_ruid2.so: undefined symbol: unixd_config
 
Error

Code:
[root@server custombuild]# ./build php d
apache webserver configuration option is not compatible with php-fpm, lsphp or php-fastcgi PHP mode with mod_ruid2 enabled.

I got that error and this is my options.conf


Code:
#PHP Settings
php1_release=5.6
php1_mode=mod_php
php2_release=7.0
php2_mode=php-fpm
opcache=no
htscanner=no
php_ini=no
php_timezone=Europe/London
php_ini_type=production
ioncube=no
zend=no
suhosin=no
x_mail_header=yes

#MySQL Settings
mysql=5.6
mariadb=10.0
mysql_inst=no
mysql_backup=yes
mysql_backup_dir=/usr/local/directadmin/custombuild/mysql_backups
mysql_force_compile=no

#WEB Server Settings
webserver=apache
litespeed_serialno=trial
modsecurity=no
 
When you get an error:

Code:
apache webserver configuration option is not compatible with php-fpm, lsphp or php-fastcgi PHP mode with mod_ruid2 enabled.

you should disable mod_ruid2 by running the following commands:

Code:
./build set mod_ruid2 no

and then try again:

Code:
./build php
 
is there a way to have default php5.6 but also have php7 for other sites within the same box ?
 
Back
Top