PHP files not running in firefox - php

Firefox only asks me to download the file's source. View-source shows me source code.
a2enmod php7.0
Considering conflict php5 for php7.0:
Module php7.0 already enabled
php -v
PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.8-0ubuntu0.16.04.2, Copyright (c) 1999-2016, by Zend Technologies

I recommend a full installation in case you intend to develop something.
Example: Ubuntu 16.04.1 LTS (xenial)
sudo apt-get install php7.0 php7.0-cli php7.0-common php7.0-odbc php7.0-pgsql php7.0-sqlite3 php7.0-mysql php7.0-fpm php7.0-curl php7.0-intl php7.0-gd php7.0-mysql php7.0-bz2 php7.0-zip php7.0-gmp php7.0-json php7.0-xsl php7.0-tidy php7.0-xmlrp php7.0-readline php7.0-mbstring php7.0-mcrypt php7.0-recode php7.0-pspell php7.0-dev php-gettext libapache2-mod-php7.0

Related

Error : When i try to install php 7 version on centos 7 but Package comes Php 5 version

When I try to install the PHP 7 version on my centos 7 but the Package comes from Php 5 version so I decided to change the repo rebel to Remi and disable the rebel after I got the below error
I started a Docker container using centos:7 and I ran the following commands:
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum-config-manager --disable 'remi-php*'
yum-config-manager --enable remi-php74
yum -y update
yum -y install php
yum -y install php-fpm php-gd php-json php-mbstring php-mysqlnd php-xml php-xmlrpc php-opcache
Now let's see the phpversion.
sh-4.2# php -v
PHP 7.4.27 (cli) (built: Dec 14 2021 17:17:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.27, Copyright (c), by Zend Technologies
sh-4.2# php-fpm -v
PHP 7.4.27 (fpm-fcgi) (built: Dec 14 2021 17:17:06)
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.27, Copyright (c), by Zend Technologies

How to install PHP 7.1 yaml extension and not 7.2 on Ubuntu 16.04

I'm trying to install the yaml extension on Ubuntu.
I have PHP 7.1 on my server.
ubuntu#www1:~$ php -v
PHP 7.1.15-1+ubuntu14.04.1+deb.sury.org+2 (cli) (built: Mar 6 2018 11:27:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.15-1+ubuntu14.04.1+deb.sury.org+2, Copyright
(c) 1999-2018, by Zend Technologies
I was following another SO post that said to run
sudo apt install libyaml-dev php-dev php-pear
When I do that, the installer says, in part:
The following extra packages will be installed:
dh-php php7.2-cli php7.2-common php7.2-dev php7.2-json php7.2-opcache
php7.2-readline pkg-php-tools xml2
Suggested packages:
dh-make
The following NEW packages will be installed:
dh-php php-dev php7.2-cli php7.2-common php7.2-dev php7.2-json
php7.2-opcache php7.2-readline pkg-php-tools xml2
0 upgraded, 10 newly installed, 0 to remove and 85 not upgraded.
Need to get 3,073 kB of archives.
After this operation, 18.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
So, why would the installer install PHP 7.2 extensions on a PHP 7.1 server?
I aborted the install and came here to ask:
How do I force my server to stay at PHP 7.1 and install the yaml extension?
Have you tried
sudo apt-get install -y php7.1-yaml

Install php5.6 curl

I installed on Ubuntu 16.10 the co-existing php packages as outlined in https://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04
I've run apt-get update and apt-get upgrade. When I try to install php-curl I get an error message:
randall#randall-VirtualBox3:/$ sudo apt-get install php5.6-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5.6-curl
E: Couldn't find any package by glob 'php5.6-curl'
E: Couldn't find any package by regex 'php5.6-curl'
randall#randall-VirtualBox3:/$ php -v
PHP 5.6.30-12~ubuntu16.10.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
with Xdebug v2.5.4, Copyright (c) 2002-2017, by Derick Rethans
randall#randall-VirtualBox3:/$
How do I fix?
To install php5.6-curl or anything, when you ran into trouble
first search your system to ensure that you have it in there.
apt-cache search php | grep -i curl
Result
php5-curl - CURL module for php5
Now use:
apt-get install php5-curl -y
NJOY
u can fix by following steps:-
sudo apt-get install curl
sudo apt-get install php5.6-curl

How to install xdebug in ubuntu 16.04 in netbeans?

Whenever I try to run this code
example#testserver:~$ sudo apt-get install php5-xdebug
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-xdebug
I get this error "E: Unable to locate package php5-xdebug"
Please help
Thanks
If you're running the default apt installation of PHP on Ubuntu 16.04, then it should be PHP7. If I had to guess from php5-xdebug, then I'd say you were using a command intended for Ubuntu 14.04 or older where the default PHP installation was PHP5. You can verify your PHP version with:
php --version
This is what I see:
PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.8-0ubuntu0.16.04.2, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
At any rate, you should be able to search available packages for your configuration with:
apt search xdebug
From my relatively fresh Ubuntu 16.04 install without any added PPA's, I get one result:
php-xdebug - Xdebug Module for PHP
So you can install this package by name (note the missing "5" from your command):
sudo apt install php-xdebug
You might also have to restart your webserver. If you're running the stock build of Apache for Ubuntu 16.04:
sudo service apache2 restart

PHP 5.3 seems to be missing Intl extension by default

My system is Ubuntu 12.04, PHP 5.3, and I'm trying to run some basic Intl code like this:
<?php
$coll = collator_create('en_US');
$result = collator_compare($coll, "string#1", "string#2");
and it outputs
PHP Fatal error: Call to undefined function collator_create()
Wasn't Intl extension supposed to be bundled with PHP since version 5.3?
PHP was installed via apt-get with this command line (I don't use Apache):
apt-get install php5 php5-cli php5-mysql php5-cgi php5-fpm php5-curl php-apc php5-memcache php5-memcached php5-common php5-gd php-xml-parser php-pear php5-imap php5-mcrypt php5-xdebug php5-suhosin
And here is what php -v produces:
PHP 5.3.10-1ubuntu3.5 with Suhosin-Patch (cli) (built: Jan 18 2013 23:40:19)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH
You have specify --enable-intl when installing to use the bundled version of intl, or you can install it via PECL. See: http://www.php.net/manual/en/intl.installation.php
apt-get install php5-intl will also work.
Add php5-intl to the list of things you install.
It looks like it's just not part of the core PHP5 release, even though it is an option to be included, similar to how php-apc is now a standard part of PHP, though you have to explicitly install it.
Try in php.ini uncomment extension intl "extension = php_intl.dll", should be removed ";" before "extension", and then restart the server.

Categories