How to configure PEAR in server - php

I'm using Batavi to build an online store, and when I install it is giving error like
PEAR is not installed on this server or path to a directory with PEAR is not specified in the include_path.
and another error like
Version of Apache on your server has been hidden.
I don't have any idea how to set it up, may be with php.ini file, can some one help me?

Depending on your operating system probably there should be a pear package.
For example on ubuntu linux it is php-pear, and you can install it like this:
sudo apt-get install php-pear
If pear is only missing from your include_path, you should add it in your php.ini files. (somewhere around /etc/php*)
In my case /etc/php5/*/php.ini:
include_path = ".:/usr/share/php"
But you should verify the path.

Related

Enable XSL on Ubuntu 12.04

I am trying to enable XSL on Ubuntu 12.04 but its failing. I did this locally on my Ubuntu 13.04 and it was successful. Basically the following worked on my local computer.
apt-get install php5_xsl
edit php.ini file and add extension=php5_xsl.so
restart apache
I repeated the same procedures on my production server running Ubuntu 12.04 and PHP version 5.5.12 but the extension is not getting loaded from the phpinfo. I have also changed the extension=php5_xsl.so to extension=xsl.so because this is what in the extension directory.
I read that I might need to recompile PHP but I am not sure of this steps.
Try this:
sudo apt-get install php5-xsl
sudo php5enmod xsl
sudo service apache2 restart
Why:
http://www.lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu
What's happened here is that all debian-flavoured unixes have adopted
this standard for their PHP 5.4 packages, so if you're using debian,
ubuntu, or any of their relatives with PHP 5.4, you'll see a directory
structure like this. When you add a module to PHP, you'll add a file
to the mods-available directory enabling the module and adding any
config specific to it. If you want to enable the module, just do:
php5enmod http
This simply creates a symlink from the usual conf.d directory to point
to where the real files are in mods-available, prefixed with a number
that indicates the priority of the module. By default, the priority is
20.
Using this approach means we can toggle things on and off without
commenting out big chunks of config files and leaving them lying
around - if this seems familiar then that's no surprise; debian-like
linuxes manage their apache configuration in just the same way. Any
packages that you install using aptitude will use these exact same
commands to set up the configuration and then symlink it correctly. To
unlink, use the delightfully predictably-named php5dismod :)

Using Pear's PHP codesniffer with MAMP Pro on mac

I’d like to ask for some help getting Pear’s PHP Code Sniffer set up properly.
I’m using MAMP pro 2.0.5 on a Mac PB 10.7.4 with PHP 5.3.6.
I do have Pear installed and can run pear commands, when I installed the PHP_CodeSniffer channel I didn’t get any errors but I can’t trigger any commands.
Here is a screen shot of my command line:
https://skitch.com/stephanief0042/etuck/alohamediaworks-bash-100x40
I was able to reference this post:
Putting PEARs php_dir into include_path in php.ini
But my include path seems correct:
include_path = ".:/Applications/MAMP/bin/php/php5.3.6/lib/php:/Applications/MAMP/bin/php/php5.3.6/bin/pear"
When I traced the path to the PHPCS install I found it’s executable file on this path: Users/alohamediaworks/pear/bin/phpcs
I’m not sure if i’m one symlink from being able to use this or not, any help or suggestions would be welcome.
PEAR will install bin files like PHPCS into a configurable location. You can see this location by running pear config-show | grep bin_dir.
The value here is probably currently /Users/alohamediaworks/pear/bin
You might want to just set it to /Applications/MAMP/bin or somewhere local on your Mac, like /usr/local/bin.
Before you do this, it is worth uninstalling PHP_CodeSniffer, and also checking that PEAR knows where PHP is by running pear config-show | grep php_bin.
I'll assume both values need changing:
pear uninstall PHP_CodeSniffer
pear config-set bin_dir /Applications/MAMP/bin/php/php5.3.6/bin
pear config-set bin_dir /Applications/MAMP/bin
pear install PHP_CodeSniffer
(check that the paths are valid first and that you don't have friendlier symlink versions)
You need the php_bin to be correct because PEAR will change the #! line of all bin files (like phpcs) on install to point to your PHP executable. The bin_dir is important to ensure bin files are placed into a directory that is in your path. Uninstalling PHP_CodeSniffer is required so old files are not left around (PEAR wont move them).
Hope that helps.

Plesk - Adding Pear

I currently have a linux server with Plesk installed. I need to have pear functionality, however I'm having difficulty understanding the documentation.
Viewing phpinfo(), the configure command contains --without-pear.
I have 'edited' my httpd.include file to extend the openbase_dir value to /usr/share/pear and also used this in the include path.
In the pear manual, it states:
When using PHP, the PEAR Package Manager is already installed unless one has used the ./configure option --without-pear.
Does this mean I need to install the pear package manager again? Do I need to reconfigure PHP with --with-pear? If so how do I do this?
After this step, is there anything else I need to do to enable pear?
Many thanks
Phil
Personally, I have just manually installed PEAR with an apt-get install php-pear and then I included it in php parameter in each domains and subdomains on my plesk panel. So I added /usr/share/php (which is PEAR directory, you can get it with pear config-get php_dir) in include_path and open_basedir sections (you can see here how to manage PHP settings on plesk).

phpMyAdmin - The MySQL Extension is Missing

I installed everything separately (Apache, PHP, MySQL and phpMyAdmin) and do not use a compilation, everything works fine till now except phpMyAdmin.
The problem I am experiencing is, that the error message states that the "MySQL extension is missing", as soon as I try to call up:
localhost/phpmyadmin/index.php
And when I call up
localhost/phpmyadmin/setup/index.php
I have two messages where I do not know if it is supposed to be like that:
Bzip2 compression and decompression requires functions (bzopen,
bzcompress) which are unavailable on this system.
and:
Zip decompression requires functions (zip_open) which are unavailable
on this system.
Any suggestions?
At first make sure you have mysql installed properly. You can ensure it just by checking that whether you can access mysql using mysql command promp. So if you mysql is working then probably it is not loading. For that follow the steps given below
First of all, you must find your php.ini. It could be anywhere but if you create a small php file with the
<?php phpinfo(); ?>
script it will tell you where it is. Just look at the path of loaded configuration file.
Common places include /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini or even /usr/local/lib/php.ini for Windows it may be C:\Users\username\PHP\php.ini
Edit your server’s php.ini and look for the following line. Remove the ‘;’ from the start of the line and restart Apache. Things should work fine now!
;extension=mysql.so
should become
extension=mysql.so
For windows it will be
;extension=mysql.dll
should become
extension=mysql.dll
Some linux distributions have a php_mysql and php_mysqli package to install.
You need to put the full path in the php ini when loading the mysql dll, i.e :-
extension=c:/php54/ext/php_mbstring.dll
extension=c:/php54/ext/php_mysql.dll
Then you don't need to move them to the windows folder.
In my case I had to install the extension:
yum install php php-mysql httpd
and then restart apache:
service httpd restart
That solved the problem.
Just as others stated you need to remove the ';' from:
;extension=php_mysql.dll and
;extension=php_mysqli.dll
in your php.ini to enable mysql and mysqli extensions. But MOST IMPORTANT of all, you should set the extension_dir in your php.ini to point to your extensions directory. The default most of the time is "ext". You should change it to the absolute path to the extensions folder. i.e. if you have your xampp installed on drive C, then C:/xampp/php/ext is the absolute path to the ext folder, and It should work like a charm!
I just add
apt-get install php5-mysqlnd
This will ask to overwrite mysql.so from "php5-mysql".
This work for me.
Installing bzip2 and zip PHP extensions solved my issue in Ubuntu:
sudo apt-get install php7.0-bz2
sudo apt-get install php7.0-zip
Use php(you version)-(extension) to install and enable any missing modules that is required in the phpmyadmin readme.
Your installation is missing some php modules, there should be a list of required modules in the phpmyadmin readme. If you recently enabled the modules, try restarting the apache service / daemon.
Edit: As it seems, there is no single "enable these modules" in the docs, so enable either mysql or mysqli in your php.ini (you might need to install it first).
The two messages are not important if you do not intend to upload or download compressed file within phpMyAdmin. If you do, enable the zlib and / or bz2 modules.
I had a similar issue, but it didn't help to add extension=mysql.so in my php.ini. It turned out that the mysql.so file was not in my extension folder nor anywhere else on my machine. Solved this by downloading the php source and building the extension manually and then copying it into the extension folder.
Just check your php.ini file, In this file Semicolon(;) used for comment
if you see then remove semicolon ;.
;extension=mysql.dll
Now your extension is enable but you need to restart appache
extension=mysql.dll

pgsql.so is not loaded in PHP

I've been tasked to create a PHP app which accesses an existing PostgreSQL database. This is my first time working with Postgre, not to mention the PHP has already been installed in the Linux box on which the app is supposed to run. I have no experience setting up this stuff, I just code.
My question is that I can't seem to get the Postgre extension working in PHP. I checked the php.ini file, there were no "extension=..." lines. So I added "extension=pgsql.so". I then checked the "extension_dir" and found that there were only 2 files in there (ldap.so, phpcups.so), I added a pgsql.so file taken from another Linux box. I restarted httpd. And it does not work. I couldn't find any "pgsql" or "postgre" in phpinfo().
Forgive my noobness. I know too little Linux. I would really appreciate it if you can point me to the right direction.
I used the suggestion given by number5:
Dude, I'm on RedHat. I used the "yum" version of the command you gave, and I got this:
[root#perseus ~]# yum install php-pgsql
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=extras error was
[Errno 4] IOError:
Error: Cannot find a valid baseurl for repo: extras
UNFORTUNATELY, the Linux server I'm using is NOT connected to the Internet. Any other way to install?
It depends on which Linux distro you are using.
If you are using Ubuntu/Debian, you need to:
sudo apt-get install php5-pgsql
Fedora/CentOS
yum install php-pgsql
usually you can find out which distro you are on by:
ls /etc/*-release
On CentOS extensions create separate *.ini file one per each php extension in /etc/php.d
So, don't alter main *.ini file, but create /etc/php.d/pgsql.ini and add there a line
extension=pgsql.so
Then you will need to restart Apache using
service httpd restart
But the best automated way is to just type
yum install php-pgsql
In your case that didn't work because of some problems in yum configuration. Go to /etc/yum-repos.d
Type
nano /etc/yum.repos.d/CentOS-Base.repo
Scroll down to [extras] section and ensure it is like this:
#additional packages that may be useful
[extras]
priority=1
name=CentOS-$releasever - Extras
=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Correct it if needed, save file (Ctrl-X) and do the following:
yum clean all
yum upgrade
Afterwards try to repeat
yum install php-pgsql
Remove the .so file you've copied from the other machine (though it might work, there's no need to take the risk)
Use the distribution's package manager to install the php_pgsql/php5_pqsql module
Restart the apache and try again. Maybe the module has been added to an .ini file automagically
If not, run <?php echo 'ini: ', get_cfg_var('cfg_file_path'); to see which php.ini you have to edit
edit this ini file
restart the apache
My operation system Linux mint kde and there was same issue
pg_connect()
You must install if you are use php5.6
sudo apt-get install php5.6-pgsql
After you must change extention name in "php.ini" file.
;extension=php_pgsql.dll
'dll' to 'so'
For example
extension=php_pgsql.so

Categories