How do you edit the command line php.ini file in Azure? - php

I'm trying to migrate a PHP website from AWS to Azure and have created a website in the Azure UI.
I've installed composer using the Kudu console and have overridden a few php.ini settings via the .user.ini file I created in the root. I've also added php_memcache.dll to my wwwroot/bin directory and enabled this in app settings within the Azure UI.
However, when running composer install using using the console I get an error because it can't find the memcache library. I assume because I haven't added this to the command line php.ini file. Does anyone know how to to edit this?
This is the error I get when I run composer install:
- The requested PHP extension ext-memcache * is missing from your system.
Edit - Solution
Looks like I've managed to run composer install using the following command:
php -d extension=D:\home\site\wwwroot\bin\php_memcache.dll bin\composer.phar install
Is it possible to run this without specifying the extension and using composer install instead of bin\composer.phar install`?

To add an extension to PHP app on an Azure website, it is easier to configure it from your Azure portal. The official Azure documentation on PHP configuration should help, just search on that page for "How to: Enable extensions in the default PHP runtime".

I wasn't able to find a way to get CLI extensions onto Azure. I did find that
composer install --ignore-platform-reqs
Does the install without blocking on missing PHP extensions.

Related

Enable php-gmp for php

I'm trying to configure an AWS AMI instance. In some of the PHP code I use the gmp function, so I installed the relevant package using the following command.
yum install php71-gmp
I have restarted apache, but this doesn't work or give any difference. Still getting the error Call to undefined function gmp.
Any clue how I can add this extension? In the /etc/php.ini there is no extension list..
I got this answer from Amazon Support Center
Create a something.config file inside a .ebextensions folder at the root directory of your project and put this code inside:
packages:
yum:
php70-gmp: []

Installation of Libsodium on a Azure Web App

I've been trying to install Libsodium on my PHP Web App in Azure, but there's a few permission issues that I've encounted.
I've been following this link here to try and install it: https://paragonie.com/book/pecl-libsodium/read/00-intro.md#installing-libsodium but it requires me to place the libsodium.dll file into the same directory as the php.exe file - where I obviously don't have the correct permissions to write into, which is probably the cause of this error in the command line:
ERROR: The DSP libsodium.dsp does not exist.
Any ideas?
Thanks in advance
I suspect you tried to install the extension with pecl install libsodium, which is hard to get working on Windows.
This is the reason that you're advised to download the .dll and use that.
Even if you would get pecl install libsodium to work, it would also only have created a .dll file that you need to activate in PHP.
So you're lost until you get write access to that php.exe directory.
Does it change anything if that DLL is on the %PATH%?
If that works, then you can build an XDT transform to add an arbitraty folder to the system %PATH%. Here's how: https://github.com/projectkudu/kudu/wiki/Xdt-transform-samples#adding-environment-variables

How to install and configure php in openwrt

I have developed some pages in PHP and HTML. But the PHP pages were not working when I put these pages in OpenWrt www folder. I have installed php5 in OpenWrt. These pages were working fine with apache localhost in ubuntu. In OpenWrt, It has uHTTPd. Do I need to install anything other than just php5 (other modules) or Do I need to configure something?
For PHP5 configuration on OpenWRT see: http://wiki.openwrt.org/doc/uci/uhttpd
First, install PHP
opkg update
opkg install php5
opkg install php5-cgi
Install any other additional php5 extensions you may use. To see available packages:
opkg list php5*
Example:
opkg install php5-mod-sockets
Open your /etc/php.ini and uncomment any of the extensions you just installed. Continuing with the sockets example above the following:
;extension=sockets.so
becomes
extension=sockets.so
Now open /etc/config/uhttpd and add the following line:
list interpreter ".php=/usr/bin/php-cgi"
Don't forget to restart uhttpd:
/etc/init.d/uhttpd restart
One option in regards to your space (flash) limitations of installing PHP on your embedded device: if you have access to a USB port on your embedded device (like many do) you can set up your base openWRT configuration with extroot. Essentially you will boot to a USB drive thereby enabling all of the space of the USB drive to install packages and add files. See: http://wiki.openwrt.org/doc/howto/extroot
Actually you do need to install a server (such as Apache), and if you want data persistence, a database (such as MySQL)
I found a complete guide for exactly what you wish:
http://wiki.openwrt.org/doc/howto/lamp

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.

Installing PEAR on wampserver

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.

Categories