Is there an equivalent in PHP development to using Mongrel/Webrick during Rails development?
I normally use Mongrel on port 3000 to serve up my Rails app during development.
Its been a couple of years since I've done PHP development. From what I recall, the method was to run Apache on the dev machine during PHP development (which involved setting up virtual domain in Apache etc....).
Is this still the case or is there a simpler method these days. Unfortunately a quick Google did not yield anything of interest.
Before I forget, the dev environment is on Debian Lenny. Ubuntu solutions also welcome.
Thanks for any and all suggestions.
I found interesting answer on serverfault:
A built-in webserver will be included in a future version of PHP
You could take a look at lighttpd - that's quick & easy to install and configure with PHP.
If you're on Debian/Ubuntu it's fairly easy to set up an Apache environment. Everything you need is in Synaptic.
Below is how to do it in ubuntu, but if you want really easy, use a VM appliance:
LAMP appliance.
XAMPP may also be workable, but I have only used that in windows.
In ubuntu:
sudo tasksel
select LAMP, and that will set up apache, etc. In the middle of the install it will ask for the mysql password.
Files live within /var/www, but this can easily be changed in vhosts (I use a subdirectory of my home folder which is more often backed up). A quick check of the ubuntu online documentation should show you the correct files to edit (since I think there was a change after hardy).
Subversion and phpmyadmin are a good idea as well, as I'm sure you are aware.
a2enmod will enable mod-rewrite, etc, as that is not enabled by default
Related
I'm writing a web app on my system using PHP5, but the app needs to be compatible with PHP4. Is there any way to emulate PHP4, or at least issue warnings?
Thanks.
As a general rule, if you avoid functions and arguments that were added in PHP5 (as shown in the documentation for each function), then it should work just fine with PHP4. PHP is good at backwards-compatibility like that.
There is no way to emulate PHP4 that I'm aware of. You need to run your code in a real PHP4 environment. Here's what I'd suggest:
Grab an old distro which includes a PHP4 package. Apparently, Ubuntu Dapper (6.06) does.
Install it into a VM (VirtualBox or VMWare) on your box.
Create a shared directory for the VM which points to your app dir on the real box.
Inside your VM, create a symlink from the webroot to the mount point of the shared directory.
Once that is done, you can more or less forget about the VM. All you need to do is keep it running. Change your code in your app dir as before. You can run it from your browser with the IP of the virtual machine.
(Perhaps you could even install an old version of XDebug in the VM and do proper remote debugging from within your IDE. But I don't know if XDebug is compatible with PHP4 at all.)
No, there isn't. You will have to install PHP 4 on the machine to provide the runtime environment. Or, even better, convince the client that PHP 4 in 2012 is... outdated.
I recently bought a new mac... In the past I used MAMP and Bitnami for the setup of my dev environment, but I would like to find a more efficient way, if exists, to manage my apache & php installation...
So...
What is the best way to set up a PHP development environment on a Mac? On StackOverflow I found something on http://www.macports.org/ are they reliable and/or updated to latest versions of apache and php?
I am one of the BitNami developers. I wanted to mention we have released a version of MAMP stack that you can download and run from Mac OS X app store with one click. It is completely free: https://itunes.apple.com/app/mamp-stack/id571310406
I finally found my perfect setup thanks to this blog post: http://echodittolabs.org/blog/2011/09/os-x-107-lion-development-native-apache-php-homebrew-mysql-or-mariadb, which basically uses Lion's built-in Apache and PHP with a Homebrew installation of MySQL and a nice VirtualHosts setup.
You can try AMPPS new MAMP/WAMP Stack. I use it.
I've installed Apache/MySQL/PHP on linux servers several times, and it's usually a piece of cake because of good package managers.
However, I had a terrible experience with MacPorts. Why don't you look at Xampp if it has everything you need.
I think I'm going for an Ubuntu Virtual Machine, for several reasons...
Easy to mantain (all packages available)
Easy to shutdown
MacOS stays clean
I can easily switch env or similar...
For Windows users i recommend "Softaculous AMPPS" since it's easy to update it. For Mac users I recommend "Bitnami MAMPStack". However to test PHP mail function on my Mac, i use "MAMP Pro".
I do Php and MySQL development on a small scale on my Mac. When first researching it all a few years back, I came across Marc Liyanage's Apache build (entropy.ch). Since that's all I knew, I installed it and have been using it ever since.
I hear a lot about XAMP and MAMP these days. Now I'm not a Linux guy really. I can get around the terminal, and use MySQL via the terminal, but I'm not too UNIX savy in general. I find that I'm stumped when I have to install packages for Apache / Php via the command line.
My question is: is the interface / installation / maintenance in XAMP / MAMP simpler or more intuitive, than the entropy.ch build? (As in, more interfaces and less UNIX code to build things)?
How about any other differences?
I can't say I've ever seen or used Marc Liyanage's Apache build, but can attest that both XAMPP and MAMP are extremely easy to install and use and neither require any command line commands to setup.
I use XAMPP daily, and tried MAMP for a while but saw nothing better or worse about it so just kept using XAMPP. If you find yourself needing to extend Apache and install additional modules then you might need the command line to do so, but I've never needed to.
The only frustration I've ever had with either is default location for site files being with the application folder. It's not too difficult to change or work around, but it's annoying if you're used to having them in the sites folder.
XAMPP and MAMP are pretty well self contained and neither should affect your existing setup if oyu give them a test drive.
I have found MAMP to be simpler and more intuitive. XAMPP is almost exactly the same, but it doesn't seem as "mac"-like.
I have never even heard of entropy.ch so I can not comment on the differences, but if you havent tried MAMP yet you should take a look. Its incredibly easy.
I need to test some php code, what light-server can i install on my computer?
Try WampServer for a quick install of Apache, mySQL, PHP and Perl if you use Windows.
There are a few of these kinds of applications for various OSs, such as Xampp for Linux and Mamp for Mac
Well, on Windows or Linux (and probably Mac), I like Apache. It might not be ultra-lightweight, but it is very configurable and has been solid for me in the past.
Apache
I forgot how confusing their pages can be at first. I think this is the page you want, just make sure you get the right version for your OS:
Download Page
A solution that has always worked for me is to download Xammp. Easy to install apache server for windows. Not exactly lightweight (comes with mysql, perl, filezilla) but can't be beat in terms of ease of use.
I've looked for other questions, but could not find any...
I have freshly installed my Mac with OSX 10.5. I need to learn Python/Django for a new job, so want to set it all up correctly, ready to develop and run from my browser using http://localhost/
I come from a PHP background and always used MAMP before. But I want to get everything working together... Apache, PHP, MySQL, Python, Django. Using MAMP is easy to install a local development server, but I want to get Python and Django running nicely too. So I can just start developing and also following tutorials on Python/Django.
Please give me some steps (with MAMP or not) to get a nicely working environment for Apache, PHP, MySQL, Python and Django. Thank you, all have great days!
James
Why not try the official installation instructions? Really all you need to do is install Django. You can use its built-in server (http://localhost:8000 by default) for testing:
./manage.py runserver
Your Mac should come pre-installed with Python 2.4 (or later) which is fine for Django 1.0.2.
10.5 comes with Apache installed by default System Preferences > Sharing > Web Sharing.
To enable Apache php module edit the Apache conf (/etc/Apache/httpd.conf) file and uncomment the php module line.
LoadModule php5_module libexec/apache2/libphp5.so.
Restart Apache after by disabling & enabling web sharing
Mysql package can be downloaded form the official website and is easy to install
The fastest way to get started with Django, will be to use TurnKey linux Django appliance.
Link: http://www.turnkeylinux.org/appliances/django
I also came from PHP a few months ago. I'm not sure if this will get moderated up or down because my answer changes your question:
Do not use MySQL and Apache for local development on your Mac. Use Sqlite3 and the development server that is bundled with Django - this allows for inline debugging, etc...
Sqlite3 is basically the same as MySQL except you need to use .schema instead of describe.
If you start having problems, get MacPython. This has helped me instantly solve problems faster than trying to work with the stock Python on Leopard.
Try to use pip instead of easy_install where possible.
When you are ready for real deployment, then you'll need MySQL/Apache/Nginx, etc... but those will be on a Linux system and you'll be better prepared at that point to make a good production installation than you are now. Getting a production-quality stack running on the Mac is more of a pain than it's worth.
BTW, when you do install Apache, use wsgi, not mod_python.
Okay. I'd just install MySQL from their site and stick with what's already on my Mac as of 10.5, then install Django and the Python MySQL driver. But since you like MAMP, install MAMP or XAMPP and read something like this which summarized says:
Mac OS X 10.5 comes with "Python 2.5.1, thus you won’t have to install it. You can verify this by running python in the Terminal."
Checkout Django cd $HOME/Code; svn co http://code.djangoproject.com/svn/django/trunk django_trunk
Tell Python where Django is echo "$HOME/Code/django_trunk">/Library/Python/2.5/site-packages/django.pth
Add django-admin.py to your PATH
Install the MySQLdb driver from sf.net this probably requires GCC which means you might want the set with Xcode from Apple's Dev Tools.
Do a source code edit
"At this point, edit the _mysql.c file
and comment out lines 37, 38 and 39 as
follows:"
//#ifndef uint
//#define uint unsigned int
//#endif
run
python setup.py build
sudo python setup.py install
Verify the installation