2

I am trying to install Php7.3 on Ubuntu 18.4, I am using Apache Server(2.4). My php.ini file is not getting setup at location /etc/php/7.3/apache2/php.ini. I followed the php.ini does not exist but it didn't work for me.

I installed it using the below-mentioned command
Sudo apt-get install php7.3.

I even tried reinstalling the php.
sudo apt-get remove –purge php*
sudo apt-get purge php*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-php sudo apt-get dist-upgrade

sudo apt-get install php7.3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:libapache2-mod-php7.3 libpcre2-8-0 php-common php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-readline
Suggested packages:
  php-pear
The following NEW packages will be installed:
  libapache2-mod-php7.3 libpcre2-8-0 php-common php7.3 php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-readline
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/4,131 kB of archives.
After this operation, 17.8 MB of additional disk space will be used.
N: Ignoring file 'google-chrome' in directory '/etc/apt/sources.list.d/' as it has no filename extension
Do you want to continue? [Y/n] Y
N: Ignoring file 'google-chrome' in directory '/etc/apt/sources.list.d/' as it has no filename extension
(Reading database ... 176461 files and directories currently installed.)
Preparing to unpack .../0-php-common_2%3a76+ubuntu18.04.1+deb.sury.org+9_all.deb ...
Unpacking php-common (2:76+ubuntu18.04.1+deb.sury.org+9) ...
Preparing to unpack .../1-php7.3-common_7.3.22-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-common (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Preparing to unpack .../2-php7.3-json_7.3.22-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-json (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Preparing to unpack .../3-php7.3-opcache_7.3.22-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-opcache (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Preparing to unpack .../4-php7.3-readline_7.3.22-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-readline (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package libpcre2-8-0:amd64.
Preparing to unpack .../5-libpcre2-8-0_10.35-4+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libpcre2-8-0:amd64 (10.35-4+ubuntu18.04.1+deb.sury.org+1) ...
Preparing to unpack .../6-php7.3-cli_7.3.22-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-cli (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Preparing to unpack .../7-libapache2-mod-php7.3_7.3.22-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libapache2-mod-php7.3 (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.3.
Preparing to unpack .../8-php7.3_7.3.22-1+ubuntu18.04.1+deb.sury.org+1_all.deb ...
Unpacking php7.3 (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Setting up php-common (2:76+ubuntu18.04.1+deb.sury.org+9) ...
Setting up libpcre2-8-0:amd64 (10.35-4+ubuntu18.04.1+deb.sury.org+1) ...
Setting up php7.3-common (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Not replacing deleted config file /etc/php/7.3/mods-available/calendar.ini
WARNING: Module calendar ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module calendar ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/ctype.ini
WARNING: Module ctype ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module ctype ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/exif.ini
WARNING: Module exif ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module exif ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/fileinfo.ini
WARNING: Module fileinfo ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module fileinfo ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/ftp.ini
WARNING: Module ftp ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module ftp ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/gettext.ini
WARNING: Module gettext ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module gettext ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/iconv.ini
WARNING: Module iconv ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module iconv ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/pdo.ini
WARNING: Module pdo ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module pdo ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/phar.ini
WARNING: Module phar ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module phar ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/posix.ini
WARNING: Module posix ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module posix ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/shmop.ini
WARNING: Module shmop ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module shmop ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/sockets.ini
WARNING: Module sockets ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module sockets ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/sysvmsg.ini
WARNING: Module sysvmsg ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module sysvmsg ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/sysvsem.ini
WARNING: Module sysvsem ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module sysvsem ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/sysvshm.ini
WARNING: Module sysvshm ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module sysvshm ini file doesn't exist under /etc/php/7.3/mods-available
Not replacing deleted config file /etc/php/7.3/mods-available/tokenizer.ini
WARNING: Module tokenizer ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module tokenizer ini file doesn't exist under /etc/php/7.3/mods-available
Setting up php7.3-opcache (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Not replacing deleted config file /etc/php/7.3/mods-available/opcache.ini
WARNING: Module opcache ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module opcache ini file doesn't exist under /etc/php/7.3/mods-available
Setting up php7.3-readline (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Not replacing deleted config file /etc/php/7.3/mods-available/readline.ini
WARNING: Module readline ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module readline ini file doesn't exist under /etc/php/7.3/mods-available
Setting up php7.3-json (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Not replacing deleted config file /etc/php/7.3/mods-available/json.ini
WARNING: Module json ini file doesn't exist under /etc/php/7.3/mods-available
WARNING: Module json ini file doesn't exist under /etc/php/7.3/mods-available
Setting up php7.3-cli (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
update-alternatives: using /usr/bin/php7.3 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar7.3 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar7.3 to provide /usr/bin/phar.phar (phar.phar) in auto mode
Not replacing deleted config file /etc/php/7.3/cli/php.ini
Setting up libapache2-mod-php7.3 (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Not replacing deleted config file /etc/php/7.3/apache2/php.ini
apache2_invoke: Enable module php7.3
Setting up php7.3 (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.2) ...
Processing triggers for php7.3-cli (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...
Processing triggers for libapache2-mod-php7.3 (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ...

2 Answers 2

1

Ubuntu 18.04 comes with PHP 7.2, so your version 7.3 comes from an additional PPA, in your log it states you are using the sury.org version.

libapache2-mod-php7.3 is the package that links PHP and Apache, if both are installed you get it automatically. But you can uninstall and purge it independently from ubuntu, so it forgets the state in which it was installed. The point is that APT tries to not mess with what a user does, which is sometime great and sometimes annoying

apt remove libapache2-mod-php7.3
apt purge libapache2-mod-php7.3
apt install libapache2-mod-php7.3

You can probably combine these steps into a single command, but I prefer atomic operations so I can understand each state. You should now see a line stating

Creating config file /etc/php/7.3/apache2/php.ini with new version

Ubuntu 20.04 is a newer LTS version, that comes by default with PHP 7.4. The dist-upgrade command used to upgrade versions, but I don't think that is true anymore. And apt-get has been replaced by just apt

2
  • It's not working, getting this output Unpacking libapache2-mod-php7.3 (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ... Setting up libapache2-mod-php7.3 (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ... Not replacing deleted config file /etc/php/7.3/apache2/php.ini apache2_invoke: Enable module php7.3 Setting up php7.3-fpm (7.3.22-1+ubuntu18.04.1+deb.sury.org+1) ... Not replacing deleted config file /etc/php/7.3/fpm/php.ini NOTICE: Not enabling PHP 7.3 FPM by default. NOTICE: To enable PHP 7.3 FPM in Apache2 do: NOTICE: a2enmod proxy_fcgi setenvif NOTICE: a2enconf php7.3-fpm Oct 6, 2020 at 13:47
  • by mistake, i removed the 7.2 version too Oct 6, 2020 at 13:48
0

(Duplicate of my other answer: https://askubuntu.com/a/1364688/720219)

Purging the package is not enough: ucf (update configuration files) protects the files. One way to avoid this is to force ucf default action. I didn't had much luck with confmiss in dpkg options, so I've read the ucf documentation.

  1. override the default ucf action, to create configuration if it doesn't already exists:
export UCF_FORCE_CONFFMISS=1
  1. purge the package:
apt-get purge libapache2-mod-php7.3
  1. reinstall the package:
apt-get install libapache2-mod-php7.3
  1. set back the ucf default action:
export UCF_FORCE_CONFFMISS=

Note that for PHP packages, you have 2 packages: one with the version (php7.3-zip), one that doesn't (php-zip). You should install the one without the version (php-zip) for easier future upgrades. But if you need to replace the configuration files (as for the main question asked here), you should purge both packages, then install only the one without version.

Side note: you can use UCF_FORCE_CONFFNEW=1 to erase your configuration files, but use with caution.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .