Apache suddenly not working on vagrant - php

I'm using windows 10 and have provisioned a Scotch Box VM using vagrant.
Everything was working fine up till yesterday, can't see through what I may have done or what could have been done to the system (maybe a windows 10 update?)
Thing is, I can start my VM normally, I can connect to it using ssh, and I can even run php artisan tinker and mess around with php (In that way, php is working).
But I can't see any of the websites that are in the public folder! The files still exist; Even if I type directly the IP address of the VM (http://192.168.33.10/)
Thinking that it may be a update I did to php 7 using this:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php-7.0
Remove PHP 5 and install PHP 7:
sudo apt-get update
sudo apt-get purge php5-fpm -y
sudo apt-get install php7.0 php7.0-fpm php7.0-mysql -y
sudo apt-get --purge autoremove -y
found here
I have tried doing a restart on apache, via command line, but it says its missing a php 5 library:
vagrant#scotchbox:~$ sudo service apache2 restart
* Restarting web server apache2 [fail]
* The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 141 of /etc/apache2/apache2.conf: Could not > open configuration file /etc/apache2/mods-enabled/php5.load: No such file > or directory
Action 'configtest' failed.
The Apache error log may have more information.
When I try to sudo apt-get install the missing library, it says that it was already installed and up to date, and can't find the log it says above.
I switched my environment, and everything works fine on linux (not inside vagrant, but running the source code directly with artisan serve)
All help apreciated!

If you remove the php5 modules, you should remove line 141 from your /etc/apache2/apache2.conf file, the line would be LoadModule ....

Related

class "DOMDocument" not found in a Drupal 8 site

I've found an error on a page in my Drupal 8 site; it always show this message error when I visit it:
Error: Class 'DOMDocument' not found in /var/www/vhosts/mysite/core/lib/Drupal/Component/Utility/Html.php on line 286
I'm using Centos 6 and I runned this commands:
yum install php71w-xml
sudo service httpd restart
I verified in php.ini: extensions php are enabled dom, xml, xmlreader, xmlwrite
But not worked for me.
Can you give me a solution? I'm Drupal 8, php 7.1, apache2.2
I had the same issue on Ubuntu with php 7.x and fixed it doing the following.
sudo apt-get install php-xml
Once done, restart your web server
Source: https://laracasts.com/discuss/channels/servers/how-do-i-install-the-dom-extension-for-php7
You Need to Install XML Extension
$ sudo apt-get update
$ sudo apt-get install php5.6-xml //for PHP 5.6
and then restart the apache
$ sudo service apache2 restart
in case using NGINX
nginx -s reload

PHP XML Extension: Not installed

So i'm currently installing mybb and went through a very long tutorial on how to do it. The problem is when I get to the requirements check this shows up
How does one go about fixing this? I read that I may need to do
sudo apt-get install php-xml
I have done this and everything went ok but still doesn't change it to installed.
FYI: I have only been using this OS for a few days so please go nice on me :)
You're close
sudo apt-get install php-xml
Then you need to restart apache so it takes effect
sudo service apache2 restart
Had the same problem running PHP 7.2.
I had to do the following :
sudo apt-get install php7.2-xml
I solved this issue with commands bellow:
$ sudo apt-get install php7.3-intl
$ sudo /etc/init.d/php7.3-fpm restart
These commands works for me in homestead with php7.3
In Centos
sudo yum install php-xml
and restart apache
sudo service httpd restart
If you are working with php in windows, you can just access to the file "php.ini" located in your php instalation folder and uncomment the ";extension=xmlrpc" line deleting the ";"
("extension=xmlrpc")

Setting up LAMP Stack in Ubuntu 14.04

I am trying to setup LAMP stack on Ubuntu 14.04 LTS by installing each of the packages seperately in terminal and not by using LAMP software bundle packages. The following are the commands that I executed:
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install mysql-server
sudo apt-get install phpmyadmin
Is there any other configuration that needs to be done like configuring the apache2 server, phpmyadmin, etc... I looked it up on google and unable to find recent results.
Appreicate your help
Edit: Updated the query with more information
Go in the apache2 config file by typing:
sudo nano /etc/apache2/apache2.conf
Then, type the following and save the file:
Include /etc/phpmyadmin/apache.conf
Now, restart the apache2 server by typing:
/etc/init.d/apache2 restart

PHPMYADMIN not loading in Ubuntu12.04

I have installed phyMyAdmin on my Ubuntu 12.04 using sudo apt-get.. I configured the Apache2 Server as it was given in the Documentation The problem I am facing is that when i take "http://localhost/phyMyAdmin" nothing is displayed in the browser,instead it downloads a php file. Why is this occuring?How can I resolve this problem?
You're missing PHP.
From the terminal:
sudo apt-get install php5 php5-mysql
Then restart Apache:
sudo service apache2 restart
You can then navigate to http://localhost/phyMyAdmin and it'll work.
This might help you
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
sudo service apache2 restart

Complete removal of apache2 under linux

I have problem with removing apache2 under ubuntu. What I tried is:
sudo apt-get remove apache2
sudo apt-get purge apache2
unfortunatelly after any of upper commands, there are still files:
sudo find / -name "apache2"
/var/log/apache2
/var/lib/update-rc.d/apache2
/var/cache/apache2
/usr/share/doc/apache2.2-common/examples/apache2
/usr/share/apache2
/usr/lib/apache2
/usr/lib/apache2/mpm-event/apache2
/usr/lib/apache2/mpm-itk/apache2
/usr/lib/apache2/mpm-worker/apache2
/usr/lib/apache2/mpm-prefork/apache2
/usr/sbin/apache2
/run/apache2
/run/lock/apache2
/etc/init.d/apache2
/etc/apache2
/etc/cron.daily/apache2
/etc/default/apache2
/etc/logrotate.d/apache2
When i run sudo /etc/init.d/apache2 start
* Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
After typing localhost in browser it responds with:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Could this files disturb new apache server installation? I've checked them all but nothing interresting found.
EDIT:
Upper output is after removal of the server. After removal of all files from sudo find / -name "apache2" I did install again sudo apt-get install apache2. sudo /etc/init.d/apache2 outputs with:
* Starting web server apache2 Segmentation fault
Action 'start' failed.
The Apache error log may have more information.
But error.log and access.log are empty.
Apache install:
sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-worker apache2-utils apache2.2-common
Suggested packages:
apache2-doc apache2-suexec apache2-suexec-custom
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-common
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/321 kB of archives.
After this operation, 1,240 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Is it normal that it asks only for 1,240 kB space ?
First stop apache:
sudo service apache2 stop
Then, remove apache2 packages and dependencies:
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove --purge
If you manually modified or installed stuff, apt might not remove it. Check what's left:
whereis apache2
Have a look whats inside these directories, and if you're confident you want to trash it, manually remove the directories as below:
sudo rm -Rf /etc/apache2 /usr/lib/apache2 /usr/include/apache2
enter image description here
See the image of the error here
Remove apache2 from the Ubuntu
To remove totally from your localhost
1st check the current status using
service apache2 status
if it's active (running)
write next
sudo apt remove apache2*
Say yes using y
And have a nice day :)
Remove and install apache2 this way:
sudo apt-get purge apache2
sudo apt-get install apache2

Categories