# FAMP installation failure



## jaymax (Oct 12, 2015)

```
FreeBSD MACH1 10.2-RELEASE FreeBSD 10.2-RELEASE #0 r286666: Wed Aug 12 19:31:38 UTC 2015  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  i386
```

Seems as if I am in a "fail guaranteed" environment trying to install a FAMP stack.
Perhaps and hopefully, someone may spot an error in my attempt or suggest an alternate route.
FAMP <==>
*F*           FreeBSD 10.2 ... O/S
*A*           Apache24-2.4.16_1
*M*          MySQL56-5.6.26
*P *          PHP 5.6.26

Repeated installation of the various components and failures as far as
`info.php()`
returning a blank page and no evident error messages to stdout or in any recognizable log.

Installation Programs -
FreeBSD O/S installation fresh and clean

Apache24 - test out OK as indicated by
`apachectl configtest`,
starts and restarts normally:

Installed programs -


```
apache24-2.4.16_1                Version 2.4.x of Apache web server
apr-1.5.2.1.5.4                       Apache Portability Library
```
Can access sites on/off through URL

MySQL56 - installed programs:

```
mysql56-client-5.6.26               Multithreaded SQL database (client)
mysql56-server-5.6.26             Multithreaded SQL database (server)
php56-mysql-5.6.14                 The mysql shared extension for php
php56-mysqli-5.6.14                The mysqli shared extension for php
php56-pdo_mysql-5.6.14         The pdo_mysql shared extension for php
phpMyAdmin-4.5.0.2                 Set of PHP-scripts to manage MySQL over the web
```
Starts and stops as expected

PHP56 - finally decided to throw all 'extensions' into the foray -


```
libmcrypt-2.5.8_3                    Multi-cipher cryptographic library (used in PHP)
mod_php56-5.6.14                 PHP Scripting Language
pear-1.9.4_3                           PEAR framework for PHP
pear-PHP_Archive-0.12.0         Create and Use PHP Archive files
php5-extensions-1.7               "meta-port" to install PHP extensions
php56-5.6.14                          PHP Scripting Language
php56-bcmath-5.6.14             The bcmath shared extension for php
php56-bz2-5.6.14                   The bz2 shared extension for php
php56-calendar-5.6.14            The calendar shared extension for php
php56-ctype-5.6.14                The ctype shared extension for php
php56-curl-5.6.14                   The curl shared extension for php
php56-dom-5.6.14                 The dom shared extension for php
php56-extensions-1.0             "meta-port" to install PHP extensions
php56-fileinfo-5.6.14              The fileinfo shared extension for php
php56-filter-5.6.14                 The filter shared extension for php
php56-gd-5.6.14                    The gd shared extension for php
php56-gettext-5.6.14             The gettext shared extension for php
php56-hash-5.6.14                 The hash shared extension for php
php56-iconv-5.6.14                The iconv shared extension for php
php56-imap-5.6.14                 The imap shared extension for php
php56-json-5.6.14                  The json shared extension for php
php56-ldap-5.6.14                  The ldap shared extension for php
php56-mbstring-5.6.14           The mbstring shared extension for php
php56-mcrypt-5.6.14             The mcrypt shared extension for php
php56-mysql-5.6.14               The mysql shared extension for php
php56-mysqli-5.6.14              The mysqli shared extension for php
php56-odbc-5.6.14                The odbc shared extension for php
php56-opcache-5.6.14           The opcache shared extension for php
php56-openssl-5.6.14            The openssl shared extension for php
php56-pdo-5.6.14                 The pdo shared extension for php
php56-pdo_firebird-5.6.14     The pdo_firebird shared extension for php
php56-pdo_mysql-5.6.14      The pdo_mysql shared extension for php
php56-pdo_odbc-5.6.14       The pdo_odbc shared extension for php
php56-pdo_pgsql-5.6.14       The pdo_pgsql shared extension for php
php56-pdo_sqlite-5.6.14       The pdo_sqlite shared extension for php
php56-pgsql-5.6.14               The pgsql shared extension for php
php56-phar-5.6.14                The phar shared extension for php
php56-posix-5.6.14               The posix shared extension for php
php56-pspell-5.6.14              The pspell shared extension for php
php56-readline-5.6.14           The readline shared extension for php
php56-session-5.6.14           The session shared extension for php
php56-simplexml-5.6.14       The simplexml shared extension for php
php56-soap-5.6.14               The soap shared extension for php
php56-sqlite3-5.6.14             The sqlite3 shared extension for php
php56-tokenizer-5.6.14        The tokenizer shared extension for php
php56-xml-5.6.14                 The xml shared extension for php
php56-xmlreader-5.6.14       The xmlreader shared extension for php
php56-xmlwriter-5.6.14        The xmlwriter shared extension for php
php56-zip-5.6.14                  The zip shared extension for php
php56-zlib-5.6.14                 The zlib shared extension for php
phpMyAdmin-4.5.0.2             Set of PHP-scripts to manage MySQL over the web
```


Here all the questions come into play especially in the absence of dedicated logs and I cannot put a blank page in that category: I have tried it with both customized and default my.cnf and php.ini {both php.ini-production and php.ini-development} files: I do not know what next to try.

Interface file(s)/changes:
To
httpd.conf



```
Listen xxx.xxx.xxx.xxx:80

    LoadModule php5_module        libexec/apache24/libphp5.so

       DirectoryIndex index.php index.html index.htm


        Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"
         <Directory "/usr/local/www/phpMyAdmin/">
           Options None
           AllowOverride Limit

           Require local
           Require host xxx.xxx.xxx.xxx
         </Directory>


       # For parsing php files
         AddType application/x-httpd-php .php .htm .html
         AddType application/x-httpd-php-source .phps

       <FilesMatch "\.php$">
           SetHandler application/x-httpd-php
       </FilesMatch>
       <FilesMatch "\.phps$">
           SetHandler application/x-httpd-php-source
       </FilesMatch>
```


After requesting an info.php page, I can harvest from the httpd.error.log, multiple entries of the type ==>


```
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226-zts/dom.so' - /usr/local/lib/php/20131226-zts/dom.so: Undefined symbol "executor_globals" in Unknown on line 0
PHP Warning: PHP Startup: gd: Unable to initialize module
Module compiled with build ID=API20131226,NTS
PHP compiled with build ID=API20131226,TS
These options need to match
in Unknown on line 0
```

* the file(s)'/usr/local/lib/php/20131226-zts/dom.so' do exist: The "compiled with build" conflicts apparently only occurred after recompilation of php56 but a similar "Unable to load dynamic library" did exist

I do hope someone can identify some flaw in what I have done so far or can suggest an alternative solution.


----------



## julp (Oct 12, 2015)

Reinstall www/mod_php56 with ZTS (Zend Thread Safety) option disabled.



> Module compiled with build ID=API20131226,*NTS*
> PHP compiled with build ID=API20131226,*TS*


In your current installation, ZTS is enabled for PHP Apache module (www/mod_php56) (this is not needed for Apache with default prefork MPM) but is disabled for PHP extensions (and probably for lang/php56). Both need to match.


----------



## jaymax (Oct 14, 2015)

Thanks! Reinstalled slowly and deliberately but still ended up with these messages on `php start`
#`php start`

```
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/calendar.so' - Cannot open "/usr/local/lib/php/20131226/calendar.so" in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/calendar.so' - Cannot open "/usr/local/lib/php/20131226/calendar.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/ctype.so' - Cannot open "/usr/local/lib/php/20131226/ctype.so" in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/ctype.so' - Cannot open "/usr/local/lib/php/20131226/ctype.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/filter.so' - Cannot open "/usr/local/lib/php/20131226/filter.so" in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/filter.so' - Cannot open "/usr/local/lib/php/20131226/filter.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/json.so' - Cannot open "/usr/local/lib/php/20131226/json.so" in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/json.so' - Cannot open "/usr/local/lib/php/20131226/json.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/mbstring.so' - Cannot open "/usr/local/lib/php/20131226/mbstring.so" in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/mbstring.so' - Cannot open "/usr/local/lib/php/20131226/mbstring.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/mysqli.so' - Cannot open "/usr/local/lib/php/20131226/mysqli.so" in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/mysqli.so' - Cannot open "/usr/local/lib/php/20131226/mysqli.so" in Unknown on line 0
PHP Warning:  Module 'session' already loaded in Unknown on line 0

Warning: Module 'session' already loaded in Unknown on line 0
Could not open input file: start
```

These are absent from the /usr/local/lib/php/20131226/ directory
They were all compiled from code (`make install clean` seq.) and are listed in the `pkg info` listing?
However, they are all in a newly created
/usr/local/lib/php/20131226-zts/


I deinstalled these, removed the config files, `make rmconfig` where applicable and followed by `make config`. None had a zts option.
On recompiling their *.so files were all re- written to the /usr/local/lib/php/20131226-zts/ directory

The condition re-appears on `php start`, how can I escape this 'ztf' nightmare?


----------



## julp (Oct 14, 2015)

Weird. `make clean` was run before? Maybe:

```
echo 'lang_php56_UNSET_FORCE=ZTS' >> /etc/make.conf
echo 'www_mod_php56_UNSET_FORCE=ZTS' >> /etc/make.conf # not needed?
portmaster -r lang/php56
```
to get rid of it?

EDIT : would better to use somehting like:

```
.if ${.CURDIR:M*php5*}
WITHOUT_ZTS=YES
.endif
```


----------



## jaymax (Oct 14, 2015)

Lets see if I am understanding these steps.

The 
	
	



```
lang_php56_UNSET_FORCE=ZTS
```
 and 
	
	



```
www_mod_php56_UNSET_FORCE=ZTS
```
 are designed to force the removal of the ZTS settings from the makefile by appending (>>) to it at /etc/make.conf. Except that in my layout, /etc/make.conf does not exist.

# `ls /etc/make.conf`

```
ls: /etc/make.conf: No such file or directory
```

There are make.conf files in
`find / -name make.conf -print`

```
/usr/src/share/examples/etc/make.conf
/usr/share/examples/etc/make.conf
```

Or was this intended to be appended directly to the Makefiles in the respective directories of lang_php56 and www_mod_php56?

And of course the final:
`portmaster -r lang/php56` to rebuild the new  lang/php56 port.
what about the www/mod_php56 port ?

{BTW: where can I find info on the usage of '_UNSET_FORCE' thought it might have been under 'ports' in the man pages - but no such luck.}


----------



## julp (Oct 14, 2015)

Create /etc/make.conf if it doesn't exist, this is the place for this kind of settings.



> what about the www/mod_php56 port ?


I haven't tested but www/mod_php56 depends on lang/php56 so it should be rebuild, same for all PHP extensions.



> BTW: where can I find info on the usage of '_UNSET_FORCE' thought it might have been under 'ports' in the man pages - but no such luck


Maybe I found some documentation about it on FreeBSD's wiki but the page have been moved to the porter's handbook? Nevermind, you can find some details in the comments on top of /usr/ports/Mk/bsd.options.mk.


----------



## jaymax (Oct 15, 2015)

julp said:


> Create /etc/make.conf if it doesn't exist, this is the place for this kind of settings.
> 
> 
> I haven't tested but www/mod_php56 depends on lang/php56 so it should be rebuild, same for all PHP extensions.
> ...


--------------------------------------------------​OK! 

I added the /etc/make.conf file from  
/usr/share/examples/etc/make.conf

Appended the following as these were the missing lib. files and were found in the /usr/local/lib/php/20131226-zts/ directory after the 'multiple re-installs'

`echo 'www_mod_php56_UNSET_FORCE=ZTS' >> /etc/make.conf
echo 'lang_php56_UNSET_FORCE=ZTS' >> /etc/make.conf
echo 'misc_php56-calendar_UNSET_FORCE=ZTS' >> /etc/make.conf
echo 'textproc_php56-ctype_UNSET_FORCE=ZTS' >> /etc/make.conf
echo 'security_php56-filter_UNSET_FORCE=ZTS' >> /etc/make.conf
echo 'devel_php56-json_UNSET_FORCE=ZTS' >> /etc/make.conf
echo 'converters_php56-mbstring_UNSET_FORCE=ZTS' >> /etc/make.conf`​{My mindset here is if it is not broken don't fix it these were the broken ones found in the "wrong" directory! ... I'll hate to have to do another deinstallation / reinstallation of all the extensions; is there any way of doing this in 'bulk' ? }

Anyway I did the upgrade {incomplete} - `portmaster -r php56-5.6.14`
It ran, doing all the checksums, dependency, child settings etc. and finally came to an end at ==>


```
===>>> Continuing initial dependency check for databases/phpmyadmin
===>>> Launching child to install www/pecl-APC

===>>> Checking dependent ports >> www/pecl-APC (57/57)

===>>> Port directory: /usr/ports/www/pecl-APC

  ===>>> This port is marked IGNORE
  ===>>> cannot be installed: doesn't work with lang/php56 port (doesn't support PHP 5.5 5.6)


  ===>>> If you are sure you can build it, remove the
  IGNORE line in the Makefile and try again.

===>>> Update for www/pecl-APC failed
===>>> Aborting update

===>>> Update for phpMyAdmin-4.5.0.2 failed
===>>> Aborting update
```
Jut trying to proceed cautiously


----------



## julp (Oct 15, 2015)

You need to disable APC option for databases/phpmyadmin, as written in the error, APC is incompatible with PHP >= 5.5 (since PHP embeds its own opcache).


----------



## jaymax (Oct 15, 2015)

Please ignore last post; threw caution to the wind and proceeded with the deletion of the 'IGNORE' line in the Makefile.
Upgrade and reinstallation proceeding civilly. Hopefully on completion it will provide the desired solution.
===>>> The following actions were performed:

```
Re-installation of php56-5.6.14
  Re-installation of php56-zlib-5.6.14
  ...
  Re-installation of php56-pdo-5.6.14
```


----------



## jaymax (Oct 16, 2015)

Thanks, finally got it going, that was quite a task.


----------

