This question already has answers here:
PHP code is not being executed, but the code shows in the browser source code
(35 answers)
Closed 6 years ago.
so i've started by setting up apache2 up on my ubuntu server. However it seemed to work fine however it did only show index.php as plain text, so i tried to use following command sudo apt-get install libapache2-mod-php5 and now it just show nothing when i access my server. it should be said that i've changed the listener port in ports.conf to 5055. Why am i not getting anything after installing libapache2?
so in order what i've done is
sudo apt-get install apache2
sudo nano /etc/apache2/ports.conf
sudo service restart apache2
sudo apt-get install libapache2-mod-php5
Try these. You might be missing something.
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo apt-get install php5 php5-mysql php-pear php5-gd php5-mcrypt php5-curl
This was taken from TrueSpot Media - https://www.truespotmedia.com/install-lamp-linux-apache-mysql-php-ubuntu/
Try running the following:
sudo apt-get install php5
sudo service restart apache2
If I am right however in assuming you are running Ubuntu 16.04, please instead run the following command:
sudo apt install php libapache2-mod-php
Related
For some reason, my php cli switched to 5.6.40 instead of the 7.2 version that I had before. Then I was unable to restart apache2, so I tried to apt purge php7 & php5 to reinstall them.
But now, I only have this error:
(sorry for the French, it says packages have unsatisfied dependencies). How can I clean it ?
I have already tried the following commands :
apt-get -f install
apt-get clean
apt-get update
apt-get upgrade
You have to purge comlete php7.3:
sudo apt-get remove -y --purge php7.3*
add repository (if not exist):
sudo add-apt-repository ppa:ondrej/php
install dependents
sudo apt install php libapache2-mod-php
if you have apache:
sudo systemctl restart apache2
if you have nginx:
sudo service nginx restart
install php:
sudo apt install php-fpm
check php:
sudo service php7.3-fpm status
i have a lampp stack on my Ubuntu 14.04 machine. It was installed from an apachefriends.org installer ages ago. As i can see in the binaries it has 2 PHP versions already installed with just a symlink for the actual php. Now i want to add a new PHP version (and keep the ones installed), in this case some 7.x on top of 5.x that are already present.
I think i could download and build/configure PHP but actually i have no idea how it would integrate into lampp with the existing versions. Particularly extensions, and possibly different config files. Would they use the same? Is it possible anyway?
For Ubuntu, follow:
Add PPA:
sudo add-apt-repository ppa:ondrej/php;
sudo apt-get update;
sudo apt-get upgrade;
Install Apache & MySQL (if not already installed):
sudo apt-get install apache2 mysql-server php-gettext php-xdebug;
Install PHP5.6 (if not already installed):
sudo apt-get install php5.6 php5.6-mysql php5.6-mbstring libapache2-mod-php5.6;
Install PHP7.1 (if not already installed):
sudo apt-get install php7.1 php7.1-mysql php7.1-mbstring libapache2-mod-php7.1;
Switching between PHP versions (via commands a2enmod & a2dismod):
Switch PHP Versions (7.1->5.6):
sudo a2dismod php7.1; sudo a2enmod php5.6; sudo service apache2 restart;
Switch PHP Versions (5.6->7.1):
sudo a2enmod php7.1; sudo a2dismod php5.6; sudo service apache2 restart;
I have a problem with phpmyadmin on ubuntu 16.04 after upgrading php 5.6 to php 7 by this way:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
after this command :
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
phpMyadmin has error :
The mysqli extension is missing. Please check your PHP configuration.
But it does not have error on php5.
I want use phpMyadmin on php7.
Can anyone help me?
You need to do following steps.
php --version
Check your php version and run following command.
sudo apt-get install php5.6-mysql
In my case my version of php is 5.6, you may have different. Replace your version and hit enter.
After installing just run
sudo service apache2 restart
Hope it will help
You first need to install php7 , then install php5.
Completely remove your php and phpmyadmin :
sudo dpkg -P phpmyadmin
sudo rm -f /etc/apache2/conf.d/phpmyadmin.conf
sudo service apache2 restart
sudo apt-get purge php.*
sudo service apache2 restart
Install php7 and php7.0-mysql and ... : https://askubuntu.com/a/705893/424146
Install phpmyadmin (on php7) : install phpmyadmin with lamp stack on ubuntu 16.04
Run these commands again to install php5.6 beside your php7:
Install php5.6 beside php7 : (I got help from this link)
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
sudo service apache2 restart
Switch PHP version:
From php5.6 to php7.0 :
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
From php7.0 to php5.6 :
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
Reinstall or Reconfigure PHPMyAdmin. The following worked for me:
dpkg-reconfigure phpmyadmin
Solution for Windows PC
Try to check to check your httpd-xampp config file.
Make sure the Make sure the Php-Module conform with your current php version.
example here: IfModule php5_module
Based on your migration you are using php7, so edit all the php5_module tag in your config file to php7_module and restart the apache server.
I'm running Ubuntu 14.04.5 LTS
I've run following commands
sudo apt-get update
sudo apt-get install imagemagick
sudo apt-get install php5-imagick
sudo apt-get update
Edited my php.in /etc/php/5.6/apache2/php.ini added following at end of file
extension=imagick.so
After all this
sudo service apache2 restart
But still I'm getting the error and even in php -m it's not showing Imagick.
Using
PHP 5.6.28-2+deb.sury.org~trusty+1 (cli)
Okay finally got solution..
sudo apt-get install php5.6-imagick
sudo service apache2 graceful
I am new using Ubuntu. Basically I want to set the LAMP package in order to test PHP locally. So I installed tasksel then I executed in the terminal.
sudo tasksel
Which promps a list of servers I can install. I move the cursor to LAMP Server option, hits enter and returns to the command line. Like if I had pressed EXIT.
What am I missing? Can someone experienced help me install LAMP even if it is on another way? I have Ubuntu 13, by the way. I have been struggling with this for a while now.
You can try with.
sudo tasksel install lamp-server
https://help.ubuntu.com/community/ApacheMySQLPHP
To install apache, open terminal and type in these commands:
sudo apt-get update
sudo apt-get install apache2
to test if apache is working use this simple script:
ifconfig eth0 | grep inet | awk '{ print $2 }'
and browse to : http://<you'r ip address>
to install mysql open the terminal and write this:
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
Once you have installed MySQL, we should activate it with this command:
sudo mysql_install_db
Finish up by running the MySQL set up script:
sudo /usr/bin/mysql_secure_installation
The prompt will ask you for your current root password.
Type it in.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Now, its time to install PHP:
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
That's it! restart apache to apply the changes:
sudo service apache2 restart
Hope it helps.
Change user to root
sudo su root
update the repository
sudo apt-get update
install LAMP packages by,
apt-get install apache2 php5 libapache2-mod-php5 mysql-server mysql-client php5-mysql
This three simple step is enough to install LAMP.
Courtasy: iGyan: Install LAMP with PHPmyadmin in linux
You can easily install LAMP stack in Ubuntu with one command lines:
apache2 mysql-server mysql-client libapache2-mod-auth-mysql php5 php5-mysql libapache2-mod-php5 php5-mcrypt php5-curl php5-cli php5-gd phpmyadmin apache2-utils