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

[BUG]: Install of Phalcon 5 Fails Using pecl on Ubuntu 22.04 #16213

Open
kgrammer opened this issue Nov 15, 2022 · 26 comments
Open

[BUG]: Install of Phalcon 5 Fails Using pecl on Ubuntu 22.04 #16213

kgrammer opened this issue Nov 15, 2022 · 26 comments
Labels
not a bug Reported issue is not a bug

Comments

@kgrammer
Copy link

When attempting to install Phalcon 5 in Ubuntu 22.04 using pecl, the build throws a lot of error and fails.

I start with "pecl channel-update pecl.php.net" which produces:

 Updating channel "pecl.php.net"
 Channel "pecl.php.net" is up to date

I then enter "pecl install phalcon" (I've also tried "pecl install phalcon-5.0.0", "pecl install phalcon-5.1.0" and "pecl install phalcon-5.1.1") and pecl starts and produces a lot of warning and then fails to build as outlined in the attached file.

Details

  • Phalcon version: (php --ri phalcon) INCOMPLETE, SO VERSION UNAVAILABLE
  • PHP Version: (php -v): 8.1.12
  • Operating System: Ubuntu 22.04
  • Installation type: PECL
  • Zephir version: N/A
  • Server: Apache
  • Other related info (Database, table schema): N/A
    kbg.txt
@kgrammer kgrammer added bug A bug report status: unverified Unverified labels Nov 15, 2022
@kgrammer kgrammer changed the title Install of Phalcon 5 Fails Using pecl on Ubuntu 22.04 [BUG]: Install of Phalcon 5 Fails Using pecl on Ubuntu 22.04 Nov 15, 2022
@Jeckerson Jeckerson added not a bug Reported issue is not a bug and removed bug A bug report status: unverified Unverified labels Nov 15, 2022
@SageITSolutions
Copy link

Having the same experience whether using PECL or not. It appears to fail when it goes to compile using make

@SageITSolutions
Copy link

SageITSolutions commented Nov 30, 2022

@kgrammer,

I've found a reasonable workaround in the interim. It seems the issue with phalcon 5 isn't phalcon 5, but the compiling of it using make. So I thought... why not just get it precompiled?

If you have wget and an unzipping tool installed (I used p7zip-full) you can do the following
wget https://github.com/phalcon/cphalcon/releases/download/v5.1.1/phalcon-php8.1-nts-ubuntu-gcc-x64.zip
7z x phalcon-php8.1-nts-ubuntu-gcc-x64.zip

After extracting the zip, you just have to manually move the phalcon.so file and register it in apache
Be sure to double check the version of phalcon, version of php, and if you are using thread safe version of php or not.

happy coding!!

@kgrammer
Copy link
Author

@SageDavis, yeah, I use the git repo build method defined the Phalcon 5 installation guide. But I was trying the pecl method since the Phalcon dev team have said they want that to be the default method in the future. I just wasn't able to get the pecl method working.

I have over half a dozen Phalcon 5 product/sites up and running using the direct build method provided.

@joszz
Copy link

joszz commented Dec 7, 2022

I'm running into these issues as well but in a dockerfile based on php:8.1-apache.
tried different versions of phalcon and the base PHP image, but none of them seem to work. Sort of clueless.
@Jeckerson:
Why is this labeled not a bug? is there something we are doing wrong?
I also tried building from source like @SageDavis, same problems as with pecl. I have the same output as te log in the opening post.
This (my dockerfile) used to work a couple months ago.

@kgrammer
Copy link
Author

kgrammer commented Dec 7, 2022

"Why is this labeled not a bug?"

My question exactly. :)

Here are my build commands that I've used to install Phalcon 5 now on about a dozen servers but I'm not running docker:

cd /usr/local/lib
git clone https://github.com/phalcon/cphalcon
cd cphalcon
git checkout tags/v5.1.3 ./
zephir fullclean
zephir build
phpenmod Phalcon

@SageITSolutions
Copy link

@joszz I was not able to find any working solution using PECL, but I was very much able to get this to work with Ubuntu 22 Phalcon 5 and PHP 8.1.

The problem isn't that phalcon doesn't work, it's that the compiler (make) isn't working with the code for whatever reason in the later versions of Ubuntu. What I did was download a pre-compiled .so and manually put it in the php extensions directory.
Versioning is the only thing that should be of conscern at that point. You should make a phpinfo file first and find out if you have a TS (Thread Safe) or NTS (Non-thread safe) version of PHP. If you install the extension for the wrong TS type it wont work. After finding that out, download the correct file from github.

wget https://github.com/phalcon/cphalcon/releases/download/v5.1.1/phalcon-php8.1-nts-ubuntu-gcc-x64.zip

In this case, if you have a thread safe version of php, change the -nts- to -ts-.

Once you have it and unzip it, move the .so file to you php8.1 ext folder, then edit the php.ini file and add the extension. Restart apache and check your phpinfo file again. It should show Phalcon

@joszz
Copy link

joszz commented Dec 8, 2022

@SageDavis thx, that'll have to do for now then...
Far from ideal to do this in a dockerfile but surely possible. Hoping for a proper fix.
P.s. The topic refers to Ubuntu but I can confirm the problem on Debian bullseye and Alpine 3.16 as well. Compiling with make or PECL.

@lmuskalla
Copy link

lmuskalla commented Dec 22, 2022

We've had the same problem and spent quite a few hours trying to compile Phalcon 5.1.x on an Ubuntu 22.04 AWS EC2 image. It spits out many warnings which seemingly can be ignored, but then suddenly stops at the php_zephir_init_globals function. CPU is at 100%, memory runs full and after a few minutes the process is killed without additional info as to what happened. We tried increasing memory, using swap, etc. - nothing helped. We also tried to go through the compiling process and find out more about the issue, but didn't get too much.

We then tried to install via apt with ppa:ondrej/php and php-phalcon5 - installation went fine, but the extension couldn't be loaded.

Finally, we tried pre-compiled versions liked recommended above, but again - extension couldn't be loaded.

It seems to us that this should be due to processor infrastructure. Our image runs on ARM (aarch64).
We used to compile Phalcon from a Packagecloud package, but Version 5 didn't make it there yet.
So now we are wondering if there is a tested and verified way to install Phalcon 5 on ARM at all?

@kgrammer @joszz on which infrastructure are you guys?

@joszz
Copy link

joszz commented Dec 22, 2022

@lmuskalla I'm on X86-64, specifically an Intel Pentium N6005.

I only had issues trying to compile it myself or through PECL.
When I use the precompiled version here on Github everything runs fine.
I actually just released a working Docker container with the precompiled Phalcon binary from Github in it;
https://hub.docker.com/r/gotgeeks/chell/tags

The Dockerfile in the project just gets this precompiled binary and installs it in the container.

@diplopito
Copy link
Contributor

diplopito commented Dec 26, 2022

Once you have it and unzip it, move the .so file to you php8.1 ext folder, then edit the php.ini file and add the extension. Restart apache and check your phpinfo file again. It should show Phalcon

Same issue and your workaround works fine. The closest to packagecloud :-D

@Jeckerson
Copy link
Member

@lmuskalla I'll try to compile inside AWS infra to check if it is really the problem. Also note, that most of compilation errors are due memory limitations. Try to create SWAP file with 2Gb during compilation or compile docker image somewhere else and push image to registry.

@joszz
Copy link

joszz commented Dec 27, 2022

I'm no expert in this field, but I do not believe the errors I get are due to memory constraints.
My unraid system has 32GB of RAM available.
I also tried this on WSL2, with 32GB of RAM, same problem when it comes to building the docker image, which comes down to building Phalcon. Building inside the dockerfile is (AFAIK) not that different to building's on baremetal.

@Jeckerson
Copy link
Member

@joszz Could you please provide Dockerfile example where it fails?

@joszz
Copy link

joszz commented Jan 3, 2023

@Jeckerson
Ok, I have no idea what changed, but I can't reproduce the problem anylonger.
Installing through PECL either 5.1.2 or 5.1.3 seems to work fine....

If I run into this again, I'll be sure to have a Dockerfile reproducing the problem ready.

@kgrammer
Copy link
Author

Quick update.
I tried pecl to build again today and while it was throwing a lot of warnings, it appeared to be building. But then at the end I received:

Build process completed successfully Installing '/usr/include/php/20210902/ext/phalcon/php_phalcon.h' Installing '/usr/lib/php/20210902/phalcon.so' install ok: channel://pecl.php.net/phalcon-5.1.3 configuration option "php_ini" is not set to php.ini location You should add "extension=phalcon.so" to php.ini Segmentation fault
So it ended in a segmentation fault.

I am still unable to build using pecl.

@ghost
Copy link

ghost commented Jan 29, 2023

This is similar to #15973

@kgrammer
Copy link
Author

I just tried to rebuild Phalcon using PECL again and it still fails. I received the following error(s) from the PECL command:

cc: fatal error: Killed signal terminated program cc1
compilation terminated.
make: *** [Makefile:210: phalcon.lo] Error 1
ERROR: `make' failed

It is also worth noting that the Phalcon documentation still says to use the command "pecl install phalcon-5.0.0" which fails. I used "pecl install phalcon-5.2.3". This is an ongoing complaint I have with the Phalcon.io documentation. It is not being properly updated to reflect the latest Phalcon release. This basically renders the build documentation useless for new Phalcon uses. How are they supposed to know to replace phalcon-5.0.0 with phalcon-5.2.3?

@Jeckerson
Copy link
Member

@kgrammer With what RAM amount did you tried to install and inside what OS?

Also, you just might to skip version and use pecl install phalcon, which will pick latest version.

@kgrammer
Copy link
Author

kgrammer commented Aug 14, 2023

Thanks Jeckerson.

Today's PECL build attempt was on a server with 2GB of memory. The initial report failed on a server with 8GB of memory. I can try the PECL build on the 8gb server, but it's my production server and I will have to find an off-hours time for that to happen since the PECL build takes quite some time to complete. That is difficult to do on a server that has international users.

My point about the documentation is one I've made several times now. The documentation doesn't say "pecl install phalcon" so a new user, reading the Phalcon 5 install guide, would be unable to make it past that step. As written, the documentation ensures failure for new Phalcon users trying to use the preferred installation method.

Niden and I have chatted about this a few times, and I while understand the difficulty of keeping the web site current with the latest release, failing to do adds roadblocks for new users.

@Jeckerson
Copy link
Member

@kgrammer 2Gb is enough. We will update the documentation. Thank you for your note!

@edgarsstrods
Copy link
Contributor

Monitored a build yesterday and at the peak it took around 3GB of RAM (Ubuntu 22.04 VPS). I would suggest that 4GB machine is minimum requirement if installed using PECL. Also would be good to mention it in the documentation, because some small single-purpose or experimental VPS instances could be normal to have far less RAM dedicated and 'make' failed has no indication of "not enough memory".

@kgrammer
Copy link
Author

@niden and I were working on a PHP 8.3 build issue and I confirmed that PECL does not work on a small server. I was trying to install with PECL on a 1CPU/2GB server and PECL was failing. When I upgraded to a 2CPU/4GB server, PECL installed Phalcon as expected.

Niden said he would add memory size notes to the installation docs. When that is done, I would consider this a closable/completed issue.

@diplopito
Copy link
Contributor

I tried to install Phalcon 5.6.1 on an AMD Epyc-Milan processor with 4 cores, 4Gb of RAM with Plesk using Pecl. The server crashed and then it reported this error:

Failed to install the phalcon package on the 8.1.27 FPM application PHP handler
Task is not responding: id=21, pid=84958, type=install-php-extension, clientRemoteAddr=xxx, current_stage=process, extensionName=phalcon, phpHandlerId=plesk-php81-fpm, phpHandlerName=8.1.27 FPM application, redirect=/cp/php/extensions/id/plesk-php81-fpm, runTaskUnderLogin=admin

I followed again the solution of @SageITSolutions and within 5 min Phalcon was up and running. Of course, there won't be any version update, will have to be done manually but it takes less time than Pecl.

Sorry for this question: Would it be possible to return to Packagecloud? The installation was really simple and fast.

@niden
Copy link
Member

niden commented Feb 26, 2024

Sadly no. Adding phalcon back to packagecloud introduces one more thing that we have to deal with in every release, and trust me we spent a lot of time setting those processes up. That was one of the main reasons that we wanted to go with PECL so that we don't have to do all this work. Remi and Onrej also have repositories that offer Phalcon, and although not everyone can use them, they are there.

@diplopito
Copy link
Contributor

Sadly no. Adding phalcon back to packagecloud introduces one more thing that we have to deal with in every release, and trust me we spent a lot of time setting those processes up. That was one of the main reasons that we wanted to go with PECL so that we don't have to do all this work. Remi and Onrej also have repositories that offer Phalcon, and although not everyone can use them, they are there.

Thanks for your reply and the tip: I just upgraded from 5.2.2 to 5.6.1 using Ondrej's repository and it was even faster than with Packagecloud. If I may, I would recommend this installation option in the documentation. It used to be there in 3.4 docs.

@niden
Copy link
Member

niden commented Feb 26, 2024

https://docs.phalcon.io/latest/installation/#linux-deb-ondrej-sury

Still here buddy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug Reported issue is not a bug
Projects
Status: Backlog
Development

No branches or pull requests

7 participants