install mbstring extension on heroku - php

I am trying to install mbstring extension on heroku and the only info i found
on the web is this github site.
https://github.com/wuputah/heroku-libraries/tree/master/php
Generally the process is:
Download code in a heroku run bash that's a PHP app
/app/php/bin/phpize
./configure --with-php-config=/app/php/bin/php-config
make
When i run no 2 on and i got this, but i already at the root level of my site. Any idea?
Make sure that you run '/app/php/bin/phpize' in the top level source directory of the module

You'll want to use a custom buildpack with support built-in to PHP for that. Here's a shameless plug to the buildpack that I use that has support for most of the common requests for PHP extensions.
https://github.com/winglian/heroku-buildpack-php

Related

ssh2 ssh2_connect() function not found

So I have a class that I build that uses the ssh2 package in php. I have successfully set this up and used and tested this class on apache2 server. The server at work where this is going to be running is an instance of litespeed. I have scoured the web for a way to get ssh2 working with this litespeed server however I cannot for the life of me figure it out. I get ssh2_connect() function not found. If I go go /etc/php/... I can see that the ssh2.ini file exists. However I believe the active php instance is located /usr/local/lsws/lsphp74/7.4/etc/php/ where I do not see the ss2.ini located. Is there a way to get ssh2 installed in the directory that is being used by the server? If I run ssh2_connect at the command prompt, it works just fine as it is most likely using the /etc/php instance of php.
You're correct, ssh2_connect() is provided by a pecl extension. These are optional binary add-ons for php. I'd make a quick phpinfo(); page and add it to the litespeed server so you can see what modules are active and where the config files php is using are actually located on disk.
The install guide can walk you through installing this pecl extension.
https://www.php.net/manual/en/ssh2.requirements.php
Another way to accomplish this is with a pure-php library that doesn't depend on special plug-ins. phpseclib fully implements the ssh protocol in pure php, taking advantage of libraries if they are present but it's able to function without them.
since you didn't mention what exactly is your server env
I would assume it's either OpenLiteSpeed image , or CyberPanel image
first of all , compile libssh2
wget https://libssh2.org/download/libssh2-1.10.0.tar.gz
tar vxzf libssh2-1.10.0.tar.gz
cd libssh2-1.10.0
./configure
make
make install
then compile the PHP extension
mkdir /usr/local/lsws/lsphp74/tmp
pecl channel-update pecl.php.net
/usr/local/lsws/lsphp74/bin/pear config-set temp_dir "/usr/local/lsws/lsphp74/tmp"
/usr/local/lsws/lsphp74/bin/pecl install https://pecl.php.net/get/ssh2-1.3.1.tgz
echo "extension=ssh2.so" > /usr/local/lsws/lsphp74/etc/php/7.4/mods-available/50-ssh2.ini
and finally , restart lsphp process to load new module
touch /usr/local/lsws/admin/tmp/.lsphp_restart.txt
or
killall lsphp
then verify by phpinfo(); to make sure you see ssh2 loaded

How to Install pspell with MAMP

I use MAMP for local php development and recently needed to use php's pspell functions for a project. I found little help with this specific scenario (short of recompiling php, yuck) so this post explains how I got it done.
I am not positive but you may need xcode and xcode command line tools installed for this to work. This article might be helpful.
Install MacPorts if you don't have it already
Install aspell and the dictionary of your choice (I used "en"):
sudo port install aspell aspell-dict-en
note: for the next commands, you need to know the version of php you're running on MAMP. You can find this in the MAMP preferences under the PHP tab. For me it's 5.5.18
Download the php source for the version of php you are running,
unarchive it, and move into the pspell source directory:
cd ~/Downloads/php-5.5.18/ext/pspell
Now (being sure to use the proper phpize binary for your php version) do:
/Applications/MAMP/bin/php/php5.5.18/bin/phpize
You should see something like:
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
Next:
./configure --with-php-config=/Applications/MAMP/bin/php/php5.5.18/bin/php-config --with-pspell=/opt/local/
And finally, build the module file:
make
You should now have two files inside the ./modules/ directory: aspell.so and aspell.la - copy them into your php's extensions directory:
cp ./modules/* /Applications/MAMP/bin/php/php5.5.18/lib/php/extensions/no-debug-non-zts-20121212
Now add the extension to your configuration file in /Applications/MAMP/bin/php/php5.5.18/conf/php.ini
extension=pspell.so
Finally, restart your MAMP servers and (hopefully) you are good to go!

How to obtain php_phar.dll?

PHP on Windows does not include php_phar.dll which means that
when installing pear i have to do it like this php -d phar.require_hash=0 go-pear.phar because it would not install Graph part of pear
I cant use MakeGood for unit testing in Eclipse
I cant use phar in general
is there a way to get to the php_phar.dll or pear community just decided that they wont support windows servers?
The phar extension is now a part of PHP that cannot be removed (statically built), so you do not need a .dll file for it.
Run php -m to see it listed.

how to add extension in php Opensuse

I want to add an extension so I can use my own function in php for example my codes of C but I don't know the requisites and instructions of doing it.I have php5 and OS:Opensuse 11.
I don't know about configure and the codes in shell
there should be something like ext_skel so I can create config files but I don't have it should I download it from somewhere?
Due to this link http://www.tuxradar.com/practicalphp/20/3/0
there should be ext directory but I don't have it.
Thanks in Advance
cd
vi ext/util/config.m4a
./build conf --force
./configure => i don't know here
You should download PHP and then change to the ext directory and follow the tutorial. Don't forget to compile PHP too, because the extension you create depends heavily on the PHP version. I've installed OpenSuse but I don't think it does affect building a PHP extension. You might need some compiler tools etc. I found /php-5.2.6/ext/ext_skel in my PHP path. I've PHP installed in my home directory. You need to install the sources. In OS it's zypper in php5-devel. You can also download the tarball from the PHP site.
Edit: Here is another tutorial about php extension programming.

How to get Buildconf & Configure scripts for PHP5

Am trying to install a package which has given instructions to use Buildconf from the root of php build directory. In my php build directory's root(/etc/php5), I don't find a Buildconf or Configure script. How do I get these? I installed my php5 using sudo apt-get(yes, I have an Ubuntu).
What you probably have installed is PHP binary package, i.e. already built one. If you need to build a stand-alone PHP module, you may want to install package php5-dev and use utility /usr/bin/phpize5 to generate config files.
If what you really need is PHP source, you may download it from http://www.php.net/downloads.php. After you unpack the package, buildconf will be there.
If neither of these is what you need, I guess it would be helpful to post the instructions you received.

Categories