I am trying to install pear in wampserver. It doesn't come with a go-pear.bat.
I download the .phar file from pear.php.net/go-pear and run php go-pear.phar.
It just keeps looping over the config where I set all the paths.
What gives?
Lets assume you are running PHP5.3.24 and wamp is installed on the C: drive, if not change the folder names accordingly.
Get go-pear.phar from http://pear.php.net/go-pear.phar and copy it to the wamp\bin\php\php5.3.24 folder
Do all this from a windows command window
cd C:\wamp\bin\php\php5.3.24
md pear
PATH=%PATH%;C:\wamp\bin\php\php5.3.24
php go-pear.phar
When you get asked this question
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) : D:\wamp\bin\php\php5.3.24
2. Temporary directory for processing : D:\wamp\bin\php\php5.3.24\tmp
3. Temporary directory for downloads : D:\wamp\bin\php\php5.3.24\tmp
4. Binaries directory : D:\wamp\bin\php\php5.3.24
5. PHP code directory ($php_dir) : D:\wamp\bin\php\php5.3.24\pear
6. Documentation directory : D:\wamp\bin\php\php5.3.24\docs
7. Data directory : D:\wamp\bin\php\php5.3.24\data
8. User-modifiable configuration files directory : D:\wamp\bin\php\php5.3.24\cfg
9. Public Web Files directory : D:\wamp\bin\php\php5.3.24\www
10. Tests directory : D:\wamp\bin\php\php5.3.24\tests
11. Name of configuration file : D:\wamp\bin\php\php5.3.24\pear.ini
12. Path to CLI php.exe : \wamp\bin\php\php5.3.24
1-12, 'all' or Enter to continue: 12
To get it to proceed with the install you have to just PRESS the ENTER key
Its as simple as that
I faced the same issue, if you scroll a bit back, you should see an error, probably you didn't fill the php.exe folder properly (number 12). Just type 12, press enter and navigate to you PHP installation folder (like C:/php). Then, after hitting enter, installation should start.
Type local after running php go-pear.phar.
Then go with what Pedro Lobito said.
If the list shows again, just press Enter and installation should start.
Related
I'm trying and failing to use tesseract php. I get this error:
Fatal error: Uncaught thiagoalessio\TesseractOCR\TesseractNotFoundException: Error! The command "tesseract" was not found. Make sure you have Tesseract OCR installed on your system: https://github.com/tesseract-ocr/tesseract
The current $PATH is C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Users\Peppe\AppData\Local\Microsoft\WindowsApps;C:\Users\Peppe\AppData\Roaming\Composer\vendor\bin in C:\Users\Peppe\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php:48 Stack trace: #0
C:\Users\Peppe\vendor\thiagoalessio\tesseract_ocr\src\TesseractOCR.php(26): thiagoalessio\TesseractOCR\FriendlyErrors::checkTesseractPresence('tesseract') #1 C:\xampp\htdocs\index.php(7): thiagoalessio\TesseractOCR\TesseractOCR->run() #2 {main} thrown in C:\Users\Peppe\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php on line 48
I'm using windows 10 with xampp installed in C:\xampp. php version 7.4
I installed tesseract.exe from https://github.com/UB-Mannheim/tesseract/wiki both x32 and x64
I used composer to install the https://github.com/thiagoalessio/tesseract-ocr-for-php and it gave no error.
<?php
require_once 'C:\Users\Peppe\vendor\autoload.php';
use thiagoalessio\TesseractOCR\TesseractOCR;
$ocr = new TesseractOCR("caption.jpg");
$content = $ocr->run();
echo $content;
?>
finally, the caption.jpg is in the htdocs folder, the main folder and same folder as index.php where the aforementioned code appears.
any solutions?
I found the answer:
the $PATH variable is taken from Windows. To set it right search for "system environment variables", click "environment variables", edit PATH and add the tesseract software folder, for example C:\Program Files\Tesseract-OCR
In my case I have to add new variable tesseract with full path C:\Program Files\Tesseract-OCR\tesseract.exe as showing in below screenshot
To install TESSERACT OCR and use it in PHP
You must perform the following steps:
(in my explanation, I assume you are on windows)
url src = https://tesseract-ocr.github.io/tessdoc/Installation.html
1- Download the TESSERACT software from URL:
https://github.com/UB-Mannheim/tesseract/wiki
2- From your composer, you must install:
url: https://packagist.org/packages/thiagoalessio/tesseract_ocr
composer require thiagoalessio/tesseract_ocr
3- Then, it is important to do things in the following order:
Your TESSERACT software (step 1) is installed in a directory
which will certainly be (it's up to you to check in your system)
folder = C:\Program Files\Tesseract-OCR
It is absolutely necessary to add this folder in the windows environment variables at the PATH level (user and system)
4- Then you restart your web environment (WAMP, LARAGON ...)
5- Verification that TESSERACT is operational.
Go to your CMD and write:
tesseract --version
Reply somethink like that :
tesseract v5.3.0.20221222
leptonica-1.78.0
libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.3) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.3.0
Found AVX2
Found AVX
Found FMA
Found SSE4.1
Found libarchive 3.5.0 zlib/1.2.11 liblzma/5.2.3 bz2lib/1.0.6 liblz4/1.7.5 libzstd/1.4.5
Found libcurl/7.77.0-DEV Schannel zlib/1.2.11 zstd/1.4.5 libidn2/2.0.4 nghttp2/1.31.0
6- Operation test from a PHP script
uses an image on a white background with text
<?php
$app_class = 'thiagoalessio\TesseractOCR\TesseractOCR';
$file = 'C:/Users/admin/Desktop/im2.jpg';
$class = new ReflectionClass($app_class);
$infoImg = $class->newInstanceArgs();
$infoImg->lang('eng','jpn','spa','fr');
$infoImg->image($file);
$infoImg->withoutTempFiles();
$resultat = $infoImg->run();
var_dump($resultat);
?>
I find a problem to use tesseract_ocr in php, I follow this tutorial https://github.com/thiagoalessio/tesseract-ocr-for-php.
I install tesseract_ocr use composer :
$ composer require thiagoalessio/tesseract_ocr
this is my folder structure in localhost :
this is mycode :
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
require __DIR__ . "/vendor/autoload.php";
use thiagoalessio\TesseractOCR\TesseractOCR;
echo (new TesseractOCR('images/8055.PNG'))
->whitelist(range('A', 'Z'))
->run();
?>
</body>
</html>
this is my php version :
and in the browser I get this error :
Fatal error: Uncaught thiagoalessio\TesseractOCR\TesseractNotFoundException: Error! The command "tesseract" was not found. Make sure you have Tesseract OCR installed on your system: https://github.com/tesseract-ocr/tesseract The current $PATH is C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Git\cmd;C:\Program Files\Java\jdk1.8.0_73\bin;C:\Users\frank\AppD in C:\xampp\htdocs\ocr\vendor\thiagoalessio\tesseract_ocr\src\FriendlyErrors.php on line 48
please anyone help me to solve this problem.
Thanks.
You need to install Tesseract OCR on your pc from here:
https://github.com/tesseract-ocr/tesseract
Then your code should be(just in case you are on windows, C:\Program Files\Tesseract-OCR\tesseract.exe is the path of Tesseract engine):
echo (new TesseractOCR($img_url))
->executable('C:\Program Files\Tesseract-OCR\tesseract.exe')
->whitelist(range('A', 'Z'))
->lang('eng')
->run();
Make sure the tesseract folder is in your path.
If you're unsure what I'm saying, click on the start button and type "edit the system environment variables". Click Environment Variables, under "System variables" click on the line that has "Path" on the far left, and click edit. Click "New" and put in the path to your executable, depending on if you're using the 64 bit or 32 bit version. In my case it was "C:\Program Files\Tesseract-OCR".
You can test this now by opening a new command prompt (if you had an old one open, it won't have the new path variable), and type tesseract and hit enter. You should see:
Usage:
tesseract --help | --help-extra | --version
tesseract --list-langs
tesseract imagename outputbase [options...] [configfile...]
OCR options:
-l LANG[+LANG] Specify language(s) used for OCR.
NOTE: These options must occur before any configfile.
Single options:
--help Show this help message.
--help-extra Show extra help for advanced users.
--version Show version information.
--list-langs List available languages for tesseract engine.
If you do, then it's installed and globally working on your machine now and should work with PHP. If you want to get it working without composer, look up my other answer about that on here.
I am running into an issue with a customer's Drupal sites. He has a number of D6 installs, and a new D7 that he's just starting on. All of these sites are on the same shared hosting package.
The problem is when running certain drush commands only on the D7 site. There are no issues on the D6 sites. The specific error for drush up on the D7 site follows:
foo#bar [~/www/foo]# drush up
Command pm-update needs a higher bootstrap level to run - you will need to invoke drush [error]
from a more functional Drupal environment to run this command.
Command pm-update needs the following modules installed/enabled to run: update. [error]
The drush command 'up' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a configured database. In
this case you can select another site with a working database setup by specifying the URI
to use with the --uri parameter on the command line. See `drush topic docs-aliases` for
details.
* connect the database through a socket. The socket file may be wrong or the php-cli may
have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.
Drush was attempting to connect to:
Drupal version : 7.28
Site URI : http://default
Database driver : mysql
Database username : username_foo
Database name : database_foo
PHP configuration :
PHP OS : Linux
Drush version : 7.0-dev
Drush temp directory : /tmp
Drush configuration :
Drush alias files :
Drupal root : /home/foo/www/foo
Site path : sites/default
Everything I can find (and indeed the link in the error message) say the solution is to change the host value in the settings.php file from localhost to 127.0.0.1. However, this has not been the solution for us.
The frontend site has no problems connecting to the database, and drush itself seemingly does in many cases too.
drush sql-connect will generate a string that you can use to connect to MySQL.
drush sql-cli will successfully connect to MySQL
The settings.php file is definitely in a folder called default (path: www/foo/sites/default) and I get the exact same error when specifying --root and --uri options.
Drush was originally a ~5.x release, and it had the same issues. We updated to the ~7.x to try to eliminate the error. The host value in settings.php has been localhost as well as 127.0.0.1 with equally poor results.
We've verified that MySQL is available via socket from the PHP CLI. Drush is up to date and a fresh install. The Drupal 7 site is a brand new fresh install.
I'm at a loss. Why would this work with the D6 sites, but not the D7? Any suggestions?
Is your settings.php file in a folder called 'default'? If not, you might need to tell Drush where to find it by using --uri=mysite.com or -l mysite.com.
There are several ways to specify which Drupal site Drush will target. The most basic option is fairly verbose; run:
$ drush --root=/path/to/drupal --uri=http://example.com status
You can do the same thing with a slightly different syntax:
$ drush /path/to/drupal#example.com status
You can also specify the Drupal site implicitly, by setting the cwd to the folder that contains the settings.php file for your site:
cd /path/to/drupal/sites/default # or /path/to/drupal/sites/mysite.com, as appropriate
$ drush status
In all of the cases above, if settings.php is in a folder called "default", then you do not need to specify the --uri component; you may, for example, cd /path/to/drupal followed by drush status, and the correct Drupal site will be found. If settings.php is not in a folder named 'default', then you will need to either specify --uri, or cd to the folder that contains the settings.php file.
Source
According to this message:
pm-update needs the following modules installed/enabled to run: update
Drush requires Update module to be enabled, so the following command should fix the problem:
drush -y en update
Hi I just installed PHPStorm 5 for the first time to give it a try and I seem to be having a problem in running PHP applications.I have installed xampp and the path to the PHP interpretator has been set to:
D:\Program Files\xampp\php\php.exe
When I try to run I php file I get this error:
"D:\Program Files\xampp\php\php.exe" D:\Program Files\xampp\php\php.exe "D:\Program Files\xampp\htdocs\PHPStorm\Project\index.php"
Could not open input file: D:\Program
Process finished with exit code 1
For some reason it seems that PHPStorm does not read the rest of the path and it stops at D:\Program.
How can I correct this problem besides changing the name of the folder because that would require me to reinstall almost everything on my computer again?
EDIT RUN CONFIGURATION
Look the full command-line:
"D:\Program Files\xampp\php\php.exe" D:\Program Files\xampp\php\php.exe ⤦
"D:\Program Files\xampp\htdocs\PHPStorm\Project\index.php"
You are using the command:
"D:\Program Files\xampp\php\php.exe"
With the following three parameters:
D:\Program
Files\xampp\php\php.exe
"D:\Program Files\xampp\htdocs\PHPStorm\Project\index.php"
You php.exe then tries to open the "file"
D:\Program
and naturally fails. Instead your command should be:
"D:\Program Files\xampp\php\php.exe" c:\path\to\your\script.php
Obviously you did enter the text D:\Program Files\xampp\php\php.exe into too many textboxes as it belongs to. If you're new to PHPStorm I suggest you read the online manual:
Interpreters - PhpStorm 5.0 Web Help
Run/Debug Configuration: PHP Script - PhpStorm 5.0 Web Help
It's also available by pressing F1 when you're in a dialog.
Edit: Clear the field named Interpreator Options
How to correct instal pear for php. I store all for web server in /opt/local.
But pear want be installed to /Users/. How change this folder.
c8-bc-c8-d8-eb-65:tmp macbookpro$ sudo php -d detect_unicode=0 go-pear.phar
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) : /Users/macbookpro/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /Users/macbookpro/pear/bin
5. PHP code directory ($php_dir) : /Users/macbookpro/pear/share/pear
6. Documentation directory : /Users/macbookpro/pear/docs
7. Data directory : /Users/macbookpro/pear/data
8. User-modifiable configuration files directory : /Users/macbookpro/pear/cfg
9. Public Web Files directory : /Users/macbookpro/pear/www
10. Tests directory : /Users/macbookpro/pear/tests
11. Name of configuration file : /Users/macbookpro/.pearrc
You can change the dirs by pressing the corresponding number on that line.