Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error to install php on ubuntu 14.04 #249

Closed
noamtahan opened this issue Jun 16, 2014 · 11 comments
Closed

Error to install php on ubuntu 14.04 #249

noamtahan opened this issue Jun 16, 2014 · 11 comments

Comments

@noamtahan
Copy link

Hi,
I need to use php 5.3.XX on apache for example 5.4.0.
I tried:

phpbrew install 5.4.0 +default
noam@noam-Inspiron-5423:~$ phpbrew install 5.4.0 +default
===> Downloading from http://museum.php.net/php5/php-5.4.0.tar.bz2
--2014-06-16 16:00:10--  http://museum.php.net/php5/php-5.4.0.tar.bz2
Resolving museum.php.net (museum.php.net)... 108.163.197.98
Connecting to museum.php.net (museum.php.net)|108.163.197.98|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11439508 (11M) [application/x-bzip2]
Saving to: ‘php-5.4.0.tar.bz2’

100%[=======================================================================================================>] 11,439,508  1.96MB/s   in 14s    

2014-06-16 16:00:24 (818 KB/s) - ‘php-5.4.0.tar.bz2’ saved [11439508/11439508]

===> php-5.4.0.tar.bz2 downloaded.
===> Extracting php-5.4.0.tar.bz2...
===> Applying patch file for freetype include path bug...
patching file configure
Hunk #1 succeeded at 38802 (offset -411 lines).
patch unexpectedly ends in middle of line
Hunk #2 succeeded at 40984 with fuzz 1 (offset -411 lines).
===> Configuring 5.4.0...


Use tail command to see what's going on:
   $ tail -f /home/noam/.phpbrew/build/php-5.4.0/build.log


configure: WARNING: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 (found: 3.0.2).
configure: WARNING: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 (found: none).
===> Building...
/home/noam/.phpbrew/build/php-5.4.0/ext/dom/node.c: In function ‘dom_canonicalization’:
/home/noam/.phpbrew/build/php-5.4.0/ext/dom/node.c:1898:21: error: dereferencing pointer to incomplete type
    ret = buf->buffer->use;
                     ^
In file included from /home/noam/.phpbrew/build/php-5.4.0/main/php.h:38:0,
                 from /home/noam/.phpbrew/build/php-5.4.0/ext/dom/node.c:26:
/home/noam/.phpbrew/build/php-5.4.0/ext/dom/node.c:1900:40: error: dereferencing pointer to incomplete type
     RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
                                        ^
/home/noam/.phpbrew/build/php-5.4.0/Zend/zend_API.h:571:20: note: in definition of macro ‘ZVAL_STRINGL’
   const char *__s=(s); int __l=l;   \
                    ^
/home/noam/.phpbrew/build/php-5.4.0/ext/dom/node.c:1900:5: note: in expansion of macro ‘RETVAL_STRINGL’
     RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
     ^
make: *** [ext/dom/node.lo] Error 1
Errornoam@noam-Inspiron-5423:~$ 

I added the lines:

export PHPBREW_SET_PROMPT=1
source /home/noam/.phpbrew/bashrc

at the end of the file ~/.bashrc
I tried to:

noam@noam-Inspiron-5423:~$ sudo apt-get install -y libicu48
[sudo] password for noam: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libicu48 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libicu48' has no installation candidate
noam@noam-Inspiron-5423:~$ 

Maybe this is really necessary?
Thanks

@noamtahan noamtahan changed the title error to install php on ubuntu 14.04 Error to install php on ubuntu 14.04 Jun 16, 2014
@shinnya
Copy link
Member

shinnya commented Jun 16, 2014

@noamtahan On Ubuntu 14.04, the version of libxml2 is over 2.9.0, and 5.4.0 <= PHP <= 5.4.6 and 5.3.1 <= PHP <= 5.3.16 can't be compiled with libxml2 >= 2.9.0. You can make sure of this fact by the following commands:

$ git clone git@github.com:php/php-src.git
$ cd php-src
$ git show c4b26cc1b0b0521c75e653fffec2a9e3b4bf8cbb
$ git branch -a --contains=c4b26cc1b0b0521c75e653fffec2a9e3b4bf8cbb

@noamtahan
Copy link
Author

Hi @shinnya ,
Thanks for your reply,
I am trying to install

noam@noam-Inspiron-5423:~$ phpbrew install 5.3.28 +default
===> Downloading from http://www.php.net/get/php-5.3.28.tar.bz2/from/this/mirror
--2014-06-16 18:04:58--  http://www.php.net/get/php-5.3.28.tar.bz2/from/this/mirror
Resolving www.php.net (www.php.net)... 72.52.91.14
Connecting to www.php.net (www.php.net)|72.52.91.14|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://il1.php.net/get/php-5.3.28.tar.bz2/from/this/mirror [following]
--2014-06-16 18:04:58--  http://il1.php.net/get/php-5.3.28.tar.bz2/from/this/mirror
Resolving il1.php.net (il1.php.net)... 212.199.163.166
Connecting to il1.php.net (il1.php.net)|212.199.163.166|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://il1.php.net/distributions/php-5.3.28.tar.bz2 [following]
--2014-06-16 18:04:58--  http://il1.php.net/distributions/php-5.3.28.tar.bz2
Connecting to il1.php.net (il1.php.net)|212.199.163.166|:80... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

===> php-5.3.28.tar.bz2 downloaded.
Found existing php-5.3.28, Skip extracting.
===> Applying patch file for freetype include path bug...
patching file configure
Hunk #1 succeeded at 38287 (offset -926 lines).
patch unexpectedly ends in middle of line
Hunk #2 succeeded at 40185 with fuzz 1 (offset -1210 lines).
===> Configuring 5.3.28...


Use tail command to see what's going on:
   $ tail -f /home/noam/.phpbrew/build/php-5.3.28/build.log


configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.4 (found: none).
configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.4 (found: none).
===> Applying patch file for php5.3.x on 64bit machine.
===> Building...
libtool: unrecognized option `-export-dynamic'
Try `libtool --help' for more information.
make: *** [sapi/cgi/php-cgi] Error 1
Errornoam@noam-Inspiron-5423:~$ 

and also:

noam@noam-Inspiron-5423:~$ phpbrew known
Available stable versions:
  5.5 versions:    5.5.13, 5.5.12, 5.5.11, 5.5.10, 5.5.9, 5.5.8, 5.5.7, 5.5.6
  5.4 versions:    5.4.29, 5.4.28, 5.4.27, 5.4.26, 5.4.25, 5.4.24, 5.4.23, 5.4.22
  5.3 versions:    5.3.28, 5.3.27, 5.3.26, 5.3.25, 5.3.24, 5.3.23, 5.3.22, 5.3.21

@shinnya
Copy link
Member

shinnya commented Jun 16, 2014

@noamtahan
You can fix the error libtool: unrecognized option -export-dynamic'by appending+intltophpbrew install 5.3.28+default`. See also #83.

By the way, I found that we could build PHP 5.3.28 without adding +intlon Ubuntu 14.0.4. The solution is to declare a CXX=g++ environment variable and the entire command is:
CXX=g++ /usr/local/bin/phpbrew --debug install 5.3.28 +default

In my investigation, appending +intl only sets CXX to g++. Here is the configure.log when +intl is added:

 creating libtool
 appending configuration tag "CXX" to libtool
+checking for ld used by c++... (cached) /usr/bin/ld -m elf_x86_64
+checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... (cached) yes
+checking whether the c++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
+checking for c++ option to produce PIC... -fPIC
+checking if c++ PIC flag -fPIC works... (cached) yes
+checking if c++ static flag -static works... (cached) yes
+checking if c++ supports -c -o file.o... (cached) yes
+checking whether the c++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
+checking dynamic linker characteristics... GNU/Linux ld.so
+(cached) (cached) checking how to hardcode library paths into programs... immediate

The reason why CXX environment variable is so important is that CXX is passed to libtool to link and generate spai/cgi/php-cgi executable binary. When you build PHP with phpbrew install 5.3.28 +default, spi/cgi/php-cgi is linked by the following command:

/bin/sh /root/.phpbrew/build/php-5.3.28/libtool --silent --preserve-dup-deps --mode=link  -export-dynamic -O3 -fvisibility=hidden  

...

-lcrypt -lstdc++  -o sapi/cgi/php-cgi

But this must be like the following if compiled correctly(you can see g++ is added):

/bin/sh /root/.phpbrew/build/php-5.3.28/libtool --silent --preserve-dup-deps --mode=link g++ -export-dynamic -O3 -fvisibility=hidden  

...

-lcrypt -lstdc++  -o sapi/cgi/php-cgi

@GM-Alex
Copy link
Member

GM-Alex commented Jun 20, 2014

As is remember ubuntu needs the +intl param.

@adis-io
Copy link

adis-io commented Aug 5, 2014

Appending CXX=g++ really helped me. Thank you very much!

@c9s
Copy link
Member

c9s commented Sep 27, 2014

Close as log.

@noahwilliamsson
Copy link

For anybody else who land here from Google while trying to figure out why older PHP releases can't be compiled on Ubuntu 14.04 LTS, the ext/dom/node.c issue is due to an incompatible change introduced in libxml2 version 2.9 and later (as noted here: [xml] Important: possible incompatible changes ahead for 2.9.0 !). Ubuntu 14.04 LTS ships libxml2 version 2.9.1.

This can be fixed by applying the patch attached to this post: Re: [xml] Bug when installing PHP with libxml2-2.9.0?

Though I'm not familiar with phpbrew's packaging specifically, patching an older PHP release extracted under the directory ~/src/php-5.4.0 (as an example) would look something like this:

$ cd ~/src/php-5.4.0/
$ curl -s https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt | patch -p0
patching file ext/dom/node.c
patching file ext/dom/documenttype.c
patching file ext/simplexml/simplexml.c

At this point, running make should no longer produce the error: dereferencing pointer to incomplete type error for ext/dom/node.c.

@c9s
Copy link
Member

c9s commented Oct 7, 2014

@noahwilliamsson Thanks for the information!

@jagandecapri
Copy link

@noahwilliamsson Thx. Building php 5.3.10 in Ubuntu 14.04 works now for me. Maybe include this in the Troubleshooting section. https://github.com/phpbrew/phpbrew/wiki/TroubleShooting

Thanks again!!

@dan-lee
Copy link

dan-lee commented Jan 28, 2015

👍 Thanks @noahwilliamsson! I added some information about this in the troubleshooting section.

@markseuffert
Copy link

👍 Thanks @noahwilliamsson, building PHP 5.4.4 on Ubuntu 14.04 works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants