Showing posts with label php5.6. Show all posts
Showing posts with label php5.6. Show all posts

Monday, July 17, 2017

Inter Process Communication Using PHP ,ZeroMQ AND React/ZMQ

push the external changes to existing web pages

The above diagram shows the any external php file or database layer changes has happen should be notify to all our web client. We can able to achieve this using React/ZMQ

Requirements

ZeroMQ

All Our client web pages will be listening to port 8080 for incoming WebSocket connections...but how will it also get updates from another PHP script or another server process event. Enter ZeroMQ. We could use raw sockets, like the ones Ratchet is built on, but ZeroMQ is a library that just makes sockets easier. install zmq

React/ZMQ

Ratchet is a WebSocket library built on top of a socket library called React. React handles connections and the raw I/O for Ratchet. In addition to React, which comes with Ratchet, we need another library that is part of the React suite: React/ZMQ. This library will bind ZeroMQ sockets to the Reactor core enabling us to handle both WebSockets and ZeroMQ sockets. To install, your composer.json file should look like this:

To Run the above application go to root directory "push" run below command to run the web socket connection on server side
php bin/push-server.php
Run the : "push\src\MyApp\clientwebpage.html" which connect to web socket listen to the specified category

Tuesday, July 12, 2016

configure php 5.x apache 2.4 windows 7



httpd.conf Edit



Download php-5.6.23-Win32-VC11-x86.zip from http://windows.php.net/download/ . Extract the zip file to c:\php.


Edit Apache’s config file, c:\Apache\conf\httpd.conf and add the following lines to the bottom of the file.

Method 1

  • LoadModule php5_module "c:/php/php5apache2_4.dll"
  • AddHandler application/x-httpd-php .php
  • PHPIniDir "c:/php"
  • Set the environment variable append this text : "c:/php"
  • Find Directory index and add index.php add below line
    • "DirectoryIndex index.html index.php"


save the conf file. Restart your Apache server.

Method 2

In this method we Configuring Apache to Use PHP as CGI on Windows Systems. which best suitable for Higher versions of php like (above php5.3 on Apache 2.2). we will configure below steps.


1. Assuming that your Apache server is installed at C:\Apache2.2

2. Assuming that your PHP engine is installed at c:/php/

3. Use "notepad" to open C:\Apache2.2\conf\httpd.conf

4. Go to alias_module section and define a script directory call /php/ as:


...
   ScriptAlias /php/ "c:/php/"
5. Add an access control section for this directory as:


    AllowOverride None
    Options None
    Order allow,deny
    Allow from all

6. Go to mime_module section and define a mime type as:


...  
    AddType application/x-httpd-php .php

7. At the root level below the LoadModule section, define an "Action" entry:

#LoadModule ssl_module modules/mod_ssl.so

Action application/x-httpd-php "/php/php-cgi.exe"
This "Action" entry tells Apache to run "php-cgi.exe" from the script directory "/php/" for any "application/x-httpd-php" mime files.

8. Restart your Apache server.

save the conf file. Restart your Apache server.

PHP INI Edit

Now we have to do a few edits to the php.ini file to tell it to load support for mysql and the location for the extensions. Since there is not a already set php.ini file we need to rename one of the two examples to php.ini.
Rename c:\php\php.ini-development to php.ini
Now let’s edit php.ini
Uncomment extension directory.
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "ext"

Uncomment mysql modules
extension=php_mysql.dll
extension=php_mysqli.dll

save the .ini file changes. Restart your Apache server.