apt-get install apache2 wont' install configuration files - apache

I had some problems with apache2, so I decide to get a fresh start.
sudo apt-get --purge apache2
It won't clear my config files. So I manually rm the /etc/apache2 folder.
Then "sudo apt-get install apache2" won't create /etc/apache2 folder anymore. Tried clear apt/cache, won't help. Tried update/change different source.list, won't help.
Any hint there the problem might be?
Thank a lot.

The configuration files are created on the installation of the package apache2.2-common. The command apt-get install --reinstall apache2.2-common should do the trick.

Related

Apache2 uninstall issues

I had to recently uninstall Apache2 due to some broken package issues.
However, when I check with
`$ whereis apache2` Iget response `apache2:`
I have used $ sudo -rf /etc/apache2,$ sudo apt-get remove apache2-common
$ sudo apt-get --purge remove apache2 $ sudo apt autoremove but I have still not managed to completely remove all traces of the Apache2 from my Linux Mint 19.3 Cinnamon.
I shall highly appreciate if someone guide me in the right direction.
According to the commands above you completely removed Apache2.
apt remove removes the binaries of a package
apt purge removes everything related to the apache2 package including the configuration files.
In your case whereis is showing that there are no binaries, sources or manual pages of the apache2 package.

How to install gearman extension in php7 running on ubuntu 18.04

I am currently required to setup the new server running php7.2 and the server will have many background process for sending emails to customer. the recommendation I got was to use Gearman Job Server.
I have been searching but seems to have only post about gearman-job-server with php5 and below.
The process of installing Gearman Job Server with php7 will be covered in like 4 steps
Install and update the Gearman PPA
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:gearman-developers/ppa
sudo apt-get update
Install Gearman Job Server and some other required components and tools
sudo apt-get install gearman-job-server libgearman-dev php7.0-dev php-pear wget unzip re2c
sudo apt-get upgrade
Download, compile the gearman pecl module and add to php.ini
cd /tmp/
sudo wget https://github.com/wcgallego/pecl-gearman/archive/master.zip
unzip master.zip
cd pecl-gearman-master
sudo phpize
./configure
sudo make
sudo make install
echo "extension=gearman.so" | sudo tee /etc/php/7.0/mods-available/gearman.ini
sudo phpenmod -v ALL -s ALL gearman
Restart webserver or PHP FPM
sudo service php7.0-fpm restart
sudo service apache2 restart
If you are running a different version of PHP make sure you make the appropriate changes to the commands or directories mentioned above. ie “/etc/php/7.0/” to “/etc/php/7.1/” etc.
Thanks to techearl.com for their tutorial which can be found
Here
The answer by Ruberandinda Patience is correct and will work but since the gearman pecl module is packaged for Ubuntu there is a much simpler way to achieve the same thing:
apt install gearman-job-server php-gearman

Apache config file not being installed

I had apache2 installed on my raspberry pi 4 and was getting some strange behavior so I removed it via apt remove apache2, removed the /etc/apache2 directory and reinstalled by sudo apt-get apache2 -y.
After reinstallation the server would not start, I determine that there was no apache2.conf file in /etc/apache2.
I've tried installing and reinstalling several time to no avail. What am I doing wrong?
try
sudo apt-get purge apache2
If you just want a light-weight http server you might want to try Nginx as a replacement.
sudo apt-get --reinstall install apache2

phpredis extension doesn't work, unable to load 'redis.so'

I installed nginx, php, php-fpm, php-pecl-redis by yum.
All of them work but the last one.
When I run /usr/sbin/php-fpm, I got this:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/redis.so' - /usr/lib/php/modules/redis.so: undefined symbol: igbinary_unserialize in Unknown on line 0
I don't know what igbnary_unserialize means and how to fix it.
I checked the redis.so file under right path. I add extension=redis.so to php.ini
PHP version: 5.3.3
PhpRedis version: 2.2.7
I had the same issue. I'm on Ubuntu 16.04 LTS. Running sudo apt-get install php-igbinary resolved the issue for me. I have other issues, but that's what solved this one.
For people who are upgrading their php from 7.0 to 7.4 like me, and not able to get php-redis working. These are the steps I used after following the answers above.
1) remove Redis
sudo apt purge php-redis
2) Install Igbinary
sudo apt-get install php-igbinary
3) Install php-redis again
sudo apt-get install php-redis
I did the steps above because it seems only php7.0 is recognising the php-redis install but not the currently enabled php7.4
I also recommend removing other versions of PHP if you have should your problem continue unsolved.
Probably an issue with igbinary, is this installed? (try for example: cat /etc/php.d/igbinary.ini).
Here you can find and install igbinary
Related to this bug https://bugs.launchpad.net/ubuntu/+source/php-redis/+bug/1762935
You should remove php-redis from packages:
apt purge php-redis , and install it via pecl install redis
You should add "extension=redis.so" to php.ini
and remove redis from config.d in your php directory:
rm /etc/php/7.2/fpm/conf.d/#20-redis.ini
and
rm /etc/php/7.2/cli/conf.d/#20-redis.ini
restart php fpm and you will see that problem solved
On Ubuntu 20 and PHP 7.4
I did this and it worked :
sudo apt purge php-redis
sudo apt intall php-redis php7.4-redis
TEST redis server :
$ php --ri redis
or
$ redis-cli ping
$ redis-cli info stats
just resolve the same problem:
php-pecl-redis installed by yum will cause this problem.
so you need to install the php-redis manually. wget the package and phpize - configure - make ....

Accidentally deleted /etc/apache2/ folder, what can I do?

I tried things like "brew install homebrew/apache/httpd24" but nothing seems to retrieve the "/etc/apache2" folder. What can I do?
if you're on Ubuntu 14.04, this worked for me , you can check :
sudo apt-get remove --purge apache2 apache2-utils
sudo apt-get install --reinstall apache2 apache2-utils