How do I enable mbstring extension on PHP 5, Fedora server - php

I need to add the mbstring extension to an install of PHP 5.2.6 on Apache/2.2.11 (Fedora). We have dynamic extensions enabled so I really think all I need is the .so file and .ini files, correct? Can I simply drop these files in and make it work or do I have to recompile PHP? If it's simply upload and go, where can I get the files I need?

Try yum install php-mbstring. You may then need to restart apache, e.g. /sbin/service httpd restart.
You can also use yum info "php-*" to find a list of other php packages available.

Related

How to install GD extension for PHP?

I have PHP 8.1.2 with Apache 2.4.52 on Ubuntu 22.04 and I think I need the GD Graphics Extension for my PHP scripts to work but it appears not to be installed and / or enabled (there is no GD section in the output from running phpinfo().
Some advice I have seen is to run apt-get install php-gd and restart Apache without any modifications to php.ini.
At php.net it seems to suggest there is a
recommended bundled version of the GD library
already present in my PHP and that I need to edit php.ini in order to enable it. I understood (I now think wrongly) this meant I needed to remove the prefixed semi colons from these pre existing directives:
;--with-gd[=DIR]
;--enable-gd
The advice continues on to suggest for certain image formats (although possibly not for PNG) I need to uncomment:
;--with-jpeg
;--with-xpm
;--with-webp
For enhancing GD's font capabilities uncomment:
--with-XXXX
--with-freetype
searching /etc/php/8.1/apache2/php.ini revealed that was no ;--enable-gd line or any of the other above directives in that file. There was a ;extension=gd line.
I would like to know how to proceed from here in order to install (if it is not already installed as I thought the documentation implied) and enable the GD Graphics extension.
Edit I also saw this geeksforgeeks article suggesting to uncomment ;extension=gd and restart the server.
You can run php -v to see what version of PHP you have on the machine.
After that, you can run sudo apt-get install php<your-php-version>-gd, e.g. sudo apt-get install php8.1-gd. Hope it helps!

How to install Magento on a laptop?

When I install Magento 2, it gives me 4 errors. One is in a xsl file, one in a intl file, one in a soap file and one in a sockets file.
How can I remove all these errors? Please tell me.
These are the extensions that you need to install for php. which operating system you are using ?
xsl file,
intl file ,
soap file
and sockets file
if you are using windows then use.
Check php.ini file. This is normally under your xampp folder (Example D:\xampp\php)
Search like php_soap.dll;,php_xsl.dll,php_intl.dll each dll extension
removing the first ; character, to make it looks like
extension=php_soap.dll
extension=php_xsl.dll
extension=php_intl.dll
Once done restart Apache server.
if you are using ubuntu then use the following
apt-get install php7.0-intl
apt-get install php7.0-xsl

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 :)

How to add a PHP module to Apache in Redhat/Centos?

I am using Apache on Redhat/Centos, there are no PHP modules. Can anyone tell me where can I find a PHP module with .SO extension file? In www.php.net there are no .SO extension files.
Generally, PHP .so extensions are packaged in separate packages in a system. For example, you can get the mcrypt.so extension on RedHat/CentOS by:
sudo yum install php-mcrypt
then, you could find it at /usr/lib64/php/modules/mcrypt.so. Also you could find the associated /etc/php.d/mcrypt.ini, which will get loaded by php when you restart Apache, or php-fpm.
PHP extensions (not modules) are either compiled in when you install php via flags with the ./configure command (i.e. --with-curl ... etc) Or by telling your php.ini file where the .so file is (which will be available when you restart apache and therefore PHP)
If you are planning on using a dynamic extension, which are the .so files, then you need to compile or grab a pre compiled version for your distro, and include it in your php.ini file. You can find out your php.ini file location via the command line like so:
php -i |grep 'php.ini'
A note for those using PHP7.1 for RH7 from the Webtatic repository
(http://mirror.webtatic.com/yum/el7/webtatic-release.rpm)
The packages needed for PHP7.1 are:
sudo yum install php71w-fpm php71w-opcache php71w-common php71w-process php71w-pdo php71w-gd libmcrypt php71w-mcrypt php71w-mbstring mod_php71w
particularly the php module for apache is called:
mod_php71w

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