lithium framework on shared hosting - php

Don't want to pay for dedicated server for dev work.
I don't want to run a live apache server.
Is it possible to integrate lithium framework into shared hosting account doc-root?

Sure it's possible.
The only requirement is the version of PHP which should be >= 5.3
The .htaccess shipped with the framework is the only thing needed, to get a shared LAMP stack running with Lithium.

If you're meeting the requirements for Lithium (PHP5.3, etc) there's no reason you'd need anything dedicated.
Per http://li3.me/docs/manual/getting-started/requirements.wiki, the only requirement is PHP5.3. Everything else is gravy.
Command line access and stuff like git should come with any self respecting hosting company's offerings, even the bargain basement ones. Some of the optional modules, like MongoDB, can usually be run on the slightly beefier options (i.e. Dreamhost only allows Mong
Check http://nephtaliproject.com/php53hosts/index.php for a list of known shared hosting companies that support PHP 5.3 (or higher)

Related

I want to host yii application

I have created yii app locally. And now I wish to upload the same. I have brought the domain, but am bit confused, as which type of hosting should I go for ?
I have options like Cpanel(Linux), Parallels Plesk for Windows, VPS and Dedicated servers on some sites.
I have developed application using Yii 1.1
and database in MySql.
Could you guys suggest me best hosting available and suitable for me to go with.(Though It should be economic. :-p)
And what things should I consider, or are required while buying a hosting for my Yii application.
Edit :
I actually tried hostname/path/to/yii/requirements/index.php and It passed on my friends shared hosting, but I couldn't find proper way to install the Yii on his server space (He has an Windows hosting).
Someone said I'll require an SSH to run a command ( $php /yii/framework/yiic webapp directory-where-app-will-reside ) to install yii framework on server.
When called the Tech-support of his hosting agency they said youll have to go with VPS or dedicated server for SSH.
Yii applications runs on any servers/hosts that support php.
In this case you need a server or host that support mysql too.
Its related to your website traffic that choice sharing hosting or VPS.
In your application have to exists a file named requirement.php that shows Yii requirements, of course in Yii2. For Yii1:
Requirements ΒΆ After installing Yii, you may want to verify that your server satisfies Yii's requirements. You can do so by accessing
the requirement checker script via the following URL in a Web browser:
http://hostname/path/to/yii/requirements/index.php Yii requires PHP
5.1, so the server must have PHP 5.1 or above installed and available to the web server. Yii has been tested with Apache HTTP server on
Windows and Linux. It may also run on other Web servers and platforms,
provided PHP 5.1 is supported.
However is better your host be on LAMP platform.

how to make xampp environment behave the same as my remote shared hosting environment?

i don't know how to say that in technical terms. and i think this is the reason to why i cant get good answer from Google.
i have xampp on my local winxp machine. i use it for developing websites locally then upload these files to my clients shared hosting accounts.
the problem that in 2 years i have always found differences between how xampp works and how the web server work.
some code work locally but dont remotely and the opposite. also flash behave differently on xampp than the remote web server.
is there is a way i can get the server configuration and use it with xampp like get the server php.ini and use it with xampp?
In fact XAMPP may behave different than your production system's web server.
This might be annoying at first, but it is definitely manageable.
Some thoughts:
Run
<?php
echo phpinfo();
?>
on both systems and check different features.
If a feature of PHP is marked as experimental, just drop it.
In case you need to deploy on different production servers, prepare a script called grabProperties.php and add code which checks essential properties you know to be in use. Output the result in some normalized way, so you may use another script to compare results and prepare a nice report.
Certain features activated in XAMPP are not enabled on most web hoster's server - e.g. Flash support. Before using these features, first ensure they are present on your production system.
You are always free to change php.ini. Thus, you may enable or disable modules in such a way, that you dev system mimics your production system's settings.
I wonder, that Flash problems relate to PHP itself. More likely, problems relate to erroneous code.
That said...
I do write PHP for quite some time. Upgraded XAMPP on dev and Apache/PHP/MySQL on production system several times. But not a single application failed to work after the upgrade.
Several times, I moved from dev Windows and production Linux to dev Mac OS X. Even there, everything worked fine immediately.
Needless to note, that not a single line of code needs to be changed between dev and prodution systems.
The essential point to to write high quality code is based on a defensive style.
Check as much input parameters of as much methods as possible (see assert()).
Log all errors to a log-file and visualize it using your admin backend (see set_error_handler()).
Use type-hints as often as possible (see type-hinting)
Set the maximum error level and code in such a way, that not a single warning appears.
Still unsatisfied?
In case you are still unsatisfied with XAMPP, prepare a virtual machine with VirtualBox, install some Linux edition and enable apache, mysql and php.
If your hoster's server is on linux - which is very likely - there should't be a big problem configuring the virtual LAMP server in a similar way.

Setting up a development server

When developing PHP applications, it's best to have a server you develop/test on, and then a live server you put everything once it's ready.
OK, but how?
If you are hosting through a hosting company how can you setup your own development server to test on that mimics all the LAMP settings as your live server? Because if they differ then testing on one that isn't identical to the live one, defeats the purpose right?
Is it better use another server through the same hosting company and ask them make both the development and live ones have the exact same settings?
Also what is the best work-flow to use to check files out from "live server" work on them in the "development server", then check them back into the live server?
Thanks!!
Two points from my daily work:
XAMPP is your one-stop shop for setting up a Apache/mySQL/PHP stack on Windows. I develop with it and deploy to Linux machines, no problem.
If you want to set up a Linux environment on a home server or virtual machine, I asked a question a while ago that may interest you: Pre-installed Linux for Web Developers?
Is it better use another server through the same hosting company and ask them make both the development and live ones have the exact same settings?
If you can afford a second server, it may well be the best way to go. On the other hand, a local machine you could upgrade and fiddle around with at will, and all that at a fraction of the long-term cost of a second rented server. If in doubt, I would go for a local machine.
Don't forget PHP is a very portable language. If you don't use any specific command-line tools or totally exotic extensions, making a PHP application work across Linuxes, and even on Windows is a question of some settings and details, but not really a big deal any more.
Also what is the best work-flow to use to check files out from "live server" work on them in the "development server", then check them back into the live server?
There are many, many opinions and practices in this field. For me personally, the following workflow has turned out to be ideal wherever I've used it - I am still in the process of implementing this myself in all projects and for all clients.
Edit files locally in IDE
Upload to development server via built-in FTP function of IDE
Test on development server
Once a feature is tested and works on the development server (i.e. it's "finished"), check the whole package into a Subversion (or other) repository
On the live server, have a build script check out the latest revision from the repository, download it to a directory with the revision number, and when finished, change a symbolic link that pointed to the previous revision to the latest one.
That way, every change you make to the live environment is logged in the version control system, and reverting to the previous revision is a question if seconds. To me, this was a huge relief compared to working with pure FTP everywhere.
Possibly also interesting question: Setting up a deployment / build / CI cycle for PHP projects
You can check all the production server's setup via phpinfo() and copy them on your development environment, no need for them to be on the same provider.
I usually commit the code to source control, and checkout in the production environment, hiding all the repository information via .htaccess, for example, see here.
Another (less recommended) option is to just have your master source in the development machine, and once it's ready FTP it up, there are various free tools that will only upload changed files.
As for the server side, you have multiple possibilities. You could use vHosts when you have Apache, with two different DocumentRoots: one for the live version, and one for development.
Or you can have the development environment on your local machine, and then the live (+ staging) on your dedicated server / webspace whatsoever.
In our current project we have a three-tier system:
development, staging and live. Staging and live are really almost the same, so that I can eliminate any problems when rolling out from dev to staging. It gives me another security layer before rolling out to live and eventually noticing that something went wrong.
Considering the workflow for rolling out, you should create an application config, where you can define several application environments (development and production) that automatically choose their environment based on URLs, defined environment variables or something else. So, in Zend Framework for example, this configuration driven behavior is built into your applications. In your config.ini file, you have a template which looks like this:
[production]
[staging : production]
[testing : production]
[development : production]
In there you can define different options for, lets say, your database connection i.e.
So when you check your changes on the dev machine into subversion and do a rollout onto your live system, you do not have to change the configuration. It should just work.
As far as workflow goes, that's typically what happens for small sites. Depending on the size of the project, though, it might be a good idea to use version control like Git or Subversion.
You don't need to go anywhere near as far as asking a hosting company to setup two identical hosting environments for you. The majority of the time they have up to date versions of php, mysql and apache. I develop on a Linux machine, that has a lamp stack setup already, so my workflow is pretty seamless, and I use a svn with post-commit hooks to upload to the live server.
If you are worried about incompatibilities between you're 'dev' server and the hosting server, the easiest thing to do is make a phpinfo file,
<?php phpinfo(); ?>
and check that your hosting server does not prohibit any special functions you use on your dev server (and this is pretty rare that the hosting company blocks vital things, and if they do you can easily send support an email and 99% of the time they will assist you in enabling whatever particulars you require. But as far as setting up your dev environment, I would go down the track of grabbing virtualbox, and installing ubuntu, find a tutorial for making ubuntu a web server (seriously only a few apt-get commands) and you will be smoking with gas !

How to distribute a PHP extension for use in a Shared Hosting Environment

I have a library written in C that gets distributed as a PHP extension, and my users are having problems accessing the library when running in a Shared Hosting environment.
Previously (In PHP versions less that 5.2.5) our customers could simply use the dl() function and the full path to the library to access it.
Since PHP 5.2.5 the dl() function can not contain any path information and so the library must be installed by a System administrator in the global PHP extensions directory.
As of PHP 5.4 the dl() function has been deprecated and has been removed completely from PHP 6.0. This will mean that all libraries must be installed by a System Administrator and also loaded via the PHP.ini.
As far as I can tell this is the new reality for PHP extensions in a shared hosting environment and there are no 'work arounds'.
What are the key things I need to do with my distribution to maximise the likelihood that a Shared Host Administrator will install it on behalf of my customers?
A lot of shared hosts are going to disable the dl() function, even if its usable in their particular version of PHP. In short, shared hosting is rapidly becoming antiquated except for those who just want to host a blog or some other kind of vanity site.
Its going to be quite some time before most people are 'in the clouds', however I don't see anything wrong with you expecting more serious users to have a VPS .. and specify the need for one as a system requirement.
I feel the same burn on both sides. I own a small hosting company and also develop custom PHP extensions. Fortunately, for me, I can make my products available to clients that I host without hassle.
Have you thought of just bringing up a shared server and offering hosting to those who need it?

PHP Source Control Server

I there a PHP based source control 'server' that is compatible with SVN clients?
I'd like to host my SVN on my hosting servers, however the current host will not allow me to start any process or install any software
You could try:
http://sourceforge.net/projects/deltaweb
You can have a PHP front end but you will still need to have the SVN server running somewhere.
Not that I know of.
You can look at services like CVSDude.org which provide great SVN hosting that's pretty affordable. They basically specialize in both CVS, and now SVN hosting.
The only PHP-based SVN project I'm aware of is this package that allows PHP to utilize some of the SVN bindings: http://pecl.php.net/package/svn.
As the other answers here have indicated, I don't think you are going to find what you want. A PHP-based SVN server does not appear to exist.
I would suggest finding a different hosting provider for your repositories.
If you want a hosted svn repository and you don't mind using and trusting a 3rd party, try beanstalk, they have a free account and a number of fairly reasonable paid options, considering the management overhead you won't need with them.

Categories