Hey Friends
how can i develop an app which work in php.exe in my php folder and i need to know can i develop an app which will work continuously using this function and able to work it on my CPanel?
EDIT
what i mean is,a principle one of my friend said to me to develop an page which is having a timer in it,in every 5 min it will check in a rss page for looking is there any change or new item is added or not?if we develop some thing like this it is difficult for us to work the php program again and again right??so i need some thing like that, and i need help in that
If you'er trying to develop a gui app, you might want to have a look at winbinder or php-gtk.
Ig you're asking how to write a program....then the answer is a bit long to include here.
You can develop a PHP app that runs on the command line (launched by php.exe). This way, you will not have a restriction on the running time. But it will not be integrated in CPanel.
I have to admit I probably didnt understand the question completly, so my answer is probably a bit off ...
Edit:
After your update, it seems that what you need is a cron/scheduler job. The cron job will call your script at intervals you specify. Google: PHP cron jobs.
If you mean periodically by "work continuously" you can use cron jobs (or windows scheduler). If you mean really continuosly, you should build an app with service/daemon functionality. As friends here already pointed out, it's a bit lenghty to fit in this edit box.
Related
I want to be able to use Steemconnect on a web-app I built using PHP/MYSQL/APACHE.
This question (well, the answers) says to do this you should be running Node.js on a subdomain.
Node.js Server running from a sub folder
My question is, will this work for steemconnect? I can potentially point the callback to the main URL of the app. Would this work?
Or is there a better option to make this work in a PHP app (App uses jQuery and MySQL)?
Note: Steemconnect v2 has been merged (there is only one steemconnect now, not 2 versions) so that is what I am using.
For reference, the app needs to be able to have users sign in to their Steemit account and post comments to their account (blog), that is all.
Thanks!!
The answer is to simply be able to run packages installed by NPM in your application. There is no real difference to being able to do this and running then in node.js.
I tried requireJS, which gave me errors, then browserify, which worked perfectly.
I hope this helps someone out there!!
I'm just curious about how these websites now a days can create an android apk? i mean what logic is behind it? is it possible that you can compile a code in PHP or is there something else?
e.g. for websites that can generate android apps
http://www.appsgeyser.com/
http://ibuildapp.com/
So just as a student, its killing me to know what they do for it?
Thanks
Nowerdays with the gradle build system that is not too hard. You just need to execute on the commandline gradlew aR and some minutes later you have a brand new apk file.
shell_exec('./gradlew aR');
That should do it's job but keep in mind that this can take some minutes.
A better way would be to queue that job in a database and execute the creation with a cronjob. That would be more secure.
They invoke the Android build tools on automatically generated code to produce the APK.
In fact, they do exactly what you would do to produce an APK, except that some of the code and resources are pre-built (and the same for every application), and whereas you would use Eclipse or Android Studio to compile the code, they are using scripts to so the same thing that the IDE would do.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Making a distribultable standalone program in PHP
I don't know how to explain my idea...let me explain it by example....
Typically, I can have an application on the client side, when I launch it, it runs, until I close the application. Many desktop application works like that, right? But an application on php server is different, it only start processing when the user make request.... ....
So, my question is, can I make the php program become something like the desktop application, when I start it, it launch, until I kill the program, (for example, when I launch the application, it keeps pinging the google.com, until I stop the application.), doesn't need the user make request to "active" the program... Thank you.
If you have regular stuff to do, it usually done by cron ( http://en.wikipedia.org/wiki/Cron ), which invokes your script to run on the server.
If you want to start it from a command line, and want to do stuff again-and-again, you can write a while loop like
while($end==1) { do(); sleep(100); }
If you want to do a desktop application (which runs on the client, rather than the server), you can use: PHP-GTK http://gtk.php.net/manual/en/tutorials.php
If yours not one of the cases, please clarify.
What you are describing sounds like a daemon process, not a standalone application.
This is possible in PHP, the functionality is included in PEAR's System_Daemon package.
See this tutorial: http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/
The question is very easy, I want to execute several php files every "N" minutes. For example:
every N minutes
{
execute(script1.php)
execute(script2.php)
execute(script3.php)
}
I know about crontab but i was trying to find another solution. Any suggestions? Thanks in advance.
Using a Cron job is the usual solution. Can you explain why you don't want to use CRON? I've also seen libraries that add cron-like features to your system. For example in the Java/Groovy/Grails world there's the Quartz library/plugin. A quick Google search yielded a PHP library called phpJobScheduler that seems similar to Quartz. I have never used phpJobScheduler so I can't vouch for it.
I'd be interested in why you don't want to use crontabs for this? Are you going to be the primary web operations person running this server or will you be relying on an existing sysop team? You may want to get their input since they are the ones who will be most impacted by what method you choose. I've found they tend to be fond of cron for simple scheduling.
On windows I used built-in proggie called Task Scheduler. As for linux, yes, cron jobs is your answer.
You could create a php script to loop forever do X every N minutes and run the command with a & to make it a background process.
/path/to/php /home/user/bgscript.php &
If you want it to always run, you'd then have to add it to startup init.d or services depending on flavor of *nix.
This solution is possible but personally I would highly recommend going with crontab, its established, proven and works well! Why are you avoiding it?
You could build a script and let it run as a daemon and perform certain tasks on a set interval, but that's actually just simulating cron ... and if you have the ability to run a php script as a daemon you should really also be able to run it as a cronjob since that's what crons are made for.
If you need more info on how to run a php script as a daemon read this great intro. There is also a great comparison between daemon and cron inthere, worth the read.
Is it possible to use Python (specifically Pygments) with PHP? Currently, I have a phpBB forum that I'm developing for and JS Syntax Highlighters just haven't been working for me. There's already a GeSHI mod, but I want to develop something myself just for experience.
Also, would there be performance issues?
There is now a library for this at:
http://derek.simkowiak.net/pygments-for-php/
Pretty much the only way to perform that integration (with PHP as the dominant language) is to shell out. This means starting python manually every time you need it.
That can be a little slow if you need to do it a lot. You can mitigate this by creating the syntax hilite when posts are created or edited, not when viewing.
If you're interested in diving into Python, you could write an external script or server application to update new posts with syntax-highlighted code. If it were me, I'd retain the original code in one database column and place the syntax-highlighted version in another.
A simple script to update new posts in batches could run as a cron job at whatever interval you find ideal.
To support a near real-time scenario, you could write a server application that sits and waits to be notified of new posts one at a time. For example, upon processing a new post, the PHP application could send the highlighting application a message through an AMQP queue.