linking firebase firestore with laravel - laravel

I want to test Firestore with laravel. But before i can use it, I need a couple of tools.
I'm stuck on gRPC. I installed it, it's working on my windows 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

It may be the case that the gRPC extention is not enabled on the php.ini file, you can enable it by:
On PHP version 7.2 and up: add extension=grpc on the php.ini file
On older PHP versions: add extension=php_grpc.dll on the php.ini file
And then restart XAMPP and the extension will be activated as showed in phpinfo() and it should work.
If this does not work, a workaround for the issue is to download the gRPC DLL and add it to your project's extentions manually. You can download the latest version on the PECL repository for gRPC (Choose a stable version), and extract the php_grpc.dll file to the extensions folder in XAMPP, which the path you can find on the php.ini.
After that, enable the extetion as described earlier and restart XAMPP again.
Let me know if this fixed your issue.

Related

Call to undefined function CodeIgniter\locale_set_default() - Xampp

I'm trying to set up Codeigniter4 with Xampp but when calling the public address http://localhost/projectfolder/public/index.php as stated in the README.md file of the CodeIgniter4 framework, the next error appears:
<br />
<b>Fatal error</b>: Uncaught Error: Call to undefined function CodeIgniter\locale_set_default() in
C:\xampp\htdocs\codeigniter4\system\CodeIgniter.php:184
Stack trace:
#0 C:\xampp\htdocs\codeigniter4\system\bootstrap.php(181): CodeIgniter\CodeIgniter->initialize()
#1 C:\xampp\htdocs\codeigniter4\public\index.php(36): require('C:\\xampp\\htdocs...')
#2 {main}
thrown in <b>C:\xampp\htdocs\codeigniter4\system\CodeIgniter.php</b> on line <b>184</b><br />
I've tried this solution but it didn't work for me.
Does anybody know how to solve it?
The root of the issue is that you have a missing PHP extension.
In particular:
intl
Keep in mind that this is clearly stated in the frameworks' repository README.md file.
Server Requirements
PHP version 7.4 or higher is required, with the following extensions
installed:
intl
libcurl if you plan to use the HTTP\CURLRequest library
mbstring
Additionally, make sure that the following extensions are enabled in
your PHP:
json (enabled by default - don't turn it off)
xml (enabled by default - don't turn it off)
mysqlnd
In addition, it's also pointed out here:
Bug: Missing function locale_set_default(...) #3171
Please install intl extension - this is a required component.
I found my temporary solution in here, without updating de PHP Version in Xampp.
Go to C:\xampp\htdocs\projectfolder\system\CodeIgniter.php - line 184 and change the next line.
Before:
locale_set_default($this->config->defaultLocale ?? 'en');
After:
if( function_exists('locale_set_default' ) ) :
locale_set_default($this->config->defaultLocale ?? 'en');
endif;
Once I updated Xampp to the 7.4 version (download here), I just needed to enable the extension=intl in the xampp\php\php.ini file. As it is explained here, you just have to uncomment the line from ;extension=intl to extension=intl.
Then you can leave the C:\xampp\htdocs\projectfolder\system\CodeIgniter.php - line 184 as it was in the beginning.
locale_set_default($this->config->defaultLocale ?? 'en');
Install it via linux
sudo apt-get install php-intl
or for a PHP Version
sudo apt install php7.4-intl
if you are on xampp (windows) update the php.ini
php.ini path = C:\xampp\php\php.ini
;extension=intl
to
extension=intl

'tesseract: error while loading shared libraries: libarchive.so.13: python

Error : pytesseract.pytesseract.TesseractError: (127, 'tesseract: error while loading shared libraries: libarchive.so.13: cannot open shared object file: No such
My apt file looks like this :
libgl1 libsm6 libxrender1 libfontconfig1 libarchive-dev libtesseract-dev tesseract-ocr tesseract-ocr-eng
My requirements file has pytesseract mentioned.
I added a buildpack, set the TESSDATA_PREFIX config variable path.
The issue persists.
I just had the same problem and it seems to be that new heroku stack (heroku-20) has bad compatibility with tesseract. So I just changed heroku stack from 20 to 18 using command heroku stack:set heroku-18. You can also do it in settings in your dashboard. I also removed unnecessary libraries from Aptfile and only left following (German I needed for my purposes so you might not use it):
tesseract-ocr
tesseract-ocr-eng
tesseract-ocr-deu
I redeployed my app and everything works!
I have faced same issue recently. But i fixed by adding the following library in Aptfile
*libarchive13*
and then redeployed my app and everything works fine...
I just upgraded my heroku stack from 18 -> 22 and added
*libarchive13* in Aptfile which we add in root directory of project & it worked for me .
Downgrading the stack is not a solution as heroku-18 is deprecated & will reach to its end-of-life soon.

what is the solution for php_mysql.dll ext in laravel with php 7 and IIs7

I am using laravel latest framework (5.3.*) with IIS7 and php7. It is showing a warning for create project or any artisan command like
c:\inetpub\wwwroot\test>php atisan serve PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ v7.0\ext\php_mysql.dll' - %1 is not a valid Win32 application. in Unknown on line 0
I want to create my project with latest version of php and laravel but with php7 the php_mysql.dll is deprecated. How can I prevent the warning of php_mysql.dll?
Did you copy php.ini from a previous installation of PHP 5.x? It looks like you have copied the extensions and php.ini from a previous installation of PHP 5, compiled with a different version of VC or 32/64bit.
To solve the issue, you should just need to open your php.ini, and comment out or remove the line:
extension=php_mysql.dll

unable to run laravel 4

I thought it was about time to look at a PHP Framework so I chose laravel. However, getting it running is causing me grief.
I followed the video from nettuts installing laravel 4 and at 5.05mins into the video he uses the php command-line server command (available from 5.4) php -S localhost:8888 -t public/ followed by confirming that it works via localhost:8888 in the browser which displays 'Hello Wolrd!'
I have XAMPP installed and my version of PHP is 5.3.15. I attempted to test it by doing http://localhost/learning-laravel/public/
At this point I have already downloaded composer and installed the dependancies successfully.
But I keep getting the following error:
Warning: require(/Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/../vendor/autoload.php) [function.require]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/autoload.php on line 17
Fatal error: require() [function.require]: Failed opening required '/Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/../vendor/autoload.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/learning-laravel/bootstrap/autoload.php on line 17
Inside my learning-laravel folder I do have bootstap/autoload.php
Can someone please help? Thanks.
I had another look at my folder structure and I noticed that composer had not run correctly and there were missing files. I've reinstalled it and it appears to be working.

Can't install PEAR on Windows 7, Structures/Graph error

I just did a clean install of Windows 7. I've installed Apache, Mysql
and PHP 5.3.5 all separated (not using XAMPP/others).
I'm getting the following error in the install: ERROR: unable to unpack phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar
The full stack trace is:
C:\Web\php-5.3.5>go-pear.bat
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : system
Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations.
1. Installation base ($prefix) : C:\Web\php-5.3.5
2. Temporary directory for processing : C:\Web\php-5.3.5\tmp
3. Temporary directory for downloads : C:\Web\php-5.3.5\tmp
4. Binaries directory : C:\Web\php-5.3.5
5. PHP code directory ($php_dir) : C:\Web\php-5.3.5\pear
6. Documentation directory : C:\Web\php-5.3.5\docs
7. Data directory : C:\Web\php-5.3.5\data
8. User-modifiable configuration files directory : C:\Web\php-5.3.5\cfg
9. Public Web Files directory : C:\Web\php-5.3.5\www
10. Tests directory : C:\Web\php-5.3.5\tests
11. Name of configuration file : C:\Web\php-5.3.5\pear.ini
12. Path to CLI php.exe : C:\Web\php-5.3.5
1-12, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\Web\php-5.3.5\pear.ini...
Initialized registry...
Preparing to install...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.3.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.8.0.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1.tar...
install ok: channel://pear.php.net/Archive_Tar-1.3.3
install ok: channel://pear.php.net/Console_Getopt-1.2.3
ERROR: unable to unpack phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.8.0
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's' PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
** WARNING! Old version found at C:\Web\php-5.3.5, please remove it or be sure t
o use the new c:\web\php-5.3.5\pear.bat command
The 'pear' command is now at your service at c:\web\php-5.3.5\pear.bat
* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under C:\Web\php-5.3.5\PEAR_ENV.reg .
This file creates ENV variables for the current user.
Double-click this file to add it to the current user registry.
C:\Web\php-5.3.5>
After days of googling I've found an answer. Here is it. How to solve:
With admin permission (start cmd with admin privileges):
Run the go-pear.bat that comes with the default PHP installation. It'll installs PEAR, but it's going to generate an error when installing Structures_Graph. IMO Pear needs this package to generate the package dependency (graph), since it's missing it not allow us to install or upgrade any other package.
Download and uncompress Structures_Graph from the pear.php.net website (direct link). Then copy the Structure folder into the PEAR folder. The archive has three folders: docs, Structures, tests. We only need the Structures one. Copy the Structures folder to your PHP_ROOT_DIRECTORY\PEAR directory. So if you installed PHP on C:\Web\php-5.3.5 copy the Structures folder to C:\Web\php-5.3.5\PEAR\, the result should be: C:\Web\php-5.3.5\PEAR\Structures
Do pear install Structures_Graph. Even though the files are present, Structures_Graph is not really installed (we had a problem during installation). So we need to run the command above.
Do pear upgrade PEAR. This upgrades PEAR itself to the current version.
Do pear upgrade Console_Getopt. This upgrades Console_Getopt to the current version and now we can manage and install any pear package.
Marcos Roriz solution does indeed work, but to clarify point 2:
The uncompressed "Structures" folder (inside the tgz) needs to be placed inside the folder: "PEAR\pear" -> e.g. C:\wamp\bin\php\php5.3.5\PEAR\pear
This is a combination of the things you need to do and a couple of new tweaks. Worked on WinXP Pro with WAMP (Wampserver 2.2.1)
Change your go-pear.bat file:
#ECHO OFF
set PHP_BIN=php.exe
%PHP_BIN% -d output_buffering=0 -d phar.require_hash=0 PEAR\go-pear.phar
pause
Run it - go-pear.bat
Now you've go a Pear install with a missing graph.php
Download and uncompress Structures_Graph from the pear.php.net website. Copy the Structure folder into the PEAR folder so that the key files are located as such:
PEAR\Structures\Graph.php
PEAR\Structures\Graph\Node.php
Change this line in Node.php:
require_once '/Structures/Graph.php';
Execute in the PEAR directory:
pear upgrade=all
That did it for me.
First of all, run as administrator.
Then - try to write something in target directory in the console to isolate any remaining permissions problems.
I've been having many issues after upgrading my wampserver which now comes with php 5.3.5.
I have solved the problem by installing php 5.3.0 alongside and using it to run the installer found at http://pear.php.net/go-pear. I set the php cli setting to the php5.3.5 folder without any issues.
This might be wampserver specific. To gauge if you are experiencing a similar problem here are some of the issues I encountered:
Using the go-pear.bat packaged with php5.3.5 i had the same unable to unpack error as the original poster.
Using the go-pear.bat packaged with php5.3.0 i was able to complete the installation but the pear installer was v1.8.0
Using the installer on the pear site mentioned previously with php5.3.5 i had an error "Warning: rmdir(D:\temp): Directory not empty in D:\go-pear.php on line 1237". Looking at the stack trace the Archive_Tar class was throwing an error and the installer was failing to clean up after itself.
the web frontend not write correct paths to pear.ini
ig phph setting is magic_quotes_gpc = On
its doubles all slashes "\" in paths to "\" is it a bug ?
Than the packages for example can be unpacked (wrong paths ?)
"unable to unpack" Message when installing packages
http://pear.php.net/bugs/bug.php?id=18212
I tried all of the above with no luck. After downloading and extracting the "Structures" folder I had to edit all paths and add "PEAR/". Then I was able to do "pear install Structures_Graph" and then "pear upgrade-all"
Graph.php
require_once 'PEAR/Structures/Graph/Node.php';
Node.php
require_once 'PEAR/Structures/Graph.php';
AcyclicTest.php
require_once 'PEAR/Structures/Graph.php';
require_once 'PEAR/Structures/Graph/Node.php';
TopologicalSorter.php
require_once 'PEAR/Structures/Graph.php';
require_once 'PEAR/Structures/Graph/Node.php';
require_once 'PEAR/Structures/Graph/Manipulator/AcyclicTest.php';

Resources