Google Cloud Platform files location - php

I wanted to move a website from a shared server to Google Cloud but I cannot wrap my head around it. Before giving up completely, I decided to make this question:
I already completed the Hello World tutorial (https://cloud.google.com/php/getting-started/hello-world). But what if I want to update the index.html file? Where would I find it?
I was expecting to see it in one of the storage Buckets, but that's not the case... even when installing a Kubernetes Engine.

If you decide to use Google App Engine Flexible (as the hello world sample app that you linked to) you need to understand the idea of this additional layer of abstraction over your server(s). App Engine Flexible is designed to make things easier for you - you focus on your code in your local machine where you modify it, update it and then with one command (gcloud app deploy) you instruct the App Engine to do one of the following:
start a VM (your server) and a Docker container with your app in it
if it's not already running
in case you are updating an existing app, it will update the code in the VM which is your server. If your app receives a lot of traffic, you may have more than one container and VM running and all of them will get updated.
Both things are presented schematically in the image in this section.
This way you can develop your app locally and not worry about actually getting inside the server with for e.g. ssh. Your code is there in those VM(s) and App Engine manages it for you (however, if you really need to, it is still possible to ssh into the VM in App Engine Flex environment).
If you have a static website, it can be hosted in the Storage buckets, which is a different scenario. However, as you're using PHP I assume it's more likely that your website is dynamic.

Related

USB Key web server with protected php scripts

I just started to work for a new customer. He sell access to his Cloud App, written in PHP/MySQL. Recently he got an inquiry from two of his customers asking if he could install the tool locally.
Before doing so, he would like to ask one of his representative to perform a demonstration on site, and asked me if I could create a portable version of the app on USB Drive.
There's no issue with that, except he want the PHP Scripts to be protected/encrypted, so they could not be just copied over.
Do you know how I could manage to do this? Do I have to set up a virtual machine with protected contents? Should I use any existing tool allowing to protect things like that?

Google Compute Engine - PHP upload files to bucket

I created a Google Cloud Platform account, deployed the LAMP server, and logged in through SFTP and uploaded my existing site.
My site is currently running on another server, so I also uploaded all my databases and everything.
On my current server with hostgator I upload files to the /home/username/public_html/uploads folder, but on google you can upload to buckets. I figured I would use their Cloud Storage instead.
I tried doing a PHP move_uploaded_file() to the bucket: gs://mybucket/uploads; however, that's not working.
What's the trick? The only documentation I can find is using the App Engine, but I'm just using the Compute Engine with LAMP installed.
Also, which would be better? Should I stick with saving the uploads to the LAMP server, or should I use buckets?
Thanks!
You could use the json api directly:
https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload
There is also a PHP library for using the Google APIs in general:
https://developers.google.com/api-client-library/php/start/get_started
Then you could use that library to insert objects into your bucket with a call like this:
https://cloud.google.com/storage/docs/json_api/v1/objects/insert
If you're already running a LAMP stack, it's fine to serve files directly from the VM itself, using its local disk; you don't need to start using Google Cloud Storage for typical, simple use cases.
Google Cloud Storage, which is where the buckets terminology comes from, is useful for storing lots of files, or for serving a very large site, either for processing via Hadoop or for serving to a global audience. Because this involves more work on your part, this makes sense if your site is so popular that the cost of serving data directly from the VM is more expensive than using Google Cloud Storage.
However, Google Cloud Storage has much higher scalability than disks on a VM (though you can attach additional disks, you're limited to having up to 10TB of persistent disk per VM, and it's not an automatic process), but that depends whether your use case will need that much space.
Bottom line: if your site is working fine with the LAMP stack on your VM, it's fine to keep it. It's a good idea to keep track of your TCO so keep an eye on the cost of your compute, storage, and network traffic, and see at which point it may make sense to move some of your assets to Google Cloud Storage.
You can use Google Cloud Platform Pricing Calculator to estimate your costs, but also take a look at pricing for Google Compute Engine (which includes compute, storage, and networking) as well as Google Cloud Storage, and see how your particular use case will work out.

Is it possible to deploy PHP application on azure (WebApps) without using FTP?

Hi i have recently deploy my PHP(5.4) application to windows azure i.e.Web Apps.For that purpose I have used FTP to transfer my local files to azure.
Is there is any wayout so that I can just click and publish my PHP application to Azure like what we do in .net VS application (Right click publish) ?
As others have mentioned in comments, there are several continuous-integration sources for deployment. Assuming you're using the new portal (portal.azure.com), just pull up your web app and scroll down below Essentials. Near the bottom, you'll see the area about continuous deployments. If you haven't set it up yet, you'll see something asking you to set it up. Click, and then choose your source:
Once you set this up, you should be able to manage your deployments by simply pushing code to your repository.

Extraction of connection string from web config using web service

I have this tricky scenario and want so advice to you. My client have a website built in WordPress and a web application that was built in .Net 3.5 now they want me to integrate this too site by querying some information from the database that .Net is using and display the output on the said website.
Communication between the two site is complete and working fine using some DLL for PHP to integrate to MSSQL now the problem arises here, my don't want to expose he connection string on the website built on WordPress for security reason. Without this, I can't connect to the database and made some query so I propose some bright idea, using a web service to extract connection string from the web config of ASP.Net web application. Consuming of web service to PHP is working fine but the last issue is that the web service is expose in public. what I mean once the site launch online, the said web service is open to public and anyone can see thru the web config that my boss want to keep in secret (hehehe).
I'm already confuse on how to make the web service to be more secure. Below are some specification of the two websites.
WordPress Site
PHP based
Mysql
installed with php_pdo_sqlsrv_53_ts_vc9.dll and php_sqlsrv_53_ts_vc9.dll
nusoap (use to consume ASP.Net webservice)
Mysql for database using by WordPress
.Net Site
web service to extract connection string from web config
web reference added
MSSQL for database
Please let me know if you need more information regarding my problem.
TIA
you don't have to setup a web service for this. Just store the connection string in a php file outside of your web servers root directory (probably public_html) and then include that file within you plugin. You should hard-code the path, so that people with access to the setting can't use that functionality to spy on other files. Also make sure the web server service account has read access to that file.
That is a pretty safe setup as the file can't be directly accessed through the web.

moving PHP MySQL web app offline

I recently built a web application for my company, and now they want it to support an offline mode. To complicate things, my company is very concerned about security and does not want me to use Xampp or Mamp. The application handles sensitive data and they think these programs will somehow make the data visible to the outside world (although I'm entirely sure this would be the case).
Anyways, I'm looking for a way to allow my application to run offline, and to also support the following technologies: PHP, MySQL, jQuery. The most difficult part of this is I need to execute PHP code outside of the typical server environment.
Can anyone please give me some advice on how I could implement such a system, and any associated vulnerabilities that I may face in terms of security and data storage?
Assuming you're installing this for an individual user on their machine - your best bet is to install apache/php/mysql, and configure apache to reject connections from any remote IP address.
The environment should be basically identical to your current application, but with only 1 user in the system.
There are some strange points in your question
now they want it to support an offline mode
Well, that's easy enough - get familiar with html5's offline features
To complicate things, my company is very concerned about security and does not want me to use Xampp or Mamp
Have you deployed your web app on a desktop machine? Or do you mean you are forbidden to use a webserver?? Xampp/Mamp are development tools - your public facing applications should be on a machine configured specifically for that purpose with a webserver running apache/nginx/iis/PHP5.4-builtin/whatever you like.
The most difficult part of this is I need to execute PHP code outside of the typical server environment.
How is your environment none-typical? Mike mentions php-gtk - but IMO you shouldn't go down that route unless you're requirements are "desktop app" + "absolutely must be written in php" - which is unclear from your question.
any associated vulnerabilities that I may face in terms of security and data storage
Well, anything you put in local-storage on a client (browser) the user can access - just bear that in mind. Don't send sensitive data to what is, from your perspective, an insecure and pseudo-public location i.e. some user's browser cache.
If you want to run html/javascript, you will probably need to run this in a server/client environment because a browser isn't capable of running the php and the php app as a stand alone app needs something to parse the html/css/javascript ( it needs the browser for it's presentation view ).
Best course of action is to put the application onto a server that you control access to. Set the access controls to specific IP addresses only, or even better if you can run it off an intranet behind a firewall where no one outside the network would be able to get to it.
PHP can run on a desktop environment, but they key here is that it won't run the javascript/html you use to display. You could use php with a third party library like php-gtk to make a desktop app that doesn't need a server or browser, but php-gtk doesn't have the best support.
If the application needs to store data for other computers/users to access, then it needs to be on a network. If it doesn't need to do this you might consider using a different programming language geared toward desktop applications so you can keep it entirely offline ( such a java or .NET ).

Categories