I have been trying to install laravel for 3 days on ubuntu 16.04. I am following the top search links of laravel installation process. But I failed to execute each and every process I had tried. Now I am facing a different issue on installing PHP on my ubuntu. I had installed maria db once, but did not succeed.
But it might have broken something that resulted in me not being able to install PHP. The issue I am facing:
Reading package lists... Done
Building dependency tree
Reading state information... Done
php is already the newest version (1:7.2+62+ubuntu16.04.1+deb.sury.org+3).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
When I try php -v it gives me this error
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/mcrypt.so' (tried: /usr/lib/php/20170718/mcrypt.so (/usr/lib/php/20170718/mcrypt.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718//usr/lib/php/20170718/mcrypt.so.so (/usr/lib/php/20170718//usr/lib/php/20170718/mcrypt.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.9-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
I am totally new on ubuntu and laravel. And if anyone guide me how to install laravel on ubuntu 16.04 I will be very grateful.
Thank You.
Install git apt-get install git-core
git clone https://github.com/thamaraiselvam/LEMP-Stack-Installer.git
cd quick-lemp-install or cd LEMP-Stack-Installer
chmod +x lemp.sh this command makes bash script executable
./lemp.sh
That's it :)
PHP version - v7.0
Mysql version - Latest Stable
Note: Default mysql password is root. you can change it before running
in the following lines before running the script
sudo debconf-set-selections <<< 'mysql-server
mysql-server/root_password password YOUR_PASSWORD'
sudo debconf-set-selections <<< 'mysql-server
mysql-server/root_password_again password YOUR_PASSWORD'
Now Install Laravel
Go to cd /var/www/html/
sudo apt-get install php-common php-mbstring php-xml php-zip
composer create-project --prefer-dist laravel/laravel blog "5.5.*"
Try to execute the following commands to solve your problem:
Get the list of MySQL packages installed on the system by executing
the command sudo dpkg -l | grep mysql
Remove the the packages shown above by executing the command sudo apt-get --purge autoremove <packages from the step 1>
Delete /var/lib/mysql
Try to install mysql again. It should solve your problem
Related
I have installed PHP on Ubuntu 22.04 using the command: apt-get install php libapache2-mod-php
When I tried to install a Composer package, I got a message saying
The zip extension and unzip command are both missing, skipping
I took the advice of the top answer to an SO question (PHP error: "The zip extension and unzip command are both missing, skipping.") and ran: apt install zip unzip php-zip. The result of that is shown below:
ubuntu#ip<..>:/var/www/html$ sudo apt install zip unzip php-zip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php8.1-zip : Depends: php8.1-common (= 8.1.2-1ubuntu2.2) but 8.1.2-1ubuntu2.3 is to be installed
E: Unable to correct problems, you have held broken packages.
ubuntu#ip-<...>:/var/www/html$ php -v
PHP 8.1.2 (cli) (built: Aug 15 2022 12:24:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies
ubuntu#ip-<...>:/var/www/html$
I really have no idea how to react to this. Is there some way I can install php-zip without these dependency related problems?
I'm getting a PHP Fatal error:
Call to undefined function curl_init() error while testing some PHP code on my server.
I assumed Curl needed to be installed so i found the PHP version first:
php --version
PHP 5.6.11-1ubuntu3.4 (cli)
I proceeded to install the package:
sudo apt-get install php5-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-curl
I then tried:
sudo apt install php-curl
and it appeared to install but I saw references to PHP 7 and it completed successfully.
Yet, the problem persists.
How do I get curl running to stop the init() error?
UPDATE: When I run this I get:
sudo apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
curl is already the newest version (7.47.0-1ubuntu2.13).
0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.
You are using Ubuntu#16.04. 16.04 does not ship with php#5 but with php#7.
If you need your older version of php and its dependencies, you have to install it differently.
There is a trustworthy (note: any external repository may still be a security thread) repository maintained by ondrej, namely:
ondrej/php
I have build a Dockerfile using 16.04 to showcase how you could install php#5.6 and php5.6-curl:
FROM ubuntu:16.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq update && \
apt-get -qq install software-properties-common > /dev/null && \
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y > /dev/null && \
apt-get -qq update && apt-get -qq install php5.6 php5.6-curl > /dev/null
RUN php -v && php -m | grep curl
This Dockerfile is not ideal, yet the last run prints:
PHP 5.6.40-8+ubuntu16.04.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
curl
showing that it has php#5.6 and php-curl#5.6 installed.
Try:
First Install CURL by typing sudo apt-get install curl.
Then Restart Apache by typing sudo service apache2 restart.
Install PHP5 CURL sudo apt-get install php5-curl.
Restart Apache by typing sudo service apache2.
I just recently launched LAMP version 7.0 using bitnami on google app engine.
I couldn't find the older version of 5.6.
Any idea how i can downgrade the default PHP 7 to PHP 5.6 on my server
upon running this commandphp --version
i get this output
PHP 7.0.22 (cli) (built: Sep 6 2017 14:14:52) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.22, Copyright (c) 1999-2017, by Zend Technologies
kindly note that i have also installed PHP 5 using sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
but the dafault PHP version remains PHP 7.0.22
It is possible just to install the version of php you need. and change the set-up.
ssh into your VM from your console or
gcloud compute ssh [INSTANCE NAME] --ZONE [INSTANCE ZONE]
Inside your VM do:
If add-apt-repository is not installed
sudo apt-get install software-properties-common python-software-properties
then:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install 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
Apache:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
CLI:
sudo update-alternatives --set php /usr/bin/php5.6
Bitnami Stacks are self-contained. That means that they include every component they need (e.g. Apache, PHP, PHP-FPM, MySQL, etc.).
Those components are not installed using the System Package Manager of the Distro (e.g. yum on Centos or apt on Debian). Therefore, if you install a different version of PHP on your Image, you'll have two different PHPs installed. The one in the system and the one in the Stack. However, every component included in the Stack will use the PHP included in the Stack (no matter what version you installed in the system).
You can find the PHP in the LAMP Stack at /opt/bitnami/php. If you want to use PHP 5.X you have several options:
A. Download and install the LAMP Stack with PHP 5.6.x from https://bitnami.com/stack/lamp/installer on your server. After that, remove the previous LAMP Stack with PHP 7.
B. Install PHP using the System Package Manager. Then, modify the environment to remove /opt/bitnami/php from the PATH and also edit the file /opt/bitnami/scristps/setenv.sh to avoid including /opt/bitnami/php again in the PATH.
I have installed php 5.3 manually by executing commands like make & make install. But I need to upgrade it to v5.5 therefore I deleted all the directories related to php5 using sudo command.
But when I run php -v Still I am getting
PHP 5.3.29 (cli) (built: Jun 8 2015 05:53:32) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies
Please help me to remove
The below answer credit goes to Maythux
To uninstall something you installed from source, you would use cd back into the directory you built it from and then run sudo make uninstall but I don't think this will work with PHP since it doesn't have an uninstall.
So what you can do is to make a package from the existing compiled version you have and then you could install the new created package over the old one, and if this works you can remove it. First install checkinstall if you dont have it:
sudo apt-get install checkinstall
Then run:
cd php-5.3.29
sudo checkinstall
Accept all the defaults.The result will be a phpXX.deb package, so try to install it, this will replace the old files from the compiled package:
sudo dpkg -i phpXX.deb
If this goes smooth then you are near to have it. Now purge the package:
sudo apt-get purge phpXX.deb
What to do if this doesn't work
you should remove all files manually
locate php5
Then remove the files and install a new version with apt-get again
I'm trying to install php 5.6 on Amazon linux using the following command:
$ yum install php56
No package php56 available.
Error: Nothing to do
Is there a repository I need to add in order to do this? I've searched for this but couldn't find any source. I'd also like to know which Apache versions work with this version of php?
Below are the steps I have used to update PHP version from 5.3 to 5.6 in Amazon Linux
Steps (Use sudo only if required)
1) Remove OLD Apache
sudo service httpd stop
sudo yum erase httpd httpd-tools apr apr-util
2) Remove OLD PHP
sudo yum remove php-*
3) Install PHP 5.6 (Apache 2.4 will be automatically installed with this)
sudo yum install php56
4) Make sure all the required PHP extensions are installed
yum list installed | grep php
5) If not then install them using
sudo yum install php56-xml php56-xmlrpc php56-soap php56-gd
6) To list the other available php extensions
yum search php56
7) PHP 5.6 MySQL extension (Assume you have already installed MySQL)
sudo yum install php56-mysqlnd
(NOTE: it is not php56-mysql)
8) Start / Restart Apache
sudo service httpd start
sudo service httpd restart
9) Check the version
php -v
httpd -v
AWS has not yet packaged php 5.6. You need to install php 5.5 from the ALAMI repositories, or build 5.6 from source.
To list the available 5.5 packages use yum search php55
The php55 is the base package, but you may need others listed as well.
When 5.6 is ready, you'll be able to find it with
yum search php56
You can find information on building the source at php.net, specifically Installation on Unix Systems / Apache 2.x on Unix Systems
Just to mantain update the answers,
I tryed the proposed solution and didn't work.
Quite hard to install 5.6
I found the right command nowaday to install 7.2 is
amazon-linux-extras install php7.2
it install and upgrade everything without complications.
Try this:
sudo yum -y update
sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo wget https://centos7.iuscommunity.org/ius-release.rpm
sudo rpm -Uvh ius-release*.rpm
sudo yum -y update
When you install the package you'll need to add a u to the end of php56. Here is an example of some packages you could install.
sudo yum -y install php56u php56u-opcache php56u-xml \
php56u-mcrypt php56u-gd php56u-devel php56u-mysql \
php56u-intl php56u-mbstring php56u-bcmath php56u-soap
Successfully installed php56 and required php-module on amazonlinux2 with the repo epo.ius.io.
sudo yum -y update
sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://repo.ius.io/ius-release-el7.rpm
sudo rpm -Uvh ius-release*.rpm
sudo yum -y update
sudo yum install --enablerepo=ius-archive php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath php56u-soap
Check PHP version with below command
[root#ip-10-10-1-47 ~]# php -v
PHP 5.6.40 (cli) (built: Jan 11 2019 10:27:04)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
To install php module
yum install --enablerepo=ius-archive php56u-{Module Name}
Validate the module name
php -m
php -m | grep {Module Name}
example to check php yaml module
php -m | grep yaml
Reference URL : https://forums.aws.amazon.com/thread.jspa?threadID=284157
Additional part from #Daniele post for resloving this problem.
This is more help than question, but to help other with problem which I had in my case. I need to install Wordpress site on EC2, but when I tried to run it with public IP address, it was problem. I tried to install php 5.6, but it was not possible.
I find solution to install php 7.2, using command:
**amazon-linux-extras install php7.2**
TO check that is really version php 7.2, use:
php -version or php -v
After this, you need to stop apache service, command for stop is:
service httpd stop
Start again apache service:
service httpd start
In your AWS console, go to Instance, find public IP address, copy and open in browser. You should see the WordPress page. You can install WordPress in Advanced part (bootstraping), when you create EC2 instance.