PHP 8.1 Redis session handler issue - redis

Warning: ini_set(): Session save handler "redis" cannot be found on my page where I have use the code as shown below
ini_set('session.save_handler', 'redis');
This code works fine if the PHP version is 7.4 but when I upgraded PHP to PHP8 or PHP8.1 it stops working and gives me a warning "Warning: ini_set(): Session save handler "redis" cannot be found"
Also when I run the phpinfo() I do not find any PHP extension for Redis which is visible in case of PHP7.4

It looks like redis extension isn't available at your php modules. Check by using this command:
php -m | grep redis
So if it's empty, you need to install and configure it properly:
Visit this link to check how to install php redis extension.
Open your php.ini file (php --ini to check location)
Check for extension_dir property and make sure it points to correct extensions directory.
Add this code below - extension=redis.so
Restart your PHP-FPM service
Now try it once more:
php -m | grep redis
Should return redis now. Now ini_set command should work!

Related

Using "Remote SSH" in VSCode on a target machine that only allows inbound SSH connections

Is there a way to use the VSCode Remote SSH extension to interact with a remote host that does not allow outbound internet connections?
Is it possible to download the vscode-server files from another system and copy to host?
I read this but I can't connect the server to internet.
When you connect to a host it executes a bash script that wgets or curls a tarball and extracts it in a directory in your home directory. Here's an offline workaround.
Attempt to connect, let it fail
On server, get the commit id
$ ls ~/.vscode-server/bin
553cfb2c2205db5f15f3ee8395bbd5cf066d357d
Download tarball replacing $COMMIT_ID with the the commit number from the previous step
For Stable Version
https://update.code.visualstudio.com/commit:$COMMIT_ID/server-linux-x64/stable
For Insider Version
https://update.code.visualstudio.com/commit:$COMMIT_ID/server-linux-x64/insider
Move tarball to ~/.vscode-server/bin/$COMMIT_ID/vscode-server-linux-x64.tar.gz
Extract tarball in this directory
$ cd ~/.vscode-server/bin/$COMMIT_ID
$ tar -xvzf vscode-server-linux-x64.tar.gz --strip-components 1
Connect again
You'll still need to install any extensions manually. There's a download button next to all the extensions in the marketplace. Once you have the .vsix file you can install them through the GUI with the Install from VSIX option in the extensions manager.
This is kind of a pain and hopefully they improve this process, but if you have a network-based home directory, you only have to do this once.
open vscode -> about
Version: 1.46.1
Commit: cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
Date: 2020-06-17T21:17:14.222Z
Electron: 7.3.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 17.7.0
$COMMIT_ID = cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
A new feature is being added to support offline install
However, you can now solve this issue by a new user setting in the Remote - SSH extension. If you enable the setting remote.SSH.allowLocalServerDownload, the extension will install the VS Code Server on the client first and then copy it over to the server via SCP.
Note: This is currently an experimental feature but will be turned on by default in the next release
https://code.visualstudio.com/blogs/2019/10/03/remote-ssh-tips-and-tricks
A a work around I have done the following:
Desktop ~/.ssh/config
...
Host *
RemoteForward 54321
...
Remote: ~/bin/wget in which ~/bin is added to PATH via .bashrc
#!/bin/bash
export LD_LIBRARY_PATH=$HOME/opt/lib/tsocks/
export TSOCKS_CONF_FILE=$HOME/opt/tsocks/tsocks.conf
$HOME/bin/tsocks /usr/bin/wget $#
Remote: ~/opt/tsocks/tsocks.conf
server = 127.0.0.1
server_port = 54321
server_type = 5
note tsocks binary has been scp-ed to ~/bin/tsocks and ~/opt/tsocks/ has been created with libtsocks.so which is normally stored in /usr/lib64/libtsocks.so
This is a work around that allows me to have wget functionality with out messing with anything outside my profile to get it to work (eg: no root required ... even though I have it).
Current Version of VS Code: 1.48.2
I just kill the wget process on the server end, and let the client download the archive and transfer it to the server end. That's quite easy as below.
make sure that you set in settings.json
"remote.SSH.allowLocalServerDownload": true,
execute the shell scrpits below.
# to find the <pid>
ps aux | grep wget | grep vscode-server
# kill the process
kill -9 <pid>
# then wait for the client downloading and transferring
# optional: If you want to know the progress, just
cd ~/.vscode-server/bin/<commit-id>/
watch -n 1 -d ls -rthl

phpmyAdmin admin page displays only "demo server"

Linux Mint 18
Apache2 server
MYSQL Server
Hello! Does anyone have a moment to advise me?
Here's my problem in brief: I am trying to configure phpMyAdmin on a Linux Mint 18 computer, but when I try to view http://localhost/phpmyadmin/, I get a "phpMyAdmin demo server" screen.
Details:
The phpMyAdmin web page begins with an addJSON statement, and echoes this message:
'You are using the demo server. You can do anything here, but please do not change root, debian-sys-maint and pma users'
I understand I am viewing some sort of demonstration page for phpMyAdmin, but I would rather view the actual, familiar phpMyAdmin administration page.
Do I need to edit the Apache2.conf file? Or something else? Thank you very much for your time.
Eric
i had this problem with ubuntu 16.04
fix
1# Remove phpmyadmin completely
sudo apt-get remove phpmyadmin
2# Install phpmyadmin with this command
sudo apt-get install phpmyadmin apache2-utils
3# add phpmyadmin to the apache configuration
sudo nano /etc/apache2/apache2.conf
And put below line to end of the file
Include /etc/phpmyadmin/apache.conf
4# restart apache2
sudo systemctl restart apache2
or
sudo service apache2 restart
I had the same problem, but my error was because I commented the Handler in php.ini
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
I just enable php on apache and start work normal
a2enmod php7.3
I had to disable mpm_event because it was causing some comflict
a2dismod mpm_event
Perhaps PHP code is not being executed, instead code shows on the page or Apache shows php code instead of executing may help.
Linux Mint is similar to Ubuntu/Debian, so you need the libapache2-mod-php5 package installed (assuming you've used the package manager to install the rest of your PHP/Apache stack): sudo apt-get install php5 libapache2-mod-php5.
You can test this further by adding a file (called test.php or phpinfo.php or whatever else suits you) in the main phpMyAdmin folder with the content <?php phpinfo(); ?> -- then try to load that file directly and see if you get a long list of system status or simply the contents of the file displayed. The main reason to put it in the phpMyAdmin folder is that your Apache configuration might handle different folders differently, this is the simplest way to test what happens on that particular folder.

svn post-commit Temporary failure in name resolution

First, I have svn configured to be accessible via apache DAV.
Then I have a post-commit hook that tell jenkins continuous integration server that the repository has changed via a simple wget command (and make it build) :
/opt/local/bin/wget (many-options) https://jenkins.domain.tld/subversion/${UUID}/notifyCommit?rev=$REV >> $LOGFILE
The script checks wget return code, and then echos an error message and exit with 1 (so the svn client knows the commit failed).
The LOGFILE contains after a failure :
--2012-04-04 10:56:54-- https://jenkins.domain.tld/subversion/4d729FFF-FFFF-4fb8-b8b5-be083cf6fe96/notifyCommit?rev=302
Résolution de jenkins.domain.tld (jenkins.domain.tld)... échec: Temporary failure in name resolution.
wget : impossible de résoudre l'adresse de l'hôte «jenkins.domain.tld»
The host jenkins.domain.tld has been added to /etc/hosts to be sure that resolution can't fail, but I'm still having the issue.
Of course, I have checked the post-commit command from CLI, and it works.
I've added this line to the post-commit script :
/usr/bin/host jenkins.domain.tld >> $LOGFILE
And resolution works just fine... maybe a wget issue.
Just replaced wget call with a curl equivalent, same issue :
curl: (6) Couldn't resolve host 'jenkins.domain.tld'
Ok, not found the issue origin, but a solution (pretty ugly) :
Update: I solved it meanwhile by fully stopping apache, waiting for a moment, then starting it again. But that doesn't explain the root cause for this behaviour (and thus there's no satisfying solution). So I leave this open.
From : https://serverfault.com/questions/129772/php-gethostbyname-suddenly-no-longer-resolves-names-to-ips-when-run-in-apache
After upgrading to Ubuntu 14.04 LTS I had the same issue (not sure whether the upgrade was really related). However, I could solve it by adding explicit timeout configuration to wget in my post-commit hook:
wget \
--timeout=10 \
--dns-timeout=10 \
...

install memcache onfedora linux OS

I installed memcache in the following way:
1) yum install memcached
2) yum install php-pecl-memcached
3) Also enabled the 'memcached.so' in php.ini
I tested the memcached in the follwing way:
$mc = new Memcache;
$mc->addServer('localhost', 11211);
echo "Server's version: " . $mc->getVersion() ;
But it generates the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_encode in Unknown on line 0
PHP Fatal error: Class 'Memcache' not found in /root/memcacheTest.php on line 2
Thank u.
I don't know PHP well (or at all), but from the error message I'll hazzard a guess that you do not have the PHP JSON extension installed, which is apparently needed by the memchached extension.
Apparently, the JSON extension has been in PHP since version 5.2.0, therefore:
You have an older version and you need to upgrade or install the JSON extension yourself
or
Your operating system distributor supplies the PHP JSON extension in a different package that you have not installed.
There is of course the possibility of a misconfiguration, but I think it's slightly less likely.
This showed memcached.so didn't loaded successfully.
Error shows the reason: json.so should be load before memcached.so
Please use php -m | grep memcached to check whether memcached.so is loaded successfully.
If show memcached, this mean it succeeded.
If show like PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_decode_ex in Unknown on line 0
Here is the solusion:
e.g your php.ini is /etc/php.ini, your php.d is /etc/php.d/
Solution 1
comment 'memcached.so' in php.ini
vim /etc/php.d/memcached.ini
add extension=memcached.so in /memcached.ini
php -m | grep memcached check whether memcached is succeed loaded
Solution 2
rm /etc/php.d/json.ini
add extension=json.so in php.in before extension=memcached.so
php -m | grep memcached check whether memcached is succeed loaded
Can you check and double check user permissions? Additionally, my experience with PHP is that the distribution repository versions of PHP aren't very good. I solved those symbol errors by compiling PHP from the ground up. But that's a very radical and time-consuming solution.
http://pecl.php.net/bugs/bug.php?id=17574&edit=1
Just make sure that extension=json.so is specified BEFORE
extension=memcached.so.
I had placed extension=memcached.so in php.ini, and extension=json.so
was specified in /etc/php.d/json.ini, that is parsed AFTER php.ini.
That is why PHP can't find php_json_encode() at the point of loading
memcached.so.
Also, check that the permissions on memcached.so are the same as the other extensions
Try to install the version 2.0. It helped for me.
yum -y install gcc-c++
wget http://launchpad.net/libmemcached/1.0/0.50/+download/libmemcached-0.50.tar.gz
tar xzf libmemcached-0.50.tar.gz
cd libmemcached-0.50
./configure
make
make install
wget http://pecl.php.net/get/memcached-2.0.0b2.tgz
pecl install memcached-2.0.0b2.tgz
echo 'extension=memcached.so' > /etc/php.d/memcached.ini
service php-fpm restart
cd ..
rm -r libmemcached-0.50*
rm -r memcached-

Apache doesn't start on Snow Leopard using Terminal but works using Web Sharing (System Preferences)

I am using the default Apache installation that comes with Snow Leopard and I have some things installed like MySQL, Rudix (Unix ports and packages) and Xcode.
When I type:
$ sudo apachectl start
I receive this output:
dyld: Symbol not found: _apr_dir_open$INODE64
Referenced from: /usr/local/sbin/httpd
Expected in: /usr/local/lib/libapr-1.0.dylib
in /usr/local/sbin/httpd
/usr/local/sbin/apachectl: line 78: 2023 Trace/BPT trap $HTTPD -k $ARGV
I don't know if it's related but my .bash_profile has this line (I typed it because import MySQLdb was not working in Python):
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib/:$DYLD_LIBRARY_PATH"
If I tick Web Sharing using System Preferences the Apache starts and work, but I wan't to start it using the terminal, maybe I am forgot to pass important arguments to the apachectl command.
The Web Sharing option of System Preferences enables the Apple-supplied Apache. Its apachectl is /usr/sbin/apachectl. You appear to have installed another version of Apache in /usr/local; note the /usr/local/sbin/apachectl path. So you are not using the Apple-supplied Apache installation when you are running from the terminal and the version you are using appears to not have been installed correctly. One way to ensure you are using the Apple-supplied Apache is to specify the full path:
$ sudo /usr/sbin/apachectl start