PHP version is wrong in phpinfo() output - php

I run my web application in nginx server with php-fpm version on debian wheezy, inside a docker container.
I update my php version to 5.6.1.
RUN echo "deb http://packages.dotdeb.org wheezy all" >> /etc/apt/sources.list
RUN echo "deb-src http://packages.dotdeb.org wheezy all" >> /etc/apt/sources.list
RUN echo "deb http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list
RUN echo "deb-src http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list
RUN wget http://www.dotdeb.org/dotdeb.gpg
RUN apt-key add dotdeb.gpg
RUN apt-get update
RUN apt-get install -y nginx php5-fpm php5-mysqlnd php5-cli supervisor
If I do the following commands inside my container, version is ok and seems correctly updated:
php -v // 5.6.6
/usr/sbin/php5-fpm -v // 5.6.6
But if I go to my document root and do phpinfo(), the php version is wrong in Core -> PHP version (5.4.36, the default one with debian:wheezy). More nginx version output is wrong too.
Any ideas ?

Run the following command.
If apache
sudo service apache2 restart
If nginx
sudo service nginx restart
After you install any server modules, it is a good habit that you restart your apache,nginx.

All right, it was a "docker-compose" misunderstanding.
I needed to do a docker-compose up -d to rebuild, recreate and restart my services.

Related

(RockyLinux+PHP+Apache) Getting 503 Service Unavailable Error

I hope everyone is doing well.
I have created a Rocky Linux container that includes PHP and Apache. I run the image with :8080 port open. Whenever I try to reach the web server from a web browser by going into localhost:8080 I get 503 Service Unavailable - The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. error. I couldn't figure what to do next. How can I solve this issue? Thanks!
This is my Dockerfile:
RUN dnf update -y
RUN dnf install httpd -y
RUN dnf install php -y
RUN dnf install procps -y
RUN dnf install net-tools -y
RUN dnf install findutils -y
RUN dnf install vim -y
RUN dnf install git -y
RUN mkdir /run/php-fpm
ADD index.php /var/www/html/
CMD apachectl -D FOREGROUND```
"On RHEL 8/Rocky Linux 8, [mod_php] has been Deprecated and PHP-FPM (FPM : FastCGI Process Manager) is configured by default."
Check to see if the php-fpm service is running. If its not by default (which it most likely is not) you can modify the Dockerfile to also start php-fpm
In your Dockerfile try something like:
CMD php-fpm -D; /usr/sbin/httpd -D FOREGROUND

How do I upgrade from PHP 7.0 to 7.3 on google cloud platform?

I am running the Wordpress multisite click to deploy on the compute engine.
Operating system
Debian 9.8
Package contents
Apache 2.4.25
Google-Fluentd 1.6.9
MySQL-Client 5.7.26
MySQL-Server 5.7.26
PHP 7.0.33
Stackdriver-Agent 5.5.2
WP-CLI 2.2.0
WordPress 5.1.1
phpMyAdmin 4.6.6
I would like to upgrade PHP to 7.3
You can use a third-party repository to install php7.3
apt-get install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
apt-get update
apt-get install php7.3
You may follow this instructions on how to update your php version from 7.0 to 7.3.
For Debian:
$ sudo apt install apt-transport-https lsb-release
$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg # Download the signing key
$ sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' # Add Ondrej's repo to sources list.
$ sudo apt update
$ sudo apt-get install php7.3
To check the current version after the installation:
$ php -v
For Ubuntu:
$ sudo add-apt-repository ppa:ondrej/php # Press enter to confirm.
$ sudo apt-get update
$ sudo apt-get install php7.3
If you encounter the error below during installation, you may execute the command "$ sudo rm /var/lib/dpkg/lock" then try installing the php7.3 again.
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
Hope this information helps.
After updating your php version, the other thing you should do is:
update MYSQL and get WordPress to to recognize the new version
sudo apt-get update
sudo apt-get install php7.3-mysql
sudo a2enmod php7.3
sudo a2dismod php7.0
sudo systemctl restart apache2
This comprehensive instruction works just fine https://www.jiyuulife.net/update-php-version-for-wordpress-on-debian-9/
In the commands, replace the instruction's PHP version (7.4.5) with the latest release (7.4.11 as of October 2020).
In my case, after the update WordPress alerted me about missing (PHP) extensions that some plugins needed. I added them separately as per the instruction, restarted Apache and everything panned out perfectly fine.
Magic!
Thanks Tang for the great instruction.

How to install php musesum version with apache and mysql

I'm having trouble with installing old php 5.3.29 on ubuntu 16.04
Recently I found this useful source on how to install old unsupported php versions which are available only in php museum
sudo apt-get install apache2
sudo apt-get install make
# php museum version installation
sudo apt-get update
sudo apt-get install gcc libmysqlclient-dev libxml2-dev
wget --trust-server-names http://museum.php.net/php5/php-5.3.29.tar.bz2
tar xjf php-5.3.29.tar.bz2
cd php-5.3.29
./configure --prefix=$PWD/installdir --enable-bcmath --with-mysql
sudo make install
Now I need to connect apache2 and php 5.3.29 but how ?? (how to configure Apache to use php from custom directory)
All the articles I found talk about how to switch php version use update-alternatives --config php. That command ignores my php5.3 installed in the custom folder by make command.
I even tried to symlink php executable file to /usr/bin
ln -s /home/ubuntu/php-5.3.29/installdir/bin/php /usr/bin/php5.3.29
and again no luck with update-alternatives command run
Hmm found another way (adding ppa repo) solution for this issue here:
https://everton.rocks/conteudo/multiple-php-versions-apache
# add this 2 lines to /etc/apt/sources.list
deb http://ppa.launchpad.net/sergey-dryabzhinsky/php53/ubuntu xenial main
deb-src http://ppa.launchpad.net/sergey-dryabzhinsky/php53/ubuntu xenial main
sudo apt update
sudo apt install php53-apache2
sudo a2dismod php7.0
sudo a2enmod php53
sudo service apache2 restart

/usr/bin/env: �php\r’: No such file or directory

I have a problem during Propel ORM configuration.
I prepared environment on my Vagrant with PHP 7.1 following this provision file:
# Install software
add-apt-repository ppa:ondrej/php
apt update
apt install python-software-properties
apt update
apt install -y apache2
apt install -y php
apt install -y php-mcrypt
apt install -y php-mysql
apt install -y php-curl
apt install -y php-cli
apt install -y php-xml
apt install -y libapache2-mod-php
apt install -y mc
# install composer, configure Apache and create database
service apache2 restart
/etc/init.d/mysql restart
Currently I want to install Propel ORM. I added Propel to composer, installed, and now I type (by SSH in Vagrant)
/var/www/application/Vendors/bin/propel init but unfortunately I get error:
/usr/bin/env: �php\r’: No such file or directory
What can I do to resolve it?
EDIT:
File that I run (not edited, installed via Composer):
#!/usr/bin/env sh
dir=$(d=${0%[/\\]*}; cd "$d"; cd "../propel/propel/bin" && pwd)
# See if we are running in Cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
# Cygwin paths start with /cygdrive/ which will break windows PHP,
# so we need to translate the dir path to windows format. However
# we could be using cygwin PHP which does not require this, so we
# test if the path to PHP starts with /cygdrive/ rather than /usr/bin
if [[ $(which php) == /cygdrive/* ]]; then
dir=$(cygpath -m "$dir");
fi
fi
dir=$(echo $dir | sed 's/ /\ /g')
"${dir}/propel" "$#"
I don't use propel but had the same problem with phpunit.
The problem is often that the vendor/propel/propel/bin/propel, or in my case the vendor/phpunit/phpunit/phpunit file you try to execute is Windows encoded and not Unix encoded. It happens when you do composer install/update on Windows but run your code in a vagrant box.
You have multiple ways of getting rid of the CRLF:
dos2unix command (sudo apt-get install dos2unix)
use your prefered text editor (Sublime, PHPStorm, they can both do that)
get rid of vendor and run composer install/update from your vagrant box
Remember that the problem is not the vendor/bin/propel file but the vendor/propel/propel/bin/propel file.
Hope this help!

Run yii project using hhvm

How can I start Yii2 project using HHVM?
Run
hhvm yii serve
but I got the following error:
Server started on http://localhost:8080/
Document root is "/home/hgminh95/Documents/pk-homepage-server/web"
Quit the server with CTRL-C or COMMAND-C.
Error in command line: unrecognised option '-S'
Usage:
/usr/bin/hhvm [-m <mode>] [<options>] [<arg1>] [<arg2>] ...
HHVM is linux only. It doesn't have anything for Windows and for MacOS it works in limited mode without JIT compiler.
Check this
https://yii2-cookbook.readthedocs.io/performance-hhvm/
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
echo deb http://dl.hhvm.com/debian wheezy main | sudo tee /etc/apt/sources.list.d/hhvm.list
sudo apt-get update
sudo apt-get install hhvm

Categories