Apache a2enmod not found when compiling PHP 7, but is required - php

All,
I have compiled and installed Apache 2.2.32 successfully on Debian 8.7, following the directions at http://www.tecmint.com/install-and-compile-php-7-on-centos-7-and-debian-8/ but have received an error when compiling that it can't find a2enmod. Error below:
[preparing module 'php7' in /etc/apache2/mods-available/php7.load]
Can't exec "a2enmod": No such file or directory at /usr/bin/apxs line 578.
'a2enmod php7' failed Makefile:164: recipe for target 'install-sapi'
failed make: *** [install-sapi] Error 2
I have researched this error but most of my a2enmod searches result in finds for enabling ModRewrite for some reason (perhaps there's a link here?!). Anyway, I found the following question asked several months back, but there was no answer posted so I'm trying again:
https://stackoverflow.com/questions/38542193/a2enmod-doesnt-exist-when-compiling-apache-but-php7-compile-install-requires-i/42559640#42559640
The compile options are listed in the first link I gave, so I won't repeat them here, but I have followed the document to the letter, and it is using the same major versions of PHP, Apache and Debian as me. I don't know enough about the details of each of these or my platform to understand why this is, but I can't find how to install a2enmod anywhere, and aptitude searches give me nothing.
Can anyone help with this? I am trying to install the most recent version (9) of OwnCloud but I cannot get PHP 7 to compile!
Any help is much appreciated.

All,
After much of a headache, the answer appears to be in this article:
https://www.cyberciti.biz/faq/installing-php-7-on-debian-linux-8-jessie-wheezy-using-apt-get/
This tells us how to get the official debian repositories that include PHP 7 added to the apt repositories, then install them from there. This solves my problem by giving me php7, as for why it wasn't compiling itself remains a mystery.

You need install a2enmod binary, which for your Debian version is not in apache2.2-commonpackage, but in apache2.
So, simply, you have to do:
Debian 8+
apt-get install apache2
Debian wheezy
apt-get install apache2.2-common

Related

Install MS SQL Driver On TurnKey Linux

My php version is PHP 7.4.7 and my distro is lsb_release -a gives me
No LSB modules are avaliable
Distributor ID: TurnKey
Description: TurnKey GNU/Linux 9.12 (stretch)
Release: 9.12
Codename: stretch
and if I try to run the command sudo pecl install sqlsrv This is the output that I get
[root#360 ~]# sudo pecl install sqlsrv
downloading sqlsrv-5.8.1.tgz ...
Starting to download sqlsrv-5.8.1.tgz (186,879 bytes)
........................................done: 186,879 bytes
PHP Parse error: syntax error, unexpected end of file,
expecting function (T_FUNCTION) or const (T_CONST) in /usr/share/php/Archive/Tar.php
on line 2383
what do I need to do in order to install this module?
I'm totally unfamiliar with MS SQLserver, and PHP is not a language I have a lot to do with. But I'm intimately familiar with TurnKey, so let me have a crack at getting you going in the right direction! :)
Firstly TBH, I'm not sure whether your support question is a good fit for a Q&A site like this (at least not without much more info about the customisations that you've made and the steps previous to the issue where you find yourself). Regardless, I'll have a crack.
It's probably also worth noting that just in case it's nor clear, your current server is TurnKey v15.x - based on Debian 9/Stretch.
A quick google bought me to the MS docs which note there are some prerequisites. I'm not sure if these are related to your issue, but to ensure we're on the same page, please ensure that you have followed the relevant steps for Debian. I.e. as noted in these links:
https://learn.microsoft.com/en-au/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-2017#installing-the-drivers-on-debian-8-9-and-10
https://learn.microsoft.com/en-au/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017#debian17
You also didn't note how/where you installed PHP 7.4 from? I'm assuming that you installed via https://deb.sury.org/ i.e. followed the Debian steps here: https://packages.sury.org/php/README.txt
Assuming so, then I also suggest making sure that you have the latest version of PEAR installed (i.e. the one from Ondřej Surý's repo and not the one from Debian). If you want to check, try this:
apt policy php-pear
The Debian Streth version is currently 1.10.1 (full string: "1:1.10.1+submodules+notgz-9+deb9u1"). From what I can gather, the version from sury.org should be 1.10.9 (full string: "1:1.10.9+submodules+notgz-1+0~20191119.13+debian9~1.gbp296d25").
And/or installing like this should do the trick (if you have everything else already set up - probably worth double checking afterwards):
apt update
apt install php-pear
A bit more googling suggests that once you have all that sorted and if you still get that same issue, then try reinstalling Archive_Tar before retrying again:
pear install Archive_Tar
If you still have issues after that, unfortunately, I'm out of ideas. Although it's probably worth reporting the issue to MS? The issue tracker for the msphpsql code is here: https://github.com/microsoft/msphpsql/issues

Install gRPC on centOS / Plesk

I'm stuck for a couple of hours now, I want to use Cloud Fire store on domains on my Plesk Server, but I can't get it to work.
I followed the steps from https://cloud.google.com/php/grpc
and a lot of other tutorials, but on all I get errors.
I managed to update the OS PHP version of CentOS, but still no luck.
What I want is that PHP Version 7.2.14 works with gRPC (I already added extension=grpc.so to the php.ini)
But there really isn't a any good documentation on Plesk and gRPC
What errors are you getting? It's during installing grpc.so or it's installed but the script can't load it?
Also, from the link you give, "CentOS/RHEL 6" is not supported.
In my case help this
Install Pecl PHP for CentOS https://stackoverflow.com/a/31558558/1932494
Then run: pecl install grpc

PHP installation configure: error: Cannot find php_pdo_driver.h

So I have already installed Apache2 and Mysql on Linux Mint (the same as Ubuntu), Now I am trying to install PHP on Apache but I get a very strange error message :
configure: error: Cannot find php_pdo_driver.h.
I did some search on the Internet and I found out that these files were not embedded before in PHP, but they are now. I even checked for it myself in the PHP source folders and I found that specific file. Can anyone tell me what's the problem and how to solve it ?
actually PDO is included on PHP core.
You must install the PHP and MySQL bundled packages.
Use sudo apt-get install php5-mysql
you should check your php version, you must have php version 5 to load PDO.

PHP memcached - php_msgpack_serialize in Unknown on line 0

Recently upgraded PHP and ran into the following error message while updating:
php_msgpack_serialize in Unknown on line 0
So first of all, never heard of this package. All searches for this package leads to a single PECL repo (which really doesn't mean anything either) - which has about zero mentions from the community.
A few more searches and I tracked the origin down to a repo for php-memcached-dev - a repository I've never seen or heard of.
Of course, I have heard of the actual memcached library repo: libmemcached
I tried looking for this module everywhere for a sign of it being a legit part of centos but i can't seem to get any good/reliable results.
Places I searched for any sign of this package and/or repository:
http://pkgs.org/
http://stackoverflow.com
http://php.net
http://centos.org
Just searched https://bugs.php.net too...
I don't want to seem paranoid here, but I'm not even sure if this is legit at this stage.
Shrug - I dunno. I'm keeping my server turned off though until I see something else. Anyone have some advice/input ?
For the paranoid (and yes, I found it from being a little bit myself), here is an ugly google search : php_msgpack backdoor (note: only has 2 3 search results. Check out the date in the 2nd 3rd. i haven't clicked it myself and would not recommend anyone else click it either) This seems to be a rkhunter search looking for the same file being reported above. Probably just a coincidence but who knows. Thought I'd push it out there anyways.
UPDATE: Well, long story short this turned out to be an issue with a version of PHP that was installed with Cent. It has been fixed with the latest version.
On Ubunu 16.04 with PHP 5.5 from the Ondrej-PPA (https://launchpad.net/~ondrej/+archive/ubuntu/php) I could solve the problem by installing the package php-msgpack:
sudo apt-get install php-msgpack
And than enabling the php-msgpack with
sudo phpenmod msgpack
Perhaps you ave to restart apache2 after that if you use it with PHP.
Than this error is gone:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20121212/memcached.so' - /usr/lib/php/20121212/memcached.so: undefined symbol: php_msgpack_serialize in Unknown on line 0
One last thing to check:
msgpack extension must be loaded before memcached.
In my scenario extensions were loaded alphabetically and therefore memcached was loaded before msgpack. Php cli didn't work until I loaded msgpack before memcached.
Following commands solved my issue.
sudo apt-get install php-igbinary
sudo apt-get install php-msgpack
sudo service php7.3-fpm reload #Change to your version
Reference:
https://laracasts.com/discuss/channels/forge/php-71-update-broken-memcached
If you land here in Oct 2020 because you're getting an error after upgrading and you're using the repository ppa:ondrej/php you need to install the specific version of msgpack because all-of-a-sudden memcached is looking for this shared object.
We're running php 7.3 from this repo and although php-msgpack was installed, we needed to install php7.3-msgpack (which wasn't needed until this upgrade). No need to "enable" it as mentioned in the accepted answer. Just restart php.
Two steps:
sudo apt install php7.3-msgpack
sudo systemctl restart php7.3-fpm.service
http://msgpack.org/
http://pecl.php.net/package/msgpack
https://code.google.com/p/php-msgpack/
If your codebase doesn't use MsgPack, you can remove it from the php.ini and/or smaller files that mention it in the php.d/* subdirectories.
Well, long story short this turned out to be an issue with a version of PHP that was installed with Cent. It has been fixed with the latest version.

Error installing MongoDb PHP driver with XAMPP on Max OS Lion

I get this error when i try to run following command
sudo pecl install mongo
Error:
...php_mongo.c:22:10: fatal error: 'php.h'
file not found
#include <php.h>
^
1 error generated.
make: *** [php_mongo.lo] Error 1
ERROR: `make' failed
I am new to MAC, please help me to resolve this and get Mongo Working with PHP.
I have installed MacPorts and autoconf
It seems, that you did not install the xampp "Developer Package", required to build additional php extension. You can download the "Developer Package" from:
http://www.apachefriends.org/en/xampp-macosx.html#849
This has already been answered.
Please follow the processes outlined in this answer - Install PECL on Mac OS X 10.6.
I followed the process outlined here http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/, referenced by the above Stackoverflow link and the process for install pear, followed by pecl and subsequently -
sudo pecl install mongo
works perfectly on OSX Lion.
You may need to modify the extensions in /etc/php.ini, however, this is explained in the output after you install the php mongo driver.
It took me the whole day to find this answer, I had tried everything, but this worked finally:
sudo C_INCLUDE_PATH=/usr/local/opt/openssl/include /Applications/XAMPP/xamppfiles/bin/pecl install mongodb
I found this article very helpful. Saved a lot of time after I wasted a lot of time to check other links. I did for MAMP and think will work for XAMPP too.
The thing is MAMP does not ship with all PHP sources to compile pecl mongo file and create mongo.so. All what you need is download php for respective version you are using. I was using php version 5.6.10. I checked php.net site that was having 5.6.13 version. I downloaded sources for this version from PhP.net. Executed "sudo pecl install mongo" again and it worked.

Categories