Installing PEAR on wampserver - php

All the guides for installing PEAR on wampserver, such as the Symfony guide, say I am to run a go-pear.bat script within some PEAR directory.
I am on wampserver 2.1 and there is no PEAR directory and no go-pear batch script to be found.
Is this just different because I have a newer version? Is there somewhere I can download these missing installation scripts?

It's not installed per default on all setups.
But you can download the plain go-pear script for that: http://pear.php.net/go-pear
Either invoke it with php.exe go-pear or run it through your webserver as regular .php script. (It has a nice installation GUI!)

Rather new to pear myself, but my answer to a similar question:
Running Wampserver 2.2 on Win7 Professional 64bit working with PHP 5.3.8 I have found a few issues with standard way of installing with go-pear. I downloaded the go-pear.phar and ran that via cmd with no deprecated errors etc.

you could also just go to the pear site, download the zips and unzip them in the correct local folders (wamp/bin/php)
we've just solved a similar problem like this, where a copy of a live site set up on a local machine was hitting errors because PEAR was not installed. The installation process was hitting errors so we just downloaded and unzipped PEAR and the required modules directly into the correct directory.
problem solved.

Firts export in the PATH system, add you folder with php, p.e. if you have php 5.4.x in your wamp system:
PATH=...;C:\wamp\bin\php\php5.4.x;
Create a new folder p.e.:
C:\wamp\bin\php\pear\
If your php version is 5.3 or or newer you can use pyrus.phar.
Using pyrus.phar to install pear
php pyrus.phar install pear/PEAR-1.9.4
Export you PATH again:
PATH=....;C:\wamp\bin\php\pear;
you can use pear.bat, or pear.
pear.bat <arguments>
Check: for more information:
http://pear.php.net/manual/en/installationpyrus.introduction.php
http://pear2.php.net/

This worked for me on windows 7:
http://www.steptoinstall.com/install-pear-wamp-server-windows-7-8.html
NOTE: Make sure you open command prompt window in administration mode.

I downloaded the 32bit wamp and this includes the pear files. However it is best to install 1.9.2 by downloading go-pear.phar manually, as the default one didn't seem to work.

How it worked for me is,
I went to the PEAR official site and clicked on this link which brings you to go-pear.phar source. Then I saved the file by right clicking on the web page, under my php7.4 ( this is the PHP version I have set on my ENV variables ) folder.
Next opened up the command line as admin and did CD to that folder and ran the following command php go-pear.phar.
This started the PEAR installation process and asked few questions. At the end I was asked to double click on "PEAR_ENV" reg file which was inside the php folder and done.
Hope this will helpful for someone.

Related

Pdftohtml Poppler utils not working on centOs

I am trying to convert pdf to html in php using mgufrone library(https://github.com/mgufrone/pdf-to-html). I run this in my mac it's working alright.
But when I run in centos server, the .html file is created blank inside /vendor/gufy/pdftohtml-pdf/output folder.
In my mac local multiples files are created inside /output folder. But in server only a single file is created with empty content.
Please help.
Herein lies the problem:
sudo yum install poppler-utils
That installs an old version (0.12.4) which does not have pdftohtml command options like "-s" and "-fmt".
Go to this page https://medium.com/#jakebathman/building-poppler-utils-for-centos-6-5-really-e52eccffc6ae to guide you on how to get a later version of poppler-utils. I installed https://poppler.freedesktop.org/poppler-0.22.5.tar.gz instead of 0.13.4 as instructed.
All the best!

How to downgrade php from 7.1.1 to 5.6 in xampp 7.1.1?

I want to downgrade php version from 7.1.1 to 5.6 in xampp 7.1.1. But I can't find any option.
I think the most safest downgrade path from PHP7 to PHP5 in Xampp is:
Download a self-packaged version of Xampp with PHP5 from here (as of today this is xampp-win32-5.6.37-0-VC11.zip).
Rename the php folder to php7 in Xampp.
Now copy the php folder from xampp-win32-5.6.37-0-VC11.zip into your Xampp install folder.
Make a backup from .\xampp\apache\conf\extra\httpd-xampp.conf file.
Replace this file from xampp-win32-5.6.37-0-VC11.zip as well.
This way the config files (including php.ini) has settings from the Xampp team.
Before any changes, to verify changed Apache configs, you can compare both Xampp release folder at .\xampp\apache\conf with tools like Meld.
I should note that please download PHP 5 and 7 Xampp packages released at the same time.
Notify me if I miss something.
If you want to downgrade php from 7.1.1 to 5.6 in xampp follow the steps(For Windows):-
Go to https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/5.6.36/
Download and extract the file xampp-win32-5.6.36-0-VC11.zip see the image
[image 1][1]
Delete php folder and apache folder present in C:\xampp
Copy php folder and apache folder from extracted file and paste it to C:\xampp
Add " C: " before \xampp\ to php ini file present in php folder.
Start your apache and MySQL and check php version. It will show php 5.6.36
Just delete this xampp, and download 5.6 version.
There is no option to downgrade XAMPP. XAMPP is hardcoded with specific PHP version to make sure all the modules are compatible and working properly. However if your project needs PHP 5.6, you can just install a older version of XAMPP with PHP 5.6 packaged into it.
Source: How to downgrade php from 5.5 to 5.3
Change the .htaccess code to switch to PHP 5.6:
AddHandler application/x-httpd-php56 .php
XAMPP is an integrated package and you can not downgrade or change one of its component such as php. (There are some solutions that you can use but there is little chances that everything work fine.)
You can download the package from these links:
https://www.apachefriends.org/download.html
https://sourceforge.net/projects/xampp/files/
You had better to download the old package form sourceforge.net.
You do not have to install another version of Xampp. I've managed to use PHP 5.6 on my Xampp PHP 7 version. Here is what you need to do to make it works:
Raname (backup) <XAMPP_DIR>\php to <XAMPP_DIR>\php~7
Copy (backup) <XAMPP_DIR>\apache\conf\extra\httpd-xampp.conf to <XAMPP_DIR>\apache\conf\extra\httpd-xampp~7.conf
Download PHP5 and unpack it to <XAMPP_DIR>\php
Edit <XAMPP_DIR>\apache\conf\extra\httpd-xampp.conf and change all php5 occurrences to php7. You need to change php7apache2_4.dll to php5apache2_4.dll, php7ts.dll to php5ts.dll and php7_module to php5_module
Ensure all your paths are correct like extension_dir in php.ini.
Restart Apache and voila.
If you want to downgrade php version, just simply edit yout .htaccess file.
Like you want to downgrade any php version to 5.6, just add this into .htaccess file
<FilesMatch "\.(php4|php5|php7|php3|php2|php|phtml)$">
etHandler application/x-lsphp56
</FilesMatch>
I know it might be late but I'm just adding to Lanti's answer since it's the most popular, I had the same problem as Wouter Vanherck in the comments and I can't comment yet.
What helped for me was instead of just replacing \xampp\apache\conf\extra\httpd-xampp.conf I replaced the whole apache folder. I basically did the same thing with it as with the php folder (steps 2 and 3).
Now the error is fixed and Apache starts just fine.
Using WAMP is perforce option if we want to use more then one version of php.
It is very easy to do, all you need to do is
1) download 5.6 from [1]: https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/5.6.36/, the run the setup and install in folder "xampp"
2) download 7.6 from [https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/7.4.2/xampp-portable-windows-x64-7.4.2-0-VC15-installer.exe/download][1] and run the setup in "xampp2"
NOte: after that you now have separate xampp installed in your system. all you do now is to run each xampp as a separate entity. Alway quite the 5.6 if you want to run 7.6
This solution is Only for local system / localhost on windows:
The simplest way to install xampp 5.6.X version as per your requirement in other windows drive then run xampp 5.6.X services from it's control panel for php 5.6 version.
NOTE: If you already have xampp (any other version) on your system then please close that xampp's services then start xampp 5.6.x services otherwise this solution will not work.
You can download your required (xampp 5.6 as per question) xampp version from below link:
https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/
I have used this solution many times, it worked like charm. I hope this will also help you. Thank you to ask this question.
i was trying the same, so i downloaded the .7zip version of XAMPP with php 5.6.33 from
https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/5.6.33/
then followed the steps below:
1. rename c:\xampp\php to c:\xampp\php7
2. raname C:\xampp\apache\conf\extra\httpd-xampp.conf to httpd-xampp7.OLD
3. copy php folder from XAMPP_5.6 7zip archive to c:\xampp\
4. copy file httpd-xampp.conf from XAMPP_5.6 7zip archive to C:\xampp\apache\conf\extra\
open xampp control panel and start Apache and then visit ( i am using port 82 instead of default 80)
http://localhost
and then click PHPInfo to see if it is working as expected.
Opening localhost shows dashboard
Opening phpinfo shows version 5.6

Php executable for php-linter when using xampp (ubuntu) not working

As the topic sentence says. I'm using atom with linter-php in ubuntu with an xampp setup. PHP is located in the opt/lampp/bin folder when you've installed xampp in ubuntu 16 but atom isn't accepting it. "unable to get version" and "spawn php ENOENT." Anyone out there using this same setup? Which path did you use for the php executable? Alternatively: Should i just install php in the standard file directory outside of xampp as well and direct linter there?
This may have been a bit of a hack approach to fixing this issue but i just installed php7.0 outside of xampp again and directed the linter path there. Actually didn't have to direct it at all. As soon as i installed php from the terminal, the issue was fixed.

How can I install PHP extension libsodium in Wampserver?

I am trying to install the Libsodium PHP extension using PECL, but I have no idea how to get the dll files needed. I want to use it with Wampserver on Windows 7 (64-bit).
Can any one help me?
Here is How I did it.
Download the libsodium from here > For PHP 7.0, For PHP 5.6 And For PHP 5.5 (All x64). #One Important Note, Please download appropriate x86-32 bit or x64-64 bit of this extension matching of your environment from here
Extract the Downloaded file and copy libsodium.dll to wamp->bin->php->php5(x).x.xx Folder
Copy php_libsodium.dll From the extracted File to wamp->bin->php->php5(x).x.xx ->ext
Now Click on the WAMP System tray icon.
Go to PHP-> PHP Settings and Click on the enable dl from the menu of the WampManager from the system tray
Now Add bellow line to php.ini from PHP -> php.ini from the menu of Wampmanager, save and close it
extension=php_libsodium.dll
Now Restart Apache or click Restart All Services from the menu of WampManager
You should now get your php_libsodium in the extensions of the php Up and Running.
:)
**I didn't notice that, this question is 4 months old. I hope You have solved this.
use command prompt :
pecl install libsodium
and go to wamp folder find php.ini in php folder :
append this line: to ini file
extension=libsodium.so
You might be able to achieve this result by running php5enmod libsodium, depending on which webserver you use. Make sure you restart your webserver after installing PECL libsodium
here is good references:
https://paragonie.com/book/pecl-libsodium/read/00-intro.md#installing-libsodium
You can download the dll files you need here: http://windows.php.net/downloads/pecl/releases/libsodium/1.0.2/
Select the version that corresponds with your PHP version, compiler and architecture. (this can be checked using phpinfo(); on your machine)
Copy php_libsodium.dll to "ext" directory (C:\PHP\ext)
Copy libsodium.dll to root of PHP directory (C:\PHP)
Add extension=php_libsodium.dll to php.ini
restart apache
This worked on a standalone version of PHP running on Windows 7, I see no reason why this shouldn't work on WAMP or XAMP.
Wamp 3.2.0 64-bit
Even though in the past apparently more steps were required (see my comment from 2018), today I installed Wamp 3.2.0 64-bit, and when I got an error about libsodium not working, I was able to easily fix it by:
Wamp tray icon > PHP > PHP Extensions > ensure "sodium" is checked
(Wamp will automatically refresh)
I was pleasantly surprised that is worked!
You can also use https://github.com/paragonie/sodium_compat. You can simply use :
composer require paragonie/sodium_compat

How to setup Mongo DB & PHP with core Mac OS 10.6.8, default Apache instance/Web Sharing

I am attempting to configure PHP and Mongo DB to connect with one another and I'm having some troubles. Before I say the problem let me recap what I have so far.
I am using MAC OS X 10.6.8
I have mongo DB installed and working stand-alone.
I have enabled PHP on the default Mac OS Apache web server. It is working and the server recognizes PHP ( it is not allowing inline PHP scripts in HTML files...not sure if this an issue)
"Web sharing" works just fine.
I have installed pear via this url: curl -O http://pear.php.net/go-pear.phar
I have the pear folder and files accessible and have launched o-pear.php from a web browser.
I have gone through the step-by-step install process ( and removed any red displayed errors ).
Presumably Pear is now installed.
It says at the bottom of the install front end:
Note: To use PEAR without any problems you need to add your PEAR
Installation path (/Users/myname/Sites/PEAR) to your
include_path.
Using a .htaccess file or directly edit httpd.conf would be working
solutions for Apache running servers, too.
I am not sure what the code is I need to add for the httaccess rewrite.
As of this moment
Terminal does not recognize the pear command.
When I launch the pear "front end" from a web browser I get:
Fatal error: No PEAR.php in supplied PEAR directory: /Users/myname/Sites/PEAR in /Users/myname/Sites/index.php on line 24
Thank you.
That is all.
Create a new PHP file called phpinfo.php. Add the content <?php phpinfo(); ?> there. Run the script from within your webbrowser.
You should see a big page with PHP configuration information. Watch out for include_path. This is where your webserver/PHP module/process searches for include files.
You will also find Loaded Configuration File. This is the PHP configuration file being used. Open that file in any editor, and search for include_path again. Add /Users/myname/Sites/PEAR to the end of the include_path.
Restart your webserver. PEAR now should work.
If you need to install the MongoDB PHP extension, go for pecl install mongo from command line.

Categories