Protect my PHP App - php

I have developed an app and its written in PHP (with a bunch of SQL scripts), this app will be used by a few small companies. For them to use it, I will have to install Apache and SQL Server for them.
Every method I have thought has fallen short of what I need. I was actually just hoping to use ZendGuard or IonCube but they don't support PHP 5.3.x.
Is there a simpler method where I can maybe store a key in the database and make the app run only when it knows its on that server?
Maybe create a key based on some random numbers/letters and the machine name, sql server host name and encode/decode this when ever the system is in use?
Thanks all for any help or ideas

Even if Zend and Ioncube don't support PHP 5.3 code (which I find hard to believe!! Are you sure?), I'm sure they will in the foreseeable future.
I think it's worth asking them when they are going to introduce support for it.
Update: It indeed seems true: Zend but then, the question is, does your software really need 5.3 (i.e. use 5.3 specific features like namespaces and such?)

Related

migrating wordpress plugin from php 5 to 7

We've been using a Wordpress plugin called abase, to create on-the-fly forms and access MySQL tables directly. It's very easy to use for both the developer (minimal pseudo coding) and to the end-user. We'd very much like to keep using it in the long run, since it solves all our problems. But there is an issue. The developer no longer supports it and is stuck in PHP 5 code. So if I bring PHP to any version of 7, it breaks completely.
My IT headquarters require all servers to be on 7.3 or higher since there are security vulnerabilities with PHP 5.
Right now I have these options:
Try to find a way to migrate the script, although I think it'll be very difficult since the original developer is not available. I'm far from a PHP expert
Look for a replacement script, although I've done that already and haven't found a suitable script yet
Since is a server that is not pointing to the outside, maybe talk with IT and ask them to let me run PHP 5 on this server
So, what would you recommend? Are you aware of a similar plugin or maybe a script that I can use to replace it?
This is the plugin source: https://github.com/wp-plugins/abase

I'm trying to build a web app for a class project but I don't know if I should use PHP7 Non Thread Safe or Thread Safe?

I am a complete noob at actual programming, I only know python but I'd prefer not to use that to program. I would like to use PHP7+ and Typescript with Angular 2+ (I read online that these are good to use). However, I have no idea how I would connect them all. Or which version of each program to use. My web app is supposed to have 3 different types of logins, employer, employee and customer login which will all have different levels of authorisation. a bit like admin and normal. I also want graphs to be generated and questions from a database to be generated. I am honestly stuck, I've never done anything like this before but I guess everyone needs a starting point.
Also if you there are better programs I should use please let me know. I don't really know what programs are best for this type of task
A thread-safe (TS) version should be used if you install PHP as an Apache module, as a worker MPM (multi-processing model).
The non-thread safe (NTS) version should be used if you install PHP as a CGI binary.
Moreover, using thread-safe version here degrade the performance due to unnecessary checks for thread safety, but you wouldn't notice the time difference as it will be in microseconds, until you are running a tons of scripts simultaneously.
If you are using Servers like IIS & NGINX, then you do not need thread safe versions.

SQLite support for PHP 4.2.3

i wonder, is there a way to work with SQLite on PHP version 4.2.3 ?
if you say i must update my php version, no i can't simply update my PHP version.
the system already have database, but i can't change that database it's not my authority though i can view, edit, or do anything to that database.
so i think maybe it's easier if i use my own sqlite database and make my own function to deal with the sqlite database, but i don't know if it supported by PHP version 4.2.3
thanks, any suggestion would be a great lift.
For what I found, yes, is possible to have sqlite under php4.
http://www.phpbuilder.com/columns/farell20040824.php3?page=1
http://polarwebservices.com/hostingblog/?p=6
http://forums.cpanel.net/f5/howto-install-sqlite-php4-servers-59201.html
And the source code of the sqlite extension is here: http://pecl.php.net/package/SQLite
Keep in mind is no longer supported, and is sqlite2 instead of sqlite3.
But if you are still using php4 on this year, I don't think you would really mind using an old sqlite, right? :P
By the way, IMHO, if that application makes you money, I think you should at least spend some time updating it.
I'm faced with a similar situation being stuck with PHP4. And I know where you're coming from (switching is much easier said than done specially if it's your own money you're spending).
But it's not the end of the world. Like you I needed to integrate newer technologies to my app. So what I did was instead to run 2 PHP versions along-side each other and created an API that I access via curl from PHP4.
That's the simplest approach I can think of. Hope that helps. I feel you man hehehe...

Finding exact requirements for a php application

I am developing a php application which my customers will download and install on their own servers. I know the base requirements for my application (like min. php version) but is there a way to generate a list of requirements that needed to run my application on windows or unix systems?
Thanks.
You mean, generate a list of requirements based on an analysis of your source code?
While in theory, that might be possible, I don't think such a solution exists. I think there is no way than analyzing your code by hand, with the PHP manual very close by.
Do you use GD? Then you need PHP with the GD module. Do you need to create GIF images with GD? Then you need GD, but not between versions 1.6 and (I think) 1.8. Do you use PDO? Then you need PHP > 5.1.0. And so on and so on.
In short, I'm afraid think this is going to be a manual process. Manual also as in "PHP manual" - the User Contributed Notes to each function and method are a gem, and any common cross-platform problems are usually noted there somewhere.
While you can trust that PHP x.y.z has a defined set of functions and behaviour, be sure to test well before you declare something suitable to run on a different server. IIS's support of PHP is way better now, I'm told, but the last time a ported a big PHP application over to IIS, it took me three days to work around all the mysterious bugs.
Just be aware of what you are using. For example, you should clearly communicate if you need something like .. a special database binding ( other then mysql ), xml libraries etc.., or even better, create an installer that is bundled with your software that checks that kind of stuff.
Other than that, there should be no problems concerning different servers ( apache / iis / fastcgi.. ). So to answer your question: you have to generate that list all by yourself.
As others have said, you'll need to manually keep track of special libraries and functions you're using. If you need PHP4 compatibility then you won't be able to use the built-in XML libraries for example. You can also check the list of functions added to PHP 5.
One thing I would recommend is installing WampServer if you have access to a Windows machine. Aside from being good for local development, you can download modules for most Apache/PHP/MySQL versions and test combinations.

Configuring a PHP framework at server side

Does using a PHP framework (CodeIgniter, Zend) require special server side setup? And if yes, is there a PHP framework which doesn't require that?
The intention would be to use a hosting server which supports plain PHP only (no framework installed - if that makes sense), and use the mentioned framework on the development machine only, which would then be preprocessed ("compiled") into plain PHP.
[Edit]
To all you guys: sorry for the newbie question, I guess I got it wrong. I have only worked in .NET so far, and I haven't done anything from scratch in PHP yet. For this small project I am supposed to do, I wanted to learn and use CodeIgniter, as it seems like a light MVC framework where I can get results quickly.
Before starting, I wanted to check with the hosting provider (from which my customer has already bought a year of hosting) said they only support Zend. So, I guess that's nonsense then?
[Edit 2]
To make my question complete, here is what their hosting package provides:
PHP 5 or PHP 4
Perl
CGI
Python
Tomcat / JSP Tomcat 5.5.9 / Servlet 2.4 / JSP 2.0
FrontPage extensions
Ruby On Rails
PHP / Zend optimizer
PHP / IonCube
Fantastico
DB: MySQL Server 5, PostgreSQL Server 8
To be precise, my question was (since I am a newbie after all):
Q: Which PHP frameworks do you support (Zend, CodeIgniter...)?
A: We support Zend, but not CodeIgniter
Now I am aware that the question itself is a bit dumb, so I might contact them again.
No php framework I know of needs any special server side setup. PHP frameworks are just that: plain PHP only, as you call it. PHP frameworks are nothing more than already written PHP code for you to build your further code on. Nothing special about it.
People sometimes ask question on 'how to install' this or that framework which derives from the same missconception that frameworks are some kind of bundled software that need complicated distributed installation routines. None of that. Just code you didnt' write yourself. And as that you just need to upload (or download) to server. Done.
[EDIT] after your edit:
I slightly doubt the competence of your hosting company. You might have a missunderstanding with them as 'Zend' often means Zend Optimizer or Zend Guard or such. As to PHP frameworks your host doesn't need to support or not support them. It is entirely up to you what PHP code you upload to that host and who has written that code.
Some hosting companies offer framework support in a way that the frameworks are already available on their servers and are updated by your host. And surely there are a few things that can be optimized like php.ini settings. But in general it will work also without these optimized settings.
I almost never accept hostings that a client has already purchased. When I write an offer I attach the strings that the hosting is chosen by me. If I'm satisfied with what the client already has, the better for him.
The only setting you need to configure for CodeIgniter is $config['base_url'] which is used for building links and form actions. Then you should be good to go, as CodeIgniter (and all other frameworks) are just PHP and nothing more.
That said, there are of course environment issues to watch out for. If you are moving from your localhost to a server with a totally different install then there will of course be things that need to be changed, such as $config['uri_protocol'] as sometimes you will get 404's, blank pages or default controller loading when you look at other pages. This can normally be fixed by flicking through each of the uri_protocol options listed just above the option. This is not very common, just something to keep in mind.
And finally of course, don't forget to chmod your writeable upload folders and keep your DB settings correct.
Take a look at my article on "how to get CodeIgniter working on different production environments" without too much faffing with db config.
See EZMVC, it does not require server-side settings/handling.
AFAIK the only thing that is not server-independent is the rewriting of links, as Apache, nginx, IIS and others, all have different rewriting engines/syntax.
I have worked on many php frameworks such as Zend framework, Cakephp, codeigniter and YII. Of these I liked YII ( http://www.yiiframework.com ) the most because it is easy to learn, purely Object oriented and works almost like the Ruby on rails framework. It also has great documentation and is very fast. Yii unlike codeigniter works on PHP 5 only which gives it capabilities like auto loading of classes.
But the only problem with frameworks are that they require configuration settings. You cant make it work without one config file atleast.
Did you try cakephp?
I am using yiiframework and I needed to do a project with php 4, so I used cakephp that I liked it too.

Categories