IBM PHP instance php buildpack for max number of request - php

I'm using a PHP instance within IBM Bluemix.
Now we are posting raw data from about 200 external devices to a PHP instance.
This rawdata is small (1 or 2 KB), but it sends every 4 to 5 seconds.
If I'm using the standard PHP buildpack, I see that the webpage sometimes won't respond. (It looks like it is waiting for a free client connection.)
Could anybody tell me which PHP buildpack is the best buildpack for using in PHP instance?

The PHP instance within IBM Bluemix is the opensource cloudfoundry php-buildpack buildpack. You can try the current version of the buildpack to see if your issue is resolved. For example if you would like to use the latest version you can push your app with:
cf push yourAppName -b https://github.com/cloudfoundry/php-buildpack.git
If you need further help please include code examples, logs and anything else that can help with debugging your issue.

Assuming that the problem is related to the used buildpack, you could take a look at Heroku buildpack: PHP. It uses Composer for dependency management, supports PHP or HHVM (experimental) as runtimes, and offers a choice of Apache2 or Nginx web servers.
You could try this buildpack as an alternative to the default one. I suggest you to test both the web servers to see if you notice different performances with the load spikes.
If the problem persists I think you should do a deeper performance investigation. You could also use one of the services provided by Bluemix in the DevOps catalog.

Related

Php java bridge Error : the procedure entry point php set error handling could not be located in dynamic link library C:\xampp\php\ext\php_java.dll

Integrating PHP java bridge, facing some issue while restarting Apache server as showing error:
The procedure entry point php set error handling could not be located in dynamic link library C:\xampp\php\ext\php_java.dll
I made the changes outlined below in my php.ini file and copied JavaBridge.jar and php_java.dll in C:\xampp\php\ext.
extension=php_java.dll
[java]
java.java_home = "C:\Program Files\Java\jdk1.8.0_131\bin"
java.java = "C:\Program Files\Java\jdk1.8.0_131\bin\javaw.exe"
java.class.path = "C:\xampp\php\ext\JavaBridge.jar"
java.library.path = "C:\xampp\php\ext"
java.log_level =2
Specific to your question:
First of all, the javabridge communication is not handled anymore by a php extension (I mean the php_java.dll or java.so).
So you simply don't need it, you can completly remove the "extension=php_java.dll" as this has been replaced by a pure php implementation known as the Java.inc client (or alternatively the soluble-japha client).
I believe you use a very old documentation... So don't spend too much time in this direction because you'll probably won't have support.
But if you want to work with the javabridge, just remember you'll have to install both:
a Java server that will expose the Java virtual machine on a network port (standalone or deployed on Tomcat)
a PHP client library on the PHP side that will establish communication with the server (Java.inc or soluble-japha)
I suggest you to read the docs on the official php-java-bridge website to get some insights about installation (or alternatively some docs for the unofficial soluble-japha project, they work pretty much the same way).
And first ensure, the php-java-bridge server is sucessfully running. The php-java-bridge files can be downloaded either:
Option 1: The war file (tomcat only) is here
Option 2: Individual files for cli/standalone server are here
Once it works, try to connect from PHP.
You'll probably face a lot of problems at first run, but from there it will be easier to answer your questions.
Good luck

Ratchet & Websockets - Can not get anything working

So I am fairly new to PHP and websockets and server management in general. But have been tasked with designing a web-app and have determined that the best way to implement this is with websockets. So I found ratchet. And began trying to get it to work. I have a linuxbox with apache already setup, and created a new directory in the webroot and began Ratchet's tutorial. However no matter what I did I could not get even the in-line telnet part working.
I have a composer.phar, I have their script within my composer.json, I followed their instructions for installing ratchet. however when I run the php chat_server.php command it doesn't seem to do anything. The tutorial states that it should take control of the console, and as I saw in a video tutorial it does.
So my ultimate question is - what is causing this not to run properly? Is it a bad installation (Did I mess up installing somewhere or just not install something that is required but was not explicitly stated?) all the code is identical to what is documented here http://socketo.me/docs/hello-world
Some questions when ratchet is not functioning while setting it up.
Is the php process (#php chat_server.php) open?
Are you telnetting from another cli?
can you check if the port on which the chat server should be running is allocated?(#netstat -pln)
Is the zmq library added to the apache modules? (Probably your problem)
If the above aren't working you might try to check if some firewall is blocking the connection internally.
I would suggest starting from a clean machine to execute all set up steps.

Using Redis, Predis with my php application

As I was developing a php app I realised that my app is slow in terms of processing large sets of data in the catche. Decided to do something about it and went on to google to find some sort of solution or at least suggestions.
I came across Redis, after reading about it I would realy like to give it a go and test it out as it looks promising,
But I also stumbled into predis and phpredis, and thats when I begun to get confused. From what I understand i need predis or phpredis with my php app, but then where do I use Redis....? how should I build my stack...?
Redis->predis->php
Do I have to install both Redis and Predis/phpredis within my PHP directory in eg. lib dir..?
Also is there any significant difference between Redis and Phpredis
Redis is a standalone caching application: http://redis.io/ (plenty of documentation on how to install)
predis is a library for interacting with a running Redis application easily from within php. Phpredis is similar but requires compiling.
You can think of it like MySql and PHP. MySql is it's own application that you are able to communicate with via a PHP extension, MySql itself is not a part of PHP.
Your stack could be (apache / php5.3 / mysql / redis) with just the predis library.
You can run redis either on the same server or a different server, it's up to you.
Redis is a server that runs independently from your application (i.e. PHP) code. You can download it from here.
To talk to Redis, your application can do one of the following:
Implement Redis' protocol, i.e. RESP
Use a client library
Most people go for option 2, which in PHP's case your options would be predis, phpredis or any of the other clients in the clients page or others that are unlisted by you can find in GitHub.

How can I access a Lotus Notes Database from PHP5

I would like to access our Domino Databases from php.
My php5 is running in an Linux environment OpenSuse and for development Debian based System. Domino Server 8.5.1 is also running on a OpenSuse Server.
Currently I'am accessing the Databases via parsing the web pages from Notes, but that is a horrible way to do that.
Are there any ways or ideas to access Notes an more comfortable way?
Yes, there are plenty of ways. You can use Domino Designer to write a web service on the Domino server to expose the data that you want, and access the service that from your PHP code. You can use REST APIs if your Domino server can be upgraded to 8.5.3 or higher. You might be able to install Domino on your OpenSuse server and have your PHP code invoke Java programs that use the Notes classes in Notes.jar to do the work, or you can actually do that without installing Domino, but you'll have to use the remote version of the classes in NCSO.jar and your server will have to enable CORBA. You can use ODBC and NotesSQL as discussed here. I'm listing that last even though you did put an ODBC tag on your question because Notes databases are not relational and I find thinking of them that way to be too limiting, but if your data fits a relational model and you're comfortable with it, then it might be your best choice.
What Richard said, except I would start with this link for REST APIs. That takes you to the latest product documentation. Richard's link takes you to a slightly outdated page on OpenNTF.

Setting up new relic on Heroku PHP

I have a PHP app on Heroku that keeps giving an Application Error randomly, and the logs don't say anything at all. I can't be sure but it seems that the error comes when 6-8 concurrent users hit the app. To figure this out, I thought of installing the New Relic Add On, and I have been trying to follow the document here - https://rpm.newrelic.com/accounts/343400/applications/setup.
Please excuse my limited knowledge, but it seems that the instructions given here are supposed to be run on an actual server ? How can I run them for my Heroku server ? I use a windows machine. I have installed wget for windows, but then apt, deb ?
There are other discussions about this where people have mentioned that new relic is not supported on Heroku, but those are at least an year old. And Heroku is providing New Relic as an Add On.
Can anyone please help...
As of September 2014, New Relic PHP does support running on Heroku using the official Heroku PHP buildpack.
See:
New Relic documentation
Heroku documentation
New Relic does not officially support our PHP agent on Heroku. Here's the current list of supported languages:
https://devcenter.heroku.com/articles/newrelic#supported-languages-and-frameworks
The setup requires the installation of a PHP extension and a local proxy daemon, which tends to require a bit more access to the app server. If you have any tips, please share them here -- just keep in mind that we cannot support it.
At the moment, PHP on Heroku is unsupported by New Relic. See this SO question for more: Deploying New Relic on Heroku Cedar (PHP)
I can't really give you an answer on this because we are currently in testing phase so we don't have concurrent users yet.
If you are using the official php buildpack from Heroku (if you've never heard of a buildpack you probably are) it's probably best that you ask their support as it might be a bug on their side. If you're using your own buildpack you can find an example of a working Heroku/PHP/Newrelic buildpack here:
https://github.com/iphoting/heroku-buildpack-php-tyler
We haven't experienced the same problem with the above buildpack.

Categories