WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Adding libs in PHP7  (Read 3483 times)

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Adding libs in PHP7
« on: July 25, 2017, 12:20:13 PM »
Hi. I using TCL for a long time as a tiny home webserver for my own purposes. Till ver 8.x my webserver worked with apache2.2+php5+mariadb. Since as ver 8.0 offer to use php7 worked with apache2.4 i have installed all TCZ's and it seems be OK. Except one problem. I dont know how to add necessary lib extensions to php7. For example libgd. In php5 it was simple by downloading libs from repository and uncommenting few lines in /usr/local/apache2/conf/php5/extensions/dist.ini But now, i can't find any folder with php7 files. Simply downloading libs extensions has no effect. Editing php.ini is useless too. So how can i include some libs in php7?

P.S. Sorry for my english, i am from Ukraine   :-\

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: Adding libs in PHP7
« Reply #1 on: July 25, 2017, 03:39:40 PM »
The paths are different in PHP7 than in PHP5, so make sure your php.ini file is up to date. Also, have you loaded php7-ext.tcz? This contains the module libraries.

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Re: Adding libs in PHP7
« Reply #2 on: July 26, 2017, 12:33:17 PM »
I am using TCL 8.0 32bit, not Pure 64. There is no php7-ext.tcz Installing this package has zero-effect. Installing libgd.tcz and uncommenting    extension=gd.so in php.ini make such warning:
Code: [Select]
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-zts-20151012/gd.so' - /usr/local/lib/php/extensions/no-debug-zts-20151012/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
Seems php7-ext.tcz not for 32bit verson of php7

Code: [Select]
PHP Startup: Unable to load dynamic library '/usr/local/apache2/php7/extensions/gd.so' - /usr/local/apache2/php7/extensions/gd.so: wrong ELF class: ELFCLASS64
GD on php7 still not working.  :(
« Last Edit: July 26, 2017, 01:04:12 PM by bonbob »

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Re: Adding libs in PHP7
« Reply #3 on: July 29, 2017, 07:01:13 PM »
There are some error on this forum. I can't send a reply to a private message.

Compiled PHP7 extensions for 32bit is working. GD library loaded. But there is new problem. I can't find mysql.so in extension dir. Only mysqli.so and pdo_mysql.so. And they aren't loading untill i copy libs in /usr/local/mysql/lib/ into /usr/lib/ folder. Invalid Path to libmysqlclient.so

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: Adding libs in PHP7
« Reply #4 on: July 30, 2017, 09:24:59 PM »
I can not reply to a private or forum message if I am using firefox and it has been open too long. I get a permissions error. I do not know if you are having the same problem.

The PHP extensions will not load unless the libraries they need are available. Try ldd and the extension .so file to see what is required. For databases like mysql, try adding /usr/local/mysql/lib to /etc/ld.so.conf and run ldconfig. Then start apache (or nginx or which ever web server you are using).

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Adding libs in PHP7
« Reply #5 on: July 31, 2017, 07:43:39 AM »
I believe you need to have made at least 5 posts in order to be able to use the PM feature.

Regarding Firefox, I believe it's the forum software not trusting you anymore if the browser cache is too old.
It may help holding shift while clicking on the reload page button.
Download a copy and keep it handy: Core book ;)

Offline bonbob

  • Jr. Member
  • **
  • Posts: 99
Re: Adding libs in PHP7
« Reply #6 on: July 31, 2017, 04:47:17 PM »
So, there are results of my experiment:
 - adding /usr/local/mysql/lib to ld.so.conf solve problem with libmysqlclient.so
 - extension mysql.so was deprecated and deleted from php7, stay only mysqli.so and pdo_mysql.so
 - libgd 2.2.4 works correct both php5 and php7
 - apache2.2 not launch with apr-utils ver 1.5.4 and needed older version, crashing with child pid XXXX exit signal Segmentation fault (11)

Unfortunately one of my php-project required mysql-extension, so i have to stay on php5, while not to fix it.
Thanks for help!

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: Adding libs in PHP7
« Reply #7 on: July 31, 2017, 07:00:22 PM »
Remember to add etc/ld.so.conf to /opt/.filetool.lst to save this change across reboots.

Have you considered using PHP-FPM instead of the apache php module? Then you could use a newer apache or nginx instead and still use your compiled PHP7.

If you have a choice use PDO in PHP, so later you could easily switch to a decent database and not be stuck with mariadb.