cron url setup on Ms azure - php

I am using microsoft azure as a hosting.It is using Microsoft-IIS/8.0 server for running my Codeigniter website.
How can I setup my website few url's as a cron?

Per my understanding, you want to leverage an Azure Service or feature to make your several Url endpoints as schedule jobs.
You can leverage Azure Scheduler to achieve your requirement. For step by step guide, please refer to https://learn.microsoft.com/en-us/azure/scheduler/scheduler-get-started-portal.
Additionally, if you want to make your internal PHP scripts as schedule jobs, you can leverage App Services' build-in feature, WebJobs. For more info, please refer to https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-create-web-jobs#a-namecreatescheduledacreate-a-scheduled-webjob-using-the-azure-scheduler.
Any further concern or if I have any misunderstanding, please feel free to let me know.

Related

Azure portal Web Service PHP Monitoring

I wrote a simple Application in HTML with a form. I submit the form into a PHP file and insert the data into a database.
I created an App Service on Azure Portal + MySQL database
It took me a while to get the git Pipeline going (So Git - Azure Portal - deploying into a Webservice)
If I submit my form, the data will go to the database just fine.
Now I wanted to extend everything with a monitoring tool. So I tried Application Insights. But unfortunately, that doesn't work. If I understand it correctly it's because of the PHP file or to be exact the Php Stackruntime on Azure.
Is it possible to the monitoring anyway somehow? I only have experience in Php and Html a little bit of Java and Javascript.
Thanks.
I have deployed sample PHP App to Azure App Service.
So I tried Application Insights. But unfortunately, that doesn't work.
I have checked with both PHP 8.0 and 8.1 runtime version. The Application Insights option is disabled for PHP.
Thanks #Dmitry-Matveev for the Application Insights SDK.
Is it possible to the monitoring anyway somehow?
Check the below steps to Monitor Azure PHP App Service.
Way 1:
Check the Logs under Monitoring.
Way 2:
Enable Application logging (File System).
Navigate to the Log stream to check the Live metrics.
Also, we can check the metrics section to monitor the App.

Managing the Azure Windows through PHP SDk

I am trying to configure the php sdk for managing the azure instance to perform basic operations like starting or stopping a VM,getting the IP of running VM,etc.I tried searching but didnt find any document.Is there any document available ? Also how to establish client session for the same ?
As far as I know, there is no SDK for PHP we can use to manage Azure VM at the present time. The REST Management API is the one you want to go for.
Reference:
Virtual Machines REST API

Deploying Azure Cloud Service on a Schedule

I want to host an Azure Website and I need to run a PHP script on the site every hour. Usually I would do something like this using cron jobs. Is Azure WebJobs via Azure Scheduler the only option to accomplish this?
Using PHP or a REST API via PHP cURL, how do I create and deploy an Azure cloud service worker role to run some back-end PHP software independent of the website?
How would pricing work for the cloud service? Would I only be paying while it is deployed, or would I be paying when it is created also? E.g. Could I create the service via Azure portal and deploy via PHP to get same pricing with less coding?
How do I stop a cloud service once it is done processing?
You can use the Azure WebJobs under the website as you pointed out. You can also use the Azure scheduler direct and have it fire a call to another website or even an external system somewhere to kick something off. There is also a scheduler in the Azure Marketplace you could look at. Another option is the Azure Automation, which allows you to run a script separate from a web site or other deployment, though is PowerShell.
You can create deployments using the Azure Management REST API. Here is some documentation on how to use the API from PHP. As for running this independent from the website, you'd either need to run this from an external system, or from a VM running within Azure.
You pay for the Cloud Service from time it starts its deployment until the deployment is deleted. You pay only when something is deployed to the Cloud Service. If you create a cloud service via the portal or script, but don't deploy anything, then you aren't charged anything. When you deploy something into the cloud service you will be charged for as long as the deployment is there.
Based on this question I'm assuming you mean the cloud service is some sort of back end processing. You could have the cloud service use the management api to shut itself down, but that would require that the management certificate be deployed with the cloud service, which some people don't like to do for security reasons. Other folks would have the worker roles push messages to an external system, or another service running in Azure, to say that they are done and it would then reach out and shut them down. There are really several options here depending on if you want it all managed in the cloud or have resources elsewhere that would perform the shutdown. The link to the management APIs above will give you "how to" shut them down, but the decision on what does that is really pretty open.

Running PHP on Windows Azure

I have a Windows Azure subscription.
My requirement is to run a PHP script on my server. This PHP script will create a JSON file.
This JSON file will be downloaded by my iOS app. (Some kind of authentication is an added bonus)
How would I go about doing this? Should I create a "Mobile Service" or should I create a "Website" or something else like "Cloud Services"?
As far as I have researched, I think the only way to do this would be the old school website way. Any input on this will be really helpful. Thanks.
Mobile services are great if you want to create a quick CRUD layer for an app with a backend cloud storage such as Azure SQL DB. It also provides support for scheduled tasks and push notification. But for what you're after (producing a JSON file), you may find it easier to go with Azure Web Sites or Azure Cloud Services (PaaS). Azure Web Sites has a model that you'll likely find easier and with the free/shared tiers, provides a lower cost point for many models. If you want something that gives you a bit more control, then Cloud Services might be a good alternative as well. But given the simple example you've provided, you should be able to accomplish this fairly quickly using Web Sites.

Plesk DNS Management from PHP Script?

Our company currently offers free sub-domains for redirects to our customers. These are quite a popular feature, but unfortunately every time someone requests it, our staff must login to the Plesk panel and manually create this. It is only specifying the DNS name and an IP Address for the A-Record, but it would be great to be able to automate this in our Billing System for easy creation.
As I am not overly familiar with Plesk, does anyone know how I may be able to proceed with handling the creation of an A-Record in our Plesk install via PHP?
you can use the commandline interface or directly using the rpc api of plesk. see http://www.parallels.com/ptn/documentation/plesk/ for more information.
for commandline this seems simple enough:
http://download1.parallels.com/Plesk/PP10/10.1.1/Doc/en-US/online/plesk-unix-cli/37771.htm
As per my knowladge, Plesk is an interface for interacting and Managbe your web server settings. But It don't provide free api for doing stuff you have asked for.
You can use RPC API for the same. But that works using command prompt.
I am sure that would be bit complex to do.

Categories