Install PHP 5.6.20 and 7.0.5
Posted: Wed Apr 27, 2016 3:16 pm
Code: Select all
./configure --with-apxs2=/usr/local/apache2/bin/apxs CFLAGS=-std=gnu99 --without-iconv
make
Code: Select all
# /bin/sh /work/applications/php-5.6.20/libtool --silent --preserve-dup-deps --mode=compile cc -Imain/ -I/work/applications/php-5.6.20/main/ -DPHP_ATOM_INC -I/work/applications/php-5.6.20/include -I/work/applications/php-5.6.20/main -I/work/applications/php-5.6.20 -I/work/applications/php-5.6.20/ext/date/lib -I/work/applications/php-5.6.20/ext/ereg/regex -I/usr/include/libxml2 -I/work/applications/php-5.6.20/ext/sqlite3/libsqlite -I/work/applications/php-5.6.20/TSRM -I/work/applications/php-5.6.20/Zend -D_POSIX_PTHREAD_SEMANTICS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -I/usr/local/include -std=gnu99 -DZTS -c /work/applications/php-5.6.20/main/php_open_temporary_file.c -o main/php_open_temporary_file.lo
/work/applications/php-5.6.20/main/php_open_temporary_file.c:187: error: thread-local storage not supported for this target
make: *** [main/php_open_temporary_file.lo] Error 1
It was because there was a "cc" (gcc 3.4.6) in /usr/local/bin. "configure" for some reason picked up cc in /usr/local/bin instead of gcc in /usr/bin (/usr/bin is the 1st in $PATH though).
I had to rename both cc and gcc in /usr/local/bin to gcc_3.4.6 to avoid the confusion.
After making the change, gcc started working. However, there are undefined symbols found during compilation.
Code: Select all
Undefined first referenced
symbol in file
libiconv_close /var/tmp//cc_5a4JM.o
libiconv_open /var/tmp//cc_5a4JM.o
libiconv
Code: Select all
# cd /work/applications/libiconv-1.14/
# ./configure --prefix=/usr/local/iconv
# make
# make install
Code: Select all
./configure --with-apxs2=/usr/local/apache2/bin/apxs CFLAGS=-std=gnu99 --with-mysql --with-mysqli --with-iconv=/usr/local/iconv
Code: Select all
./configure --with-apxs2=/usr/local/apache2/bin/apxs CFLAGS=-std=gnu99 --with-mysqli --with-iconv=/usr/local/iconv
Following commands to complete the compilation and installation of PHP.
Code: Select all
# make
make test
make install
Code: Select all
cp php.ini-development /usr/local/lib/php.ini
Edit your httpd.conf to load the PHP module. The path on the right hand side of the LoadModule statement must point to the path of the PHP module on your system. The make install from above may have already added this for you, but be sure to check.
For PHP 7:
Code: Select all
LoadModule php7_module modules/libphp7.so
Code: Select all
LoadModule php5_module modules/libphp5.so
Code: Select all
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Code: Select all
<FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
Code: Select all
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
Code: Select all
RewriteEngine On
RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]
Both versions compiled successfully. However, phpBB 3.1.x does NOT work with PHP 7 (code differences). Some say phpBB version 3.2.x may start supporting PHP 7. Therefore, the environment stays with PHP 5.6.20 for now.
NOTICE: Apache does not like both php versions to be included. If both php5 and php7 modules are loaded, it will crash with a core file. Keep one module at any given time in httpd.conf.
Code: Select all
LoadModule php5_module modules/libphp5.so
#LoadModule php7_module modules/libphp7.so
...
AddHandler php5-script .php
#AddHandler php7-script .php