Apache config file not being installed - raspbian

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

Related

Apache2 command such as a2enmod and a2ensite no working its showing command not found in Ubuntu

I am deploying Flask application in Apache2 server during this i need to run a command for enabling mod_wsgi by using:
sudo a2enmod wsgi
but its showing:
sudo: a2enmod: command not found
please help
thanks
I had the same problem with using Ubuntu 16.04 in AWS. However, installing apache2 along with libapache2-mod-wsgi and python-dev solved the issue.
Try:
sudo apt-get update
sudo apt-get install apache2 libapache2-mod-wsgi python-dev
Then,
sudo a2enmod wsgi
I share this tips because it append to me :
If you enter into the root account with su, the /usr/sbin folder is not in the path and the a2enmod command is not found...
So you have to use su - instead ;)
This can happen if you switch to root user as su root instead of su - on Debian Buster
Installation debugging
For asking about installation debugging, you have to post (and think) about
Architecture (hardware)
OS with version
Host attibution (server, desktop, other)
Procedure followed for installation
Software (apache) version
Anyway
You could try to reinstall your package. If under Ubuntu, you could try:
sudo apt update &&
sudo apt reinstall apache2 libapache2-mod-wsgi
Then rerun:
sudo a2enmod wsgi

/phpmyadmin not found on ubuntu server

I am attempting to install both RStudio and phpmyadmin on an ubuntu server from AWS.
I have spun up a AWS server using RStudio AMI which works successfully (http://www.louisaslett.com/RStudio_AMI/)
I am now attempting to install phpmyadmin on the server.
I have followed the normal steps to do so (installing each individually):
sudo apt-get install apache2 libapache2-mod-php5 php5 mysql-server php5-mysql
mysql_secure_installation
apt-get -y install phpmyadmin
This has installed phpmyadmin correctly. However, whenever I attempt to access the following link:
http://52.56.56.80/phpmyadmin I get the following error:
/phpmyadmin not found
I have included the line: "Include /etc/phpmyadmin/apache.conf" in /etc/apache2/apache2.conf as advised in other issues, however this does not fix the issue.
What do I need to do to be able to access phpmyadmin on my browser?
sudo gedit /etc/apache2/apache2.conf
add "Include /etc/phpmyadmin/apache.conf"
sudo /etc/init.d/apache2 restart

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

mCrypt not present after Ubuntu upgrade to 13.10

After I have upgraded my system from Ubuntu 13.04 to 13.10 several problems have occurred with apache, mysql and php configurations.
I solved most of them but I can't seem to get mCrypt library working.
Package is installed so i don't need to apt-get it. Server works and everything seems fine, but when I try to run php artisan serve with Laravel 4, I get a message that mCrypt is required.
I did php --ri mcrypt and the output was Extension 'mcrypt' not present.
I have tried putting extension=mcrypt.so to /etc/php5/apache2/php.ini but it didn't work.
Any ideas?
Output of dpkg --get-selections | grep php5
libapache2-mod-php5 install
php5 install
php5-cli install
php5-common install
php5-gd install
php5-json install
php5-mcrypt install
php5-mysql install
php5-readline install
I think I found the solution at launchpad.net.
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
sudo service apache2 restart
This worked for me.
I had this problem with Ubuntu 14.04 and I did the following to resolve it:
sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart
I also have this problem with Ubuntu 14.04 after install.
First enable the mcrypt
sudo gedit /etc/php5/apache2/php.ini
Add this command in any line
extension=mcrypt.so
Create conf.d folder in /etc/php5
sudo mkdir conf.d
And inside that folder create mcrypt.ini file
sudo gedit mcrypt.ini
Then add this command to that file
extension=mcrypt.so
Then create a link to file
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
Enable mcrypt module
sudo php5enmod mcrypt
Restart apache
sudo service apache2 restart
From Ubuntu 13.10 to 14.04:
sudo php5enmod mcrypt
sudo service apache2 restart
Works for me.
I also had this problem with Ubuntu 14.04 and Nginx,but the tip for me was restart the FPM service, so I did:
Install the library
apt-get install php5-mcrypt
Find the path
updatedb && locate mcrypt.so
Set the path of mcrypt.so inside the mcrypt.ini file located in /etc/php5/mods-available/mcrypt.ini
extension=/usr/lib/php5/20121212/mcrypt.so
And then restart the FPM service
service php5-fpm restart
Another solution if the package is already installed:
sudo aptitude reinstall php5-mycript
This worked for me after doing upgrade
Try this code:
ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini
service apache2 restart
I had the same problem with PHP 5.5.14 running on Mac OS X Yosemite. I was trying to install Laravel 5.0. And when I tried to create a new project I got an error like below (even when I tried to start the laravel server with php artisan serve
Alejandros-MacBook-Pro:Documents Lexynux$ laravel new blog
Crafting application...
PHP Notice: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
PHP Notice: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
Generating optimized class loader
Compiling common classes
Compiling views
PHP Notice: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
Application key [CCOPocoMjnJTx4AFXk64wqyTKyo3BlHq] set successfully.
Application ready! Build something amazing.
Alejandros-MacBook-Pro:Documents Lexynux$
So I just added the line below at the end of my php.ini file with the nano editor:
extension=mcrypt.so
sudo nano /etc/php.ini
Finally just restart the Terminal and restart the laravel app server with
php artisan serve
And it works fine!
just found on php.net
Note, for Ubuntu, simply installing php5-mcrypt did not get mcrypt to work. You need to execute the following commands as root to enable it:
apt-get install php5-mcrypt
mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
php5enmod mcrypt
service apache2 restart
http://php.net/manual/en/mcrypt.installation.php#114609
Sometimes, this "problem" occurs because you entered an artisan command on your local machine instead of on your virtual machine. If you are using Homestead, mcrypt is already installed. Consider it a reminder to homestead ssh