PHP 8.1 won't engage - php

I'm on Ubuntu 22.10 and I've done a standard apache and php install with
> sudo apt install apache2
and the default page appears at 127.0.0.1 on a browser. It works! Then I installed mySQL and starting it works
> sudo mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 8.0.31-0ubuntu2 (Ubuntu)
...
then
> sudo apt install php libapache2-mod-php php-mysql
> php -v
PHP 8.1.7-1ubuntu3.1 (cli) (built: Nov 2 2022 13:39:03) (NTS)
...
Now, I create an info.php
<?php
phpinfo();
?>
in /var/www/html/ and try to see it in my browser at 127.0.0.1/info.php and all I get back is the text itself
Obviously php is not engaging. Any ideas what I'm doing wrong?

Just found this post (ERROR: Module php7.0 does not exist!) and it works for 8.1. I followed the first, most popular answer (many others were similar) and restarted apache. Success.

Related

Ubuntu Update PHP Version to 7.4 not recognized in php -v

Base System: Ubuntu16.4; Bundled with a bitnami Wordpress installation
Goal:
Properly install PHP7.4
Status
Behaviour of the system after apt-get install php7.4:
find / -name php7* => all Files I find are 7.4-related (their name includes php7.4)
sudo a2enmod php7* => reports errors for any version except for php7.4
sudo /usr/bin/php7.4 -v => PHP 7.0.30 (cli) (built: May 11 2018 16:56:24) ( ...
BUT
php -v => PHP 7.0.30 (cli) (built: May 11 2018 16:56:24)...
Wordpress-Plugin to display version => Running PHP version: 7.0.30
How is this even possible? O_o
Bitnami Engineer here,
We do not provide WordPress deployments with PHP 7.4 but you can follow these steps to achieve it:
Launch a new instance in LightSail with LAMP 7.3 (do not worry, we will remove its content and install LAMP 7.4). Please note that you will install a Bitnami stack so the 512MB or 1GB of RAM instance types will probably have problems during the installation.
Install LAMP 7.4 in your instance (this will remove the LAMP 7.3 data as well)
cd /tmp
sudo /opt/bitnami/ctlscript.sh stop
sudo rm -rf /opt/bitnami
wget "https://downloads.bitnami.com/files/stacks/lampstack/7.4.7-0/bitnami-lampstack-7.4.7-0-linux-x64-installer.run
chmod +x ./bitnami-lampstack-7.4.7-0-linux-x64-installer.run
sudo ./bitnami-lampstack-7.4.7-0-linux-x64-installer.run --prefix /opt/bitnami
Deploy WordPress following the steps explained in this other Stack Overflow post
and then migrate the data from one installation to the other one using the All in One WordPress Migration plugin.
Once you confirm everything works as expected, you can stop your previous instance of WordPress.
Happy to help!

php version showing different in application/browser

I have installed ubuntu/trusty64 using vagrant on my windows pc. I have installed all the required package for php development environment.
Now problem is while I check php version on browser it's showing different from terminal.
From application browser showing :
PHP Version 5.5.9-1ubuntu4.20
Terminal showing:
PHP 5.6.27-1+deb.sury.org~trusty+1 (cli)
Why different version showing on my application?
Please let me know how can I sync up application with php 5.6.27 ?
//php 7.0 to php 7.2 switcher
sudo a2dismod php7.0
sudo a2enmod php7.2
sudo systemctl restart apache2
sudo ln -sfn /usr/bin/php7.2 /etc/alternatives/php
If I understood your question correctly, then the difference between your terminal and the application is the PHP source that they are getting the information from. If you had installed PHP apart from your application, that's why is showing different versions.
To change this (for example that you want to have only the PHP that your terminal is displaying:PHP 5.6.27-1+deb.sury.org~trusty+1 (cli), then change the pointer from your application to point to the directory where PHP 5.6 is installed (For Ubuntu: /usr/share/php5).

Moodle gives "Session handler is misconfigured" error after migration

I migrated a website that uses moodle. Now I get this error: "Session handler is misconfigured".
I've checked the server for logs, but I couldn't find anything and I've checked all files permission:
php -v
PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57)
mysql -V
mysql Ver 14.14 Distrib 5.5.49, for debian-linux-gnu (x86_64) using readline 6.3
Any ideea how to solve this kind of issues?
Probably missing memcache module, memcache was the most used cache engine.
Simply (in ubuntu) install in this way:
sudo apt-get install php5-memcached memcached
You also have to start memcached and restart apache2 in this way:
service memcached start
service apache2 restart

Mcrypt with Mamp Pro on Mac OS X Yosemite 10.10

After the Yosemite update yesterday, something is messed up with the Mcrypt extension.
The PHP based artistan CLI of the Laravel framework returns:
Mcrypt PHP extension required.
The PATH variable seems to be correct. Where is the misconfig? Before the update everything worked fine.
++++ Configs ++++
Output of 'which php':
/Applications/MAMP/bin/php/php5.6.1/bin/php
'php -v':
PHP 5.6.1 (cli) (built: Oct 13 2014 18:41:35) Copyright (c) 1997-2014
The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend
Technologies
Content of .bash_profile:
export EDITOR=nano export
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/usr/local/mysql/bin
export PATH=/Applications/MAMP/bin/php/php5.6.1/bin:$PATH
phpinfo():
MAMP PRO Version:
3.0.7.1
UPDATE:
Mamp-log says for every extension enabled in php.ini:
PHP Warning: PHP Startup: Unable to load dynamic library
'/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so'
- dlopen(/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so,
9): image not found in Unknown on line 0
I've contacted MAMP support, and this is what they responded.
Hi,
Our php.ini file is messed up for 5.6.1. Go to your template files and change this line
/Applications/MAMP/bin/php/php5.6.1 ....
to
/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20131226
We will have a full fix in a few days. You can also just downgrade to php 5.5. in the meantime.
I just had the same problem.
Just use PHP Version 5.5.17 in MAMP and everything should work fine again.
Remember to switch the version in your .bash_profile too:
export PATH=/Applications/MAMP/bin/php/php5.5.17/bin:$PATH
The hotfix was applied this morning MAMP & MAMP PRO 3.0.7.2 Published: 2014-10-21.
Default php 5.6.2
Don't forget to update .bash_profile
export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH
Everything works fine on my local and it also works fine with drush (for those that use it)
the same error with you, but I perfect sloved it now:
Stop your MAMP
Open /Applications/MAMP/bin/php/php5.6.1/conf/php.ini
Find all "no-debug-non-zts-20121212" replace by "no-debug-non-zts-20131226"
Open /Applications/MAMP/bin/php/php5.6.1/conf/pear.conf
Find "no-debug-non-zts-20100525" replace by "no-debug-non-zts-20131226"
Start your server
I recommend you unistall OS X's default php and apache
Path:
/etc/apache2
/usr/include/apahce2
/usr/libexec/apache2
/usr/php
/usr/bin/php
/usr/bin/php-config
/usr/bin/phpize
/usr/include/php
/usr/lib/php
/usr/share/man/man*/php*
/usr/bin/phar.phar
then
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/pear /usr/bin/pear
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/peardev /usr/bin/peardev
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/pecl /usr/bin/pecl
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/phar.phar /usr/bin/phar.phar
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/php /usr/bin/php
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/php-cgi /usr/bin/php-cgi
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/php-config /usr/bin/php-config
sudo ln -s /Applications/MAMP/bin/php/php5.6.1/bin/phpize /usr/bin/phpize
1) First check what php.ini file is loaded:
php --ini
You will probably see that none of the files have been loaded.
2) If you don't mind reinstalling php you can do this:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
3) Then set the path to your new php installation in order to avoid using the native php that comes with OSX.
In order to set the path use this command - something like this, bear in mind that your path could be different:
export PATH=/usr/local/php5/bin:$PATH

pdo_oci 64bit fedora 17 - cannot find include dir

I am on a 64bit Fedora 17 box, PHP5.4.8. I have Oracle Instant Client 11.2 installed. I am trying to install the pdo_oci package and I'm running into some issues.
I have the latest PDO_OCI package. I unpacked it and executed the following:
~$ > cd ../PDO_OCI-1.0
~$ > phpize
~$ > ./configure --with-pdo-oci=instantclient,/usr/lib/oracle/11.2/client64/lib
I get the error message:
"I'm too dumb to figure out where the include dir is in your instant client install"
As suggested by the pdo_oci manual in php.net, I created couple of paths with the minor version of the OIC as such
ln -s /usr/bin/include/oracle/11.2 /usr/include/oracle/11.2.0.1
Still I get the same error message. Does anybody have any idea?
The machine I'm running this on is not connected to the internet, so I have to run the installation using the previously downloaded packages.
I was running into the same problem. I an running centos 6.5 64bits, but fedora is a lot similar.
Supposing you already installed both basic and devel packages:
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.i386.rpm
You should specify just the "/usr" directory, as the configure looks for oci.h in this way in configure:
$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h
so, after editing config.m4 to be able to do a 11.2 install (reference for the url in the end), do this:
./configure --with-pdo-oci=instantclient,/usr,11.2
I followed this tutorial:
http://shiki.me/blog/installing-pdo_oci-and-oci8-php-extensions-on-centos-6-4-64bit/

Categories