centralize PHP code and MySQL data [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I currently have a dedicated server and I'm looking to set up a MySQL database, PHP query code and images directory that can be used by multiple sites. A majority of the sites will be hosted on the same machine, but some will not. My simple way of thinking is that this is possible similar to how Roundcube's code and database is centralized.
Looking for some expert input and direction on whether or not it is this simple or if there is a better way of accomplishing this.

In my opinion, you could two a couple of things to improve your situation:
store your images in just one place, and use that place as a CDN to deliver contents across your sites;
About your code:
if it's possible, use packages in order to create a single package for all the "common" code;
use this package on every site that needs that code, as a simple dependency. Tools like Composer are great to handle dependency management;
No big problems with MySQL databases unless you have big traffic numbers. In that case, you should study MySQL scaling. But first of all, focus on PHP and common assets (like images).
EDIT:
be sure to set appropriate permissions for the external sites, of course;
using packages for your dependencies will be very useful also for sites placed outside the dedicated server;

Related

Best way to implement my own storage service? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Let's say I want to implement storage server, which would be used as a place to store files, images, etc. from different websites. Something like S3, but only for my projects.
I thought about some API/Gateway on PHP, which would save files from those websites to appropriate server, but is it a good way? And should I use Webdav or maybe NFS/SMB, which protocol is more secure and fast?
Can you please give me advice how to create my own storage server? Especially I want to hear about appropriate stack for that, thank you.
There are a number of projects for building your own NAS or SAN (I think that is what you're looking for). Look at the FreeNAS project for example. It does require quite a bit of memory though (depending on the size of your storage and the demands you put on it).
When you want to build your own NAS, you will not need very powerful CPU's, unless you want to run apps on the NAS (FreeNAS provides a system for runnning containerized applications on the NAS, using it's storage) but you will need memory and of course plenty of disks, again depending on what your exact requirements are.
However, if you're simply looking for a place to store your own files and they are not extremely large or a huge number of files, then you could simply build a Linux server and push (or pull) the files using SFTP, it only uses OpenSSH and a single port, fully encrypted with minimal overhead.

Pure (dynamic) HTML5-website with Backend [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Couldn't find anything about this online so I'm giving it a try here. (Not sure what to look for in google so maybe that's why I couldn't find it).
My client wants (for some strange reason) a dynamic, pure HTML5-website with no PHP at all. The webpages can be created with PHP, but after he is done, he wants it to (automatically) generate HTML5-webpages so these can be put online on a server with no PHP.
Is this at all even possible? Writing an API myself that gets the content from the server and converts it to HTML5 is not really an option due to time ...
Thanks
FYI: If what you want is a Single Page Application, you're asking the wrong question.
Seems like what your client wants is a pure HTML site because he might have the idea that pure HTML sites are better for SEO.
What do to?
Alternative 1:
Create a different server to generate pages. Either local (with vagrant) or in another remote server. Have your content generated there by using a CMS of your choice.
Periodically generate a mirror of your site using a tool like HTTrack or wget. Hand this mirror to your client.
Alternative 2:
Use a static site generator like Jekyll. Have the server run a cron task to automatically generate HTML from the changes.
Alternative 3:
Be the expert and explain to him that his ideas are probably unfounded.
Yes, you could use the HTML5 Filesystem API and Javascript to read/write from a JSON file as a backend. It's definitely not ideal, but it would satisfy your requirements.

What to include in software metric calculation on laravel project? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Laravel project contain a lot of files and folder.
When we are calculating the Software Metric, should we include them all?
I am using phpmetric but it ignored the vendor folder.
But when I use phpdepend , it included that folder.
Thanks.
It depends on what you're measuring, which is why there's no one answer and similar tools may, or may not, include the vendor folder.
If you're interested in the analyzing your own project, then you'll want to point these tools at files you'll be editing. In Laravel 5 that mostly means the app folder -- but you might want to include config and bootstrap, as user created code often finds its ways in those folders.
A reason you might point it at vendor is if you were concerned about the direction a particular code library you use is going, and wanted to measure it over time.
Hope that helps!
vendors (external code) is not important for you. When you measure your project, you should measure YOUR code only:
vendors are already tested / measured in their own repository
if you include external librairies, you don't measure your work
your should exclude generated files (cache...). They are not representative of your work
you should exclude test files : they do not obey the same quality rules
If you want to get information about a particular code library you use, you can check the Github repository of this library. There is a list of PhpMetrics representations of main PHP projects, you can also keep on eye on it.

Web based software to queue/reserve machines for use [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm in need of some sort of software based way to reserve the use of a couple machines. There about 5 different machines used in a lab that are shared among everybody but people need to schedule the days/times they want to use these machines. This is currently handled with pen/paper and you need to physically walk place to place to see when they're free and available for sign-up. I've been tasked with moving this system to a private webserver that currently runs an installation of mediawiki.
I've looked for extensions for mediawiki itself, but I couldn't find any kind of scheduler/planner/queue system that is premade that allows users to reserve a time frame/day to use machine. Additionally it would be nice if anyone could sign up but users were restricted from removing others from the queue(which is why a traditional calendar software with the honor system wouldn't exactly work). The solution doesn't need to be embedded within medawiki itself but must be able to be hosted off of a webserver, do you guys have any suggestions on how I can approach this? The best I can come up with is to buckle down and write my own php/django based site to handle this(I'm not very experienced with either). While I do have time I want to make sure there isn't something available I missed before dedicating my time to writing a custom application, and would appreciate anyone who could help.
While I've not used this:
phpscheduleit

Is it possible to upload PHP files to blogspot? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am trying to create a blog using blogspot. It seems it is not possible to upload anything other than image files to blogspot. I want to upload a PHP file. I managed to upload the file to google sites, but it is coming as downloadable there instead of executing.
Is there a work-around here other than buying my own server space?
Is there a work-around here other than buying my own server space?
Nope. You can upload PHP files to those services all you want, but you'll never have them executed.
Buying your own server space is usually the best way to go.
There are free hosting offers around but I know of none that is any good, except maybe for the Google App Engine that is free up to a (very generous) traffic limit, in combination with Quercus. That, however, is a very specialized solution, going to be a lot of work to even get started with, doesn't support all modules of PHP, and something rather for professional applications.
But you could simply pay some cheap hosting for PHP, and move your stuff to wordpress.
There's hundred of hostings out there for as low as $1.99 a month, and with that you can host as many PHP files as you like.
Alternatively, you could stick to blogspot, and when you want to use PHP, you can just link to your other server (the one hosting PHP).

Categories