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.
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 have tried some ways to create an alias for my local Drupal project, I'm referring to :
https://www.drupal.org/node/1401522
https://www.drupal.org/project/drush/issues/831272
https://www.drupal.org/project/drush/issues/786766
I can connect by running this command :
drush --root=C:/wamp64/www/executive-coatings --uri=http://localhost:81/executive-coatings status
Output :
Drupal version : 8.6.13
Site URI : http://localhost:81/executive-coatings
DB driver : mysql
DB hostname : localhost
DB port : 3306
DB username : root
DB name : dev_ecc_new
Database : Connected
Drupal bootstrap : Successful
Default theme : ecc_front
Admin theme : adminimal_theme
PHP binary : C:\wamp64\bin\php\php7.2.10\php.exe
PHP config : C:\wamp64\bin\php\php7.2.10\php.ini
PHP OS : WINNT
Drush script : C:\wamp64\www\executive-coatings\vendor\bin\drush.phar
Drush version : 9.6.2
Drush temp : C:\Users\k\AppData\Local\Temp
Drush configs : C:/Users/k/.drush/drush.yml
C:/wamp64/www/executive-coatings/vendor/drush/drush/drush.yml
Install profile : minimal
Drupal root : C:\wamp64\www\executive-coatings
Site path : sites/default
Files, Public : sites/default/files
Files, Temp : /tmp
But when I try to use a drush alias it doesn't work. Here my alias file :
$aliases['local'] = array(
'uri' => 'localhost:81/executive-coatings',
'root' => 'C:/wamp64/www/executive-coatings',
'path-aliases' => array(
'%dump-dir' => '/tmp',
),
);
Running drush #local status returns [preflight] The alias #local could not be found.
I think I put my alias file in the wrong directory, can you provide the correct path ?
Alias file location is not your only issue here, because you are running Drush 9.x. Here the major changes between Drush 8.x and Drush 9.x regarding aliases :
Site aliases are no longer PHP files but YAML files. Hopefully Drush 9.x comes with a command to convert your old drush 8 aliases :
drush site:alias-convert
The user alias locations used in Drush 8 (~/.drush/sites, /etc/drush/sites) are by default no longer parsed, but you can register any location where alias files may be placed in your ~/.drush/drush.yml configuration file. Setting the old Drush 8 paths can be done automatically by running :
drush core:init
It writes the following to ~/.drush/drush.yml :
drush:
paths:
alias-path:
- '${env.home}/.drush/sites'
- /etc/drush/sites
For example in your case, defining a local environment for the website executive-coatings aliased ecc may be done in the file (provided this location is registered as mentioned above) ~/.drush/sites/ecc.site.yml.
You can also define environment aliases (eg. #dev, #preprod, etc.) for a given website at the following location (under the project root of that website, using self in the file naming) :
<DRUPAL_ROOT>/drush/sites/self.site.yml
Useful links :
- https://github.com/drush-ops/drush/blob/master/examples/example.site.yml
- https://github.com/consolidation/site-alias
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
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.
When I run php from the command line (on Windows), I receive the following message
Failed loading C:\Users\Nickey K\Documents\AMD APP\bin\x86_64;C:\Users\Nickey K\
Documents\AMD APP\bin\x86;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program F
iles (x86)\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Window
s Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Prog
ram Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C
:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program F
iles (x86)\Calibre2\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files
(x86)\Windows Live\Shared;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-
Static;C:\Program Files (x86)\EasyPHP-12.0\php\php544x120715104042;\php\php544x1
20715104042\php_xdebug-2.2.0-5.4-vc9.dll
x_debug seems to be installed properly based on phpinfo, and I have the following line in php.ini
zend_extension = "C:\Program Files (x86)\EasyPHP-12.0\php\php544x120715104042\php_xdebug-2.2.0-5.4-vc9.dll"
I've put the dll file in both the above the the ...\ext directory and tried a few variants of the above line, but I'm unable to get rid of this error message.
Any ideas?
The regular command line PHP from EasyPHP did not work as is. The problem is EasyPHP replaces the PATH variable with its own. That is just dumb that it doesn't use a different variable.
But, the following worked for me after some experimentations. I created a batch file php5.bat and placed it in C:\Windows\Sytem32 for easier access, with the following code (where C:\Program Files (x86)\EasyPHP-12.1\php\php548x121030011600 is the location my easyPHP php.exe was).
#echo off
REM Set the path for easy PHP and then start PHP.
set OLD_PATH=%PATH%
set PATH=C:\Program Files (x86)\EasyPHP-12.1
set PHP_DIR=C:\Program Files (x86)\EasyPHP-12.1\php\php548x121030011600
call "%PHP_DIR%\php.exe" -c "%PHP_DIR%\php.ini" %*
set PATH=%OLD_PATH%
#echo on
And then calling the batch file php5 -v will give you the php version. You might need to copy some DLLs from the Apache folder into the PHP folder as it will complain the DLLs are not found.
lets try to use zend_extension_tc instead of zend_extension if you're using window.