PHP Websockets extension on Microsoft Azure website - php

I want to use web sockets on my PHP website hosted on Microsoft Azure.
For this I need to use the websockets extension php_sockets.dll.
I added the php_sockets.dll to my wwwroot/bin folder. I edited the app settings as followed:
But I get the following error in de log:
Unable to load dynamic library 'C:\DWASFiles\Sites\mywebsite\VirtualDirectory0\site\wwwroot\bin\php_sockets.dll' - The specified module could not be found.
Is Azure blocking it?

It worked for me! Here are some things to keep in mind:
Make sure you are downloading the php_sockets.dll from the PHP for Windows site
Make sure you download the proper version (for example, I'm running PHP 5.4 on my Azure Website, so I downloaded the PHP 5.4.40 ZIP file form the page listed above).
Make sure you download the VC9 x86 Non Thread Safe package.
As you mentioned in your question, create a folder titled bin in the wwwroot folder and place the DLL in this folder.
Follow the steps in the Azure documentation: Configure PHP in web apps)

Related

Running My PHP Application in Web Server

I am using QNAP Network Attached Storage with a built in Web Server and MySQL Database my model is QNAP TS-253
I have an issue regarding running my PHP application inside my QNAP Web Server. It runs perfectly when using my localhost , but when i upload it to the /Web folder in my file storage directory in My QNAP Server and ran the program inside the server, I encounter some issues, like some functions inside my PHP Application doesnt work(Connecting to database , executing php functions). I do not know where the problem lies. I think it only reads the HTML codes and ignores the php sections of the file but i am not sure.
Essentially what I did is enable Web Server(Without changing any configurations) and copy all the files in my PHP project to the default Web folder in the file storage of my QNAP Web Server. I use the MySQL database provided in QNAP (which I can access without any problems when I run my PHP application using localhost), but cannot be accessed when I run my PHP application from the QNAP Web Server.
Also, Everytime I login to the QNAP utilities and settings browser interface(the page where you can edit network settings and other configurations for your QNAP) I get a message that DNS cannot resolve hosts. I am not sure if this issue affects my PHP application from running in my QNAP Web Server.
Pleasehelp, I am happy to provide further details if needed
One approach could be updating your PHP-version. QNAP is very restrictive in terms of PHP-updates. Therefore, you should check your PHP-version. Since QTS 4.2, QNAP included PHP 5.5 and MariaDB 5.5. Maybe, an update can solve your problems.
Another alternative could be installing this QPKG: http://forum.qnap.com/viewtopic.php?f=320&t=110391
This provides an Apache 2.4.12 (the built-in QNAP Apache is only at version 2.2) + PHP 5.6.10 (only for x86 CPUs). After this, you would have an up-to-date webserver with adequate PHP and database versions.
Hope this helps.

upgraded mysql to 5.5 on windows / php doesn't connect to mysql API

i was upgraded mysql to 5.5
but i don't know why php does not connect to mysql API
in info file written
Client API version mysqlnd 5.0.11-dev
my server is windows server / using IIS
Installation
First thing to do after you download and extract phpMyAdmin is place the extracted files in the appropriate directory inside your IIS web root so that IIS is able to access it. You may wish to create a separate website for your phpMyAdmin installation, or simply add it as a sub directory or virtual directory under an existing website. Either way you'll need to make sure that the user account used by IIS to access your files has at least NTFS read permissions to all of your files once they are in place.
In this guide we'll place the phpMyAdmin files in a directory called "pma" under the root directory of a website "example.com". Because phpMyAdmin enables you to directly manipulate, and even delete entire databases and users, it is highly recommended that you secure your phpMyAdmin installation using SSL. This can be done by purchasing a certificate from a 3rd party vendor which will cost money, or by creating self signed certificate for IIS yourself at no cost. With all this in mind, then to access the phpMyAdmin installation used in this guide you would type the following into the address bar of your favourite web browser;
PHP Settings
phpMyAdmin uses several PHP extensions to perform its various functions. The extensions you'll need for phpMyAdmin are;
MySQL (to connect to the MySQL server on web hosting)
MCrypt (highly recommended for performance when using the cookie authentication method, and actually required for 64-bit environments)
MBString (used for multi-byte character support)
GD2 (image creation and manipulation library)
To enable these extensions open you php.ini file and navigate to the list of extensions and find these extension names;
;extension=php_gd2.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mysql.dll
Simply remove the semi-colon (;) from that start, save the file and restart IIS to reload your PHP environment. These extensions should now be loaded into your PHP environment, and can be verified using the phpinfo function as described in the PHP installation guide.
And I found lot of possible answers in google
you can go through this links.
Install and Configure MySQL for PHP Applications on IIS 7
Use the Database Manager
Configuring PHP with MySQL for Apache 2 or IIS in Windows
Install and configure phpMyAdmin on IIS

Using Pthread in Azure web app in a PHP site

I have a webapp (PHP site using CodeIgniter) hosted on Azure. I have a situation where I want to use the pthread module. Since pthread is not available in PHP out of the box, when I install it using Xampp server, I suspect that it won't be possible to use threading on Azure.
But I am not sure. Azure documentation also doesn't talk about it. Is there a way I can use it pthread on Azure?
I am able to use it on my local Windows machine, using pthread.dll.
To enable extension in Azure Web APP, we should customize PHP runtime on Azure. Please refer to official site.
For this issue,I have tried to install pthreads successfully. And I toke those steps as following:
1, I obtained a PHP 5.4 (5.4.43) VC9 x86 Thread Safe package from PHP site explored to folder named PHP. And followed the pthreads site, got the lasted version of pthreads.
2,Added pthreadVC2.dll (included with the Windows releases) to the same directory as php.exe and added php_pthreads.dll to PHP extention folder.
3,I uesd phpinfo() to find default php.ini file in Azure, which should be similar with the picture:
,
Then I browsed Kudu Console of my web app via https://<your_web_app_name>.scm.azurewebsites.net/DebugConsole/?shell=powershell.
Locate to the directory found above. Download the content to local saved as php.ini in the PHP directory. Uncommented extension_dir = "ext" in this file.
4, Add a bin directory to your root directory (for example, bin\php), and use FTP tool to upload the PHP runtime on it.
5,Browse to the web app in the Azure Portal and click the configure tab.
Add *.php to the Extension field and add the path to the php-cgi.exe executable at the Handler mappings section.
At last, we check the PHP env,we should see the result as below
and run the test code of pthreads to check the extension
If you have any concern, please feel free to let me know.

PHP, IIS, Oracle (OCI) not working

We are migrating from a Windows SBS 2011 to Windows Server 2012 R2.
We have an internal website that connects to our Oracle database using PHP.
I am trying to migrate this to the new server and so far I have:
Installed IIS Server Role
Installed PHP
Downloaded Oracle Instant Client to C:\instantclient
Added C:\instantclient to PATH System Variable
Added php_oci8.dll to php.ini and checked that PHP is actually using this php.ini
Restarted server
I am still getting error messages like oci_ commands not being recognised etc.
I'm lost. I've searched online and the instructions match what I have done from memory.
I haven't found a single thing online that I haven't done.
Depending on the version of InstantClient you have installed you might need to include the bin folder in the path, like so:
C:\instantclient\bin
To check if the DLL files are available in the path enter where oci*.dll in a command prompt. It should return a list of matching files.
Also, remember that just because your account can see the DLL files doesn't mean IIS/PHP can. That runs under a different account that might not have permission to access the files. Check your IIS error log and PHP php_errors.log file for any specific error messages.
Edit
After a rather lengthy chat, the problem was resolved by:
Updating the InstantClient from 10.1.0.5 to 10.2.0.5 (as mentioned in the module requirements: On Windows, the php_oci8 DLL needs Oracle client libraries from version 10gR2 or greater.)
Adding a copy of msvcr71.dll to the InstantClient folder.
Downloading and manually configuring PHP from php.net instead of using PHP Manager for IIS.
Ensuring the Path environment variable correctly pointed to the InstantClient and PHP folders.
try this:
extension=php_oci8_12c.dll
(instead of php_oci8.dll) - that is what I am using and you probably downloaded the same instant client as I did.

How do I install ionCube on an Azure Web Site?

I am trying to follow the instructions under Using Custom PHP Extensions in Windows Azure Web Sites to enable the ionCube extension for PHP running within an Azure Web Site. Here's what I did:
Downloaded the Windows VC9 (Non-TS) (x86) loader from the ionCube loader download page.
Created a directory at /site/wwwroot/bin
FTP'd ioncube_loader_win_5.3.dll to that directory.
Under "app settings" in the Azure portal for the web site I added PHP_EXTENSIONS with value bin/ioncube_loader_win_5.3.dll.
I loaded http://my.azure.website/info.php and verified that the Environment table included PHP_EXTENSIONS = bin/ioncube_loader_win_5.3.dll. It also contains APPSETTING_PHP_EXTENSIONS = bin/ioncube_loader_win_5.3.dll.
When I try to load the site I get the message "The page cannot be displayed because an internal server error has occurred" and no additional information.
Is there something I forgot or is ioncube not supported on Azure? Did I set up the directory properly?
I also tried the Zend Guard Loader extension (ZendLoader.dll) in the same manner. I don't get an error message, but the extension doesn't show up in phpinfo() either.
I posted an article explaining How to configure ZendGuard on Windows Azure Web Sites
You shall not put the module in the root of the ftp site. The DLL module must reside in a folder below the APPLICATION ROOT, which is site/wwwroot/ So, you have to create either site/wwwroot/bin or anything of your choice (i.e. site/wwwroot/phpext), and then map PHP_EXTENSIONS again to bin/ioncube... (or phpext/iocube...), whatever is the name of your folder underneath site/wwwroot/!
However I am having trouble running any php page when the mentioned module is enabled. I don't know whether this is because my files are not ionCube encrypted, or because of some issue with the ionCube itself. So if you have a ionCube encrypted file, you have the chance to test.
ionCube is a Zend Extension, so according to an answer on windows azure forums:
The correct way to do it would be to create the /site/wwwroot/bin directory and upload ioncube_loader_win_5.4.dll there then add under the portal App Settings a PHP_ZENDEXTENSIONS setting with bin\ioncube_loader_win_5.4.dll as its value.
I confirm, but my tests was done in /site/phpext with an App Setting on ..\phpext\ioncube_loader_win_5.4.dll.

Categories