PHPMyAdmin Fatal Error - Twig_Error_Loader - php

Am using PHPMyAdmin 4.8.4, MySQL 5.7.24, PHP 7.3.0, and Apache 2.4.37. Whenever I visit http://localhost/phpmyadmin/ I receive the following error:
Fatal error: Uncaught Twig_Error_Loader: There are no registered paths for namespace "". in C:\wamp64\apps\phpmyadmin4.8.4\vendor\twig\twig\lib\Twig\Loader\Filesystem.php on line 209
This error doesn't occur when using PHP 7.2.13. I've examined the Filesystem.php and I do not see what is causing this problem with PHP 7.3.
Is their an easy way to remedy this error and have PHPMyAdmin work with PHP 7.3?

I had this same problem, try:
brew uninstall php71 //if exists another version delete all
enter brew uninstall --force php
brew upgrade
sudo brew services restart dnsmasq
uninstall valet
composer global update
composer global require laravel/valet
valet install
end install phpmyadmin if exists first uninstall:
brew install phpmyadmin
cd /usr/local/share/phpmyadmin
valet link
Your phpmyadmin start : www.phpmyadmin.test ;)
Don't run ? try:
mysql -uroot
SET PASSWORD FOR 'root'#'localhost' = PASSWORD('root');
and enjoy, code, lives :)

probably the problem is this line in your php.ini :
zend_extension = "......php\ext\php_opcache.dll"
If enabled this original extension of php 7.3.0 phpmyadmin goes on throw exception...

Related

Illuminate\Database\QueryException could not find driver Laravel

I deploy a laravel project on an apache server on a Debian 10 machine.
The database is an MySQL deployed on another debian 10 machine on the same network.
I can go to the connection interface of the application but when I connect this error appears :
Illuminate\Database\QueryException
could not find driver (SQL: select * from `users` where `email` = test#gmail.com limit 1)
I have already tried these commands :
php artisan migrate
sudo apt install php-mysql
sudo apt install php7.4-mysql
sudo systemctl restart apache2
composer require doctrine/dbal
composer update
these commands work but do not solve the problem.
and I already tried to comment and uncomment this line in the php.ini :
extension=pdo_mysql
in php-m i have
PDO and pdo-mysql
and i have restart my server with :
systemctl restart apache2
after modification
I got the same error when running my test suite. It was working before but it stopped working after I upgraded php. So I did and it worked for me.
sudo apt-get install php-sqlite3
If you have no problem using php artisan migrate, there is no problem for the command line to call the php script. If you use fpm and install a new extension, you need to restart it and try.
I finally found the solution
infact the php version used by apache was 7.3 and not 7.4 with :
<?php phpinfo() ?>
however when I did:
php --version
the version was indeed 7.4.
I followed this tutorial to change the version
https://tecadmin.net/switch-between-multiple-php-version-on-debian/?amp
and it works

Big Sur Homebrew PHP install error - missing libphp7.so?

I've recently upgraded to Big Sur (11.6.1) and after running:
php -v
It returns:
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
So I decided to install PHP 7.3 via Homebrew. Via these instructions: https://gist.github.com/karlhillx/791babda83495eab6fbf64f8a3270f86
Everything was working fine untill I run:
sudo apachectl configtest
Which returns:
Syntax error on line 182 of /usr/local/etc/httpd/httpd.conf: Can't locate API module structure `php_module' in file /usr/local/Cellar/php#7.3/7.3.33/lib/httpd/modules/libphp7.so: dlsym(0x7f9547f05530, php_module): symbol not found
Which is in my httpconf file:
LoadModule php_module /usr/local/Cellar/php#7.3/7.3.33/lib/httpd/modules/libphp7.so
If I run:
find /usr -name "libphp7.so"
It returns:
/usr/libexec/apache2/libphp7.so
find: /usr/sbin/authserver: Permission denied
find: /usr/local/mysql-8.0.21-macos10.15-x86_64/keyring: Permission denied
find: /usr/local/mysql-8.0.21-macos10.15-x86_64/data: Permission denied
/usr/local/Cellar/php#7.2/7.2.34_4.reinstall/lib/httpd/modules/libphp7.so
/usr/local/Cellar/php#7.3/7.3.33/lib/httpd/modules/libphp7.so
/usr/local/php5-7.2.21-20190811-210031/libphp7.so
So the module is there but why can't it see it? Help.....
I found the solution:
I removed the install then reinstalled
brew list | grep php
then
brew uninstall --force {the php version returned from above}
then
brew install php#7.3

PHPInfo / Valet - Two different PHP versions

OK so I am experiencing something quite odd. My phpinfo() shows one version while php -v shows another.
I am running locally on a MacBook Air (Mojave), with Laravel and Valet.
phpinfo():
PHP Version 7.2.13
Configuration File (php.ini) Path /usr/local/etc/php/7.2
Loaded Configuration File /usr/local/etc/php/7.2/php.ini
Scan this dir for additional .ini files /usr/local/etc/php/7.2/conf.d
While in my terminal, it shows:
php -v
PHP 7.3.0 (cli) (built: Dec 7 2018 11:00:11) ( NTS )
Now, if I do a which php I get this:
/usr/local/bin/php
In my ~/.bash-profile, I have this:
export "PATH=~/.composer/vendor/bin:$PATH"
I have tried to:
Restart Nginx
Restart Valet
Unlink PHP#7.2 and link PHP#7.3with Homebrew:
Olivers-MacBook-Air:~ oliverbusk$ brew unlink php#7.2
Error: No such keg: /usr/local/Cellar/php#7.2
How can I get my actual valet site to use php#7.3?
Below simple fix worked for me.
rm ~/.config/valet/valet.sock
valet restart
In my case it worked after forcing the specific PHP version:
valet use php#7.4 --force
Good news, please upgrade to latest valet version, you can easily switch php version.
Source: https://laravel.com/docs/5.8/valet
PHP Versions
Valet allows you to switch PHP versions using the valet use php#version command. Valet will install the specified PHP version via Brew if it is not already installed:
valet use php#7.2
valet use php //without any specification, it will be using latest version
Something so basic as rebooting my Macbook solved this issue. Once rebooted, the correct version 7.3 showed in my phpinfo();
From MacBook pro (Mojave), with Laravel and Valet:
valet use php#7.2
To be able to effectively change the version of php on my machine I use the following script:
Add to your user's .bash_profile
Then use the following command to switch
switch-php7.x
switch-php() {
valet stop
brew unlink php#7.2 php#7.3 php#7.4
brew link --force --overwrite php#$1
brew services restart php#$1
composer global update
rm -f ~/.config/valet/valet.sock
valet install
}
https://gist.github.com/r1tt3r/e0f199eb274d5ff186b73956af594316
I am running linux valet on Ubuntu 20.04 , The following command works for me
valet use 8.0
Here, 8.0 refers to the php version.
NB: Tested this solution on Ubuntu 20.04 Desktop
If you are using Valet Linux Plus(Has more features than Valet Linux) Just do valet use {your PHP version} --update-cli. For instance to use php8.0 just run:
valet use 8.0 --update-cli
This will update both php-fpm version plus php-cli version too.
Basically the php valet uses and the one used by your macbook is different.
But as already mentioned by #Shiro and #Israel Alexis Palma Quezada, in newer versions valet use php73 would solve your problem.
If it's not working, try running composer global update to update your global packages, thus updating valet
To update the mac php version, execute the following lines:
export PATH="your/path/to/php#7.3/bin:$PATH"
export PATH="your/path/to/php#7.3/sbin:$PATH"
or simply add these two lines to your ~/.profile or ~/.bash_profile
Don't forget to run source ~/.profile or source ~/.bash_profile or whatever file you chose to edit.
Yesterday I encountered the same problem on Ubuntu 18.
At first I changed the PHP version:
$ sudo a2dismod php7.2
$ sudo a2enmod php7.3
$ sudo update-alternatives --set php /usr/bin/7.3
But valet was still showing the wrong PHP version. Rebooting did not work. In fact, phpinfo() was displaying PHP 7.1.
After run ps -aux | grep php I noticed few instances of php-fpm (5.6, 7.1 and 7.2) running.
I stopped them
$ sudo service php5.6-fpm stop
$ sudo service php7.1-fpm stop
$ sudo service php7.2-fpm stop
Then started 7.3
$ sudo service php7.3-fpm start
And now my phpinfo() display the correct version of PHP
I ran into this same problem while using valet plus today. When I switched PHP versions it was showing the previous one in my browser but the correct one in my terminal. Looking at the my brew services list:
brew services list
It showed that one of the valet-php services (valet-php#7.2) was not in the service list but somehow my valet was able to switch to it. Valet didn't install this PHP properly and that's what was causing the issue. I did the following to uninstall that PHP and reinstall it with brew.
brew uninstall valet-php#7.2
sudo rm -rf /usr/local/Cellar/valet-php#7.2/7.2.34_1
brew install valet-php#7.2
The PHP version that was once not showing in the brew services list now showed and I was able to "stop" that php version's service:
brew services stop valet-php#7.2
which made everything work properly again without a restart.

Laravel 5.7 - Unable to run php artisan commands when shifted project to live

I'm new to laravel, My commands of PHP artisan were working fine in localhost.
When i shifted my project to live server the commands stopped working and gives me following error:
Warning: require(): Invalid date.timezone value 'GST', we selected the
timezone 'UTC' for now. (I fixed this by defining my timezone) Parse
error: syntax error, unexpected '?'
laravel/framework/src/Illuminate/Foundation/helpers.php on line 500
There are actually no errors the project is working fine,My PHP version is 7.2.10.
I'm inside the directory where PHP artisan is installed but of no use.
I hope I have to clear the cache but how can I clear cache when my artisan commands are not working?
Any ideas?
try to change version in apache
find total install version in server
sudo update-alternatives --config php
then select one version then check php version again.
sudo php -v
second way u can do by this command
sudo a2dismod php5.6 //disable old version
sudo a2enmod php7.2 //enable new version
and restart apache2 server
sudo service apache2 restart
and check php version
sudo php -v
for more better understanding see
did you install composer and packages? with composer install command on the server.
You should perform below steps.
1) First you have to check the apache is starting or not.
2) Then you have to Install the composer and command like (i.e.
composer update)
3) You have to clear cache and command like below
1) php artisan config:cache
2) php artisan view:clear
Downgraded the PHP version to 7.1 and upgraded the system to same php version.
Got some exceptions later but it resolves the issue.

Installing xdebug on MacOs Mojave - 'php.h' file not found

I try to install xdebug on MacOs Mojave but get this error
/private/tmp/pear/install/xdebug/xdebug.c:25:10: fatal error: 'php.h' file not found
Command Line Tools are installed.
I ran into this trying to compile xdebug on my system, I had to do the following to get it to work
0) Check that you have the file /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg on your system.
1) If not, install the command line tools (I had installed them at one point, but the files under /Library/Developer/CommandLineTools/ were missing so I must have deleted it...)
xcode-select --install
2) Reinstall the header files
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
Credit to #donatJ - https://stackoverflow.com/a/52612102/649915
brew doctor
and then
brew link --overwrite php
helped me.
Headers aren't installed for Mojave.
To install the headers:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
I was having the same issue and this fixed it for me.

Categories