gRPC and XAMPP not working - php

For a project I want to test the new database from Firebase, Firestore with PHP. But before i can use it, I need a couple of tools. I am trying for a day now to get it work, but no success.
I'm stuck on gRPC. I installed is, and it's working on my Mac and I can install Firestore with Composer, but I can't get it to work with XAMPP.
When I load a page I get
Fatal error: Uncaught Google\Cloud\Core\Exception\GoogleException: The requested client requires the gRPC extension.
Please see https://cloud.google.com/php/grpc for installation instructions. in /vendor/google/cloud-core/src/ClientTrait.php:75 Stack trace: #0 /vendor/google/cloud-firestore/src/FirestoreClient.php(115): Google\Cloud\Firestore\FirestoreClient->requireGrpc() #1 /app/firebase.php(18): Google\Cloud\Firestore\FirestoreClient->__construct() #2 /app/firebase.php(21): App\initialize() #3 /template.php(688): require_once('/Applications/X...') #4 /template.php(647): load_template('/Applications/X...', true) #5 /App in /vendor/google/cloud-core/src/ClientTrait.php on line 75
I added extension=grpc.so to the php.ini that is loaded by XAMPP.
But no success.

Try to use DLL file, download from here https://pecl.php.net/package/gRPC

Open your php.ini file and uncomment the line extension_dir="ext",
add extension="grpc".
Then go to the environment variables in the properties, choose path in the system variables and add the php path you are using.
I am using C:\xampp\php that's where all the magic will happen it's been a tag of war.

Related

Phalcon - Class "Phalcon\Config" not found

I've installed Phalcon and trying to create new project: phalcon project store. But instead of this I get these errors:
PHP Fatal error: Uncaught Error: Class "Phalcon\Config" not found in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php:48
Stack trace:
#0 C:\Composer\vendor\phalcon\devtools\src\Commands\Builtin\Project.php(74): Phalcon\DevTools\Builder\Component\AbstractComponent->__construct(Array)
#1 C:\Composer\vendor\phalcon\devtools\src\Script.php(109): Phalcon\DevTools\Commands\Builtin\Project->run(Array)
#2 C:\Composer\vendor\phalcon\devtools\src\Script.php(148): Phalcon\DevTools\Script->dispatch(Object(Phalcon\DevTools\Commands\Builtin\Project))
#3 C:\Composer\vendor\phalcon\devtools\phalcon(65): Phalcon\DevTools\Script->run()
#4 {main}
thrown in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php on line 48
Fatal error: Uncaught Error: Class "Phalcon\Config" not found in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php:48
Stack trace:
#0 C:\Composer\vendor\phalcon\devtools\src\Commands\Builtin\Project.php(74): Phalcon\DevTools\Builder\Component\AbstractComponent->__construct(Array)
#1 C:\Composer\vendor\phalcon\devtools\src\Script.php(109): Phalcon\DevTools\Commands\Builtin\Project->run(Array)
#2 C:\Composer\vendor\phalcon\devtools\src\Script.php(148): Phalcon\DevTools\Script->dispatch(Object(Phalcon\DevTools\Commands\Builtin\Project))
#3 C:\Composer\vendor\phalcon\devtools\phalcon(65): Phalcon\DevTools\Script->run()
#4 {main}
thrown in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php on line 48
My PHP version is 8.0.8 Thread Safe x64, I've installed PSR extension and Phalcon 5.0.0 from here: https://github.com/phalcon/cphalcon/releases/tag/v5.0.0beta3, file phalcon-php8.0-ts-windows2019-vs16-x64.zip, that means I have compatible version of framework. phalcon.bat was added to environment variables. What's the problem?
Usually this error occurs when the extension is not loaded by php, see with phpinfo(), also run the componser install insider phalcon-devtools, but probably it is the php not loading the phalcon extension or PHP is not in the windows PATH , also check if the php-fpm log does not contain any extension loading errors, test in cmd the command php -v
also create a index.php and try it
<?php
use Phalcon\Mvc\Micro;
$app = new Micro();
$app->get('/', function () { echo "<h1>test</h1>";});
$app->handle();
Try do the following Go to Edit The system environment variables -> system variables -> path -> edit add phalcon.bat folder path testing here i used C:\Users\renato\Downloads\phalcon-devtools-4.2.0\phalcon-devtools-4.2.0 ( just path folder where the .sh/.bat it is, do not include the file and extension) and worked fine with php 8.0.16 windows 10 phalcon 5
and then go to the power shell and input phalcon
https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/
Do not forget to run composer install inside phalcon devtools folder.
also on powershell input php -m to see the loaded modules and if it has an error

Wordpress executing ThreadSafe PHP with apache can not connect to mysql but IIS and NTS PHP has no problem

I developed a WordPress site for running on IIS with PHP FastCGI, that works.
I found that website is so slow, so tried to test it under Apache.
Now I have an installed WordPress site, IIS, Apache and 2 different php installation.
1 PHP is Non-Thread-Safe PHP (V7.4.9) that will be called by IIS FastCGI module and works correctly.
Another is ThreadSafe PHP (V7.4.9) that will be called from Apache and works but not for mysql.
When I execute code under Apache (localhost:81) it produces below error:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in D:\Website\wp-includes\wp-db.php:1670
Stack trace:
#0 D:\Website\wp-includes\wp-db.php(632): wpdb->db_connect()
#1 D:\Website\wp-includes\load.php(476): wpdb->__construct('DB_USER_VAL', 'DB_PASS_VAL', 'DB_NAME_VAL', '127.0.0.1')
#2 D:\Websites\Navand\wp-settings.php(124): require_wp_db()
#3 D:\Website\wp-config.php(92): require_once('D:\\Website...')
#4 D:\Website\wp-load.php(37): require_once('D:\\Website...')
#5 D:\Website\wp-blog-header.php(13): require_once('D:\\Website...')
#6 D:\Website\index.php(17): require('D:\\Website...')
#7 {main} thrown in D:\Website\wp-includes\wp-db.php on line 1670
Note:
Apache PHP works correctly when calling phpinfo()
extension_dir has been set for both php installations
both php_mysql and pdo_mysql are enabled for both php installation
both php.ini files are same (checked by WinMerge)
Why calling same mysql functions on Apache and TS-PHP generates error, but works correctly on IIS? and how can I resolve this problem (as I can not change WordPress source)
Surprise!
According to answer https://stackoverflow.com/a/14786808/1441476, using absolute extension dir in php.ini for version that runs under apache, worked for me (extension_dir = "C:/Programs/php/php-7.4.9-Win32-vc15-x64/ext" instead of extension_dir = "ext")

Google api php client

I'm trying to implement the google analytics API on localhost site using xampp on Mac OS.
but Im getting this error:
Fatal error: Uncaught Exception: This library must be installed via composer or by downloading the full package. See the instructions at https://github.com/google/google-api-php-client#installation. in /Applications/XAMPP/xamppfiles/htdocs/ga-api/google-api-php-client/autoload.php:14 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/ga-api/index.php(4): require_once() #1 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/ga-api/google-api-php-client/autoload.php on line 14
Can anyone help me with this?
Given that you installed the library using Composer, it will be installed to vendor and will be available in the autoload.php that Composer generates.
I will require_once DIR. '/vendor/autoload.php'; in index.php (preferred) or where I need to instantiate the GoogleClient class.
Ensure that the path to client credentials are rightly referenced when you set auth config like so:
Google_Client->setAuthConfig($pathToCredentials)
Reference:
Setting auth credentials:
https://github.com/google/google-api-php-client#authentication-with-oauth
Autoloading classes:
https://getcomposer.org/doc/01-basic-usage.md#autoloading

Fail to restore magento on a new domain

I used Ubuntu Desktop to be my server hosting Magento. I have restored the Magento in following way:
Import Magento database to MySQL server
Copy and paste all the files to /var/www/html
Remarks:
Permission: 755
Magento Version: 1.9.2
PHP version: 7.0
Unfortunately, I have got an error related to the code generated by Magento.
Fatal error:
Uncaught Error: Call to a member function extend() on boolean in /var/www/html/lib/Varien/Simplexml/Config.php:600
Stack trace:
#0 /var/www/html/app/code/core/Mage/Core/Model/Config.php(278): Varien_Simplexml_Config->extend(Object(Mage_Core_Model_Config_Base))
#1 /var/www/html/app/code/core/Mage/Core/Model/App.php(391): Mage_Core_Model_Config->loadBase()
#2 /var/www/html/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Model_App->_initBaseConfig()
#3 /var/www/html/app/code/core/Mage/Core/Model/App.php(348): Mage_Core_Model_App->baseInit(Array)
#4 /var/www/html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#5 /var/www/html/index.php(83): Mage::run('', 'store')
#6 {main} thrown in /var/www/html/lib/Varien/Simplexml/Config.php on line 600
How can I solve this error in order to restore Magento on a new domain?
I have tried to lower the permission to 644 but it failed. Moreover, I have tested that PHP7.0 can also open the installation page of a new Magento.
Although you have tried to set permissions of folders and files but still it seems to be a problem with folder and file permission.
Please try resetting permission using magento-cleanup.php
file.
Please put this file in document root of your magento and run this file from browser.
Please let me know whether it solves your problem or not.
This will help:
Try clearing cache, and check file permissions are correctly set,
Directories : 755
Files : 644
If this still doesn't work then may be your files are corrupt.

vagrant-shopware fails at establishing database connection

This error is shown after step 4 of installation "Database import" . I cannot understand why referenced file "sw4_clean.sql" is not in github repo of Shopware-4 at location shown it should show as missing during install?
I tried editing config.php before each attempt to establish database. This was my results
with database details = Internal Sever Error
as shown in config.php.dist = Internal Sever Error
empty = config.php now populate with settings = Internal Sever Error
I am using Vagrant build on windows 8 https://github.com/eriksixt/vagrant-shopware
Can anyone shed some light on to what might be going wrong?
Error
Received an error message.
URL: importDatabase?offset=0&totalCount=0
Message: Internal Server Error
Please try to fix this error and restart the update.
Response
{"code":2,"message":"fopen(\/vagrant\/shopware-
4\/install\/src\/..\/assets\/sql\/sw4_clean.sql)
: failed to open stream: No such file or directory",
"file":"\/vagrant\/shopware-
\/install\/src\/lib\/Shopware_Components_Dump.php",
"line":36,"trace":"#0 [internal function]: Slim\\Slim::handleErrors(2,
'fopen(\/vagrant\/...', '\/vagrant\/shopwa...', 36, Array)
\n#1 \/vagrant\/shopware-4\/install\/src\/lib\/Shopware_Components_Dump.php(36):
fopen('\/vagrant\/shopwa...', 'rb')\n#2 \/vagrant\/shopware-
4\/install\/src\/app.php(318): Shopware_Components_Dump-
>__construct('\/vagrant\/shopwa...')\n#3 [internal function]:
{closure}()\n#4 \/vagrant\/shopware-4\/engine\/Library\/Slim\/
Router.php(172): call_user_func_array(Object(Closure), Array)\n#5
\/vagrant\/shopware-4\/engine\/Library\/Slim\/Slim.php(1225): Slim\\Router-
>dispatch(Object(Slim\\Route))\n#6 \/vagrant\/shopware-
4\/engine\/Library\/Slim\/Middleware\/Flash.php(86): Slim\\Slim->call()\n#7
\/vagrant\/shopware-4\/engine\/Library\/Slim\/Middleware\/MethodOverride.php(94):
Slim\\Middleware\\Flash->call()\n#8 \/vagrant\/shopware-
4\/engine\/Library\/Slim\/Middleware\/PrettyExceptions.php(67):
Slim\\Middleware\\MethodOverride->call()\n#9 \/vagrant\/shopware-
4\/engine\/Library\/Slim\/Slim.php(1176): Slim\\Middleware\\PrettyExceptions-
>call()\n#10 \/vagrant\/shopware-4\/install\/index.php(59): Slim\\Slim->run()\n#11 {main}"}
Did you check the strict mode issue? Shopware does not like strict mode, which is enabled by default in the current mysql version. In my case the following configuration (my.cnf or my.ini dependent on the OS) did help:
[mysqld]
sql_mode="TRADITIONAL,NO_AUTO_CREATE_USER"
It seems like your are trying to use the installer on a git checkout of Shopware. That is not possible. Some files needed for the installer, for example "sw4_clean.sql" are generated in a deploy step when the install package is built.
To install Shopware using a git checkout please see: https://github.com/shopware/shopware#installation-via-git

Categories