A tip for PHP & ASP on IIS - php

I'm developing a website with Classic ASP (yeah, I know it's 2017!) and I have a pretty heavy script that has many db writes and reads while it runs.
(Basically, it's a web based soccer game, and that heavy script is the match engine that simulates the match events while the game actually occurs minute-by-minute, while 1 minute ingame = every 20 seconds in reality).
I'm working with Windows 2016 Server on a VPS Server with 8GB RAM, using MySQL.
I already have a version of this running, an old one, and now I'm developing a better one, much more functional.
I thought about developing that engine with PHP, mainly because it's gonna be easier for my purpose since it partially supports OOP, and that's a huge advantage here, as it makes it much easier to store and access data.
How would you recommend to do that?
From your experience, what's the best way to run PHP on IIS? (I know there are some kind of plugins that do that)
And, what else should I take in account?
Thank you for your time!

Yes, you can run PHP on IIS.
http://php.iis.net/
As per my understanding you can also try Zend Server community edition.
http://www.zend.com/en/products/server-ce/
It's free, it's reliable, good performance, and it has a web-based admin console.

Related

How to increase the execution speed and reduce execution time of a social website like 'Facebook' developed in PHPFox?

I've an already developed and running social website like 'Facebook'.
This website has been developed using PHPFox v3.0.7(which is a social networking platform created in php).
The website functions are working well, no issues with them.
The main, major and serious issue I'm facing with the website is the slow execution speed. For any kind of operation it takes too much time and user has to wait for that much time. This really irritates the user and is affecting the performance of a website.
So, I did research on 'Facebook'- The World's Largest Social Networking Website developed in PHP. If 'Facebook' can execute at rapid speed in spite of heavy user load and continuous operations why can't my site?
First thing is the site is developed using a framework called 'PHPFox' so the entire Database design, caching and all other things have been managed by the framework itself, I can't change the framework's settings but ultimately I want to increase the execution speed of my website.
So how should I achieve it? If you have any best in class solution please provide me the guidance for it.
Any kind of help would be highly appreciated.
Please feel free to ask me any of the queries you have regarding the issue I'm facing.
Thanks.
There are several ways you can increase the speed.
Using CDN,
Enable caching,
Using load balancing server,
Enable compression,
Enabling bootstrap,
Optimize database and db driver
You can use the following server speedup method
Enabling mod_deflacte
Enabling memchached
I have faced the same problem earlier when working on PHPFox and most of the things can be handled from the admin control panel.
By using memcached, i have resolved the speed issue. You can follow the simple steps which are mentioned in the knowledge base of PHPFox and i hope you will find some solution. how-to-enable-memcached
First of all facebook uses HHMV(HipHop Virtual Machine) which is an execution engine for PHP, ie their PHP code is first transformed into intermediate HipHop bytecode (HHBC), which is then dynamically translated into the x86-64 machine code, optimized and natively executed.
Thus everytime you login to facebook ,you just run the highly
efficient machine code.
I assume your site do not have HHMV , so here are some few tools & tips to boost PHP running websites,
memcached
cassandra
Optimizing db driver
Using msqli instead of mysql
Using a server with better configuration.
Using minified versions of jquery & bootstrap (ie bootstrap.min.js & jquery.min.js).
Hi In your main question, what you are asking is for the advice to increase the performance of your PHPFox application. Whereas, in the different note section, you are looking for the solution to send the Push-Notifications.
I will be answering you regarding the 'Increasing the performance of your website'.
As you must be aware, performance tuning/optimization is the bigger task. It has various stages as listed by '#Myself Malay'. Some of them can be done quick and others will take time. So you need to know them, prioritize them. For ex: Reducing the requests of JS and CSS files, by making them load using the CDN, can be accomplished quickly. Serving your resources (HTML, CSS, JS) in compressed form (gzip) also can be done quickly.
Optimizing your queries will be time consuming. Enabling Cache should be quick. If you want to establish the load balancers then it will take some time.
Here, I am adding some reference links regarding the PHPFox, which will help you.
http://www.ipragmatech.com/phpfox3-performance-xcache-apc-memcached.html#.VXkzXt93M_M
How to optimize your database tables in PHPFox
Speedup PHPFox V3
PHPFox - Optimization Settings
Note: Some of the tweaks may require the modification of the core files. Be careful, while doing so as they will make auto-update very difficult. Always take your code and DB backup during modification to your core files. Make a document about the changes you have done as which files, where why etc, which will help you to re-apply all those changes again, in case of updating your code to new version.
Below, I am adding some of the links, which will help you in understanding the Performance Optimization to the next level
Books for Building Scalable Web Applications? (DB Performance/Tuning, Networking, General Performance, etc.)
Scalability and Performance of Web Applications, Approaches?
My personal favorite book is: Scaling PHP Applications by Steve Corona. This book is the best reference ever available for the PHP Developers.
Eventhough I am not able to give any direct solution to your problem, hope this helps upto certain extent. All the best :-)
First of all, stop comparing your Phpfox site with Facebook. Facebook has hundreds of thousands of programmers working day and night to keep the performance up. It is a horrable truth that PHP is a slow server side scripting language. If your site improves, it's performance goes down. Fortunately, there are some tools available that can be used for increasing the overall performance of your website. Some of them are Memcached, Cassendra, Varnix etc. You can use CD networks to serve data faster. Choosing a good hosting server also helps to make your site ready for heavy traffic.
Facebook uses over 100 unique technologies to keep the site going with a respectable speed. Hiphop PHP is a technology that was developed by the company itself and is used to compile PHP scripts faster than any native C++ compiler. Hiphop makes PHP Codes to execute 30-50% faster. Well, HHVM is an alternative to Hiphop PHP and is available for free but requires nginx. Think again, moving from Apache to nginx is not a good decision if you are just a beginner.

Zend framework on VPS?

I'm thinking about using Zend for my new project.
But I'm worried about using too much system resources.
I'm on the $20 Linode VPS
Will it be worth it?
What resources are you worried about?
Size-on-disk you can predict easily.
For memory and cpu it is harder. You could say that there is always a balance: If you make a small app, you can probably do a better job to code everything yourself. Any framework will give you overhead. But the bigger it gets, the harder it gets to write good code yourself. A framework will help you, and in the end you will be better off using a framework just because of the better your code will be (assuming you use it correctly).
So it is a really hard question to answer, without specifics. Gut feeling does tell me you would not go too wrong by starting with Zend. I've seen a couple of smaller, not-to-high-end environments using Zend with success.
The big question is how much traffic are you seeing?
100 visitors a day?
1,000 visitors a day?
10,000 visitors a day?
I was running a Zend Framework site on a Rackspace Cloud server with similar specs to your $20 Linode VPS. It operated just fine, but I only had maybe 50 visitors a day.
Zend Framework uses an Autoloader so it's pretty lazy in the files that it loads into memory. I've found ZF to be pretty quick for a framework of its size.
As the others have said, it depends on the traffic that you're both getting and expect to receive over time. I have a basic vps for one project and it works fine, but that was after standard tuning of Apache and MySQL. This includes disabling unrequired services, adjusting logging and KeepAlive timeout, amongst other variables (Apache) and tuning various caches (MySQL)
There's a lot that you can do to tune Zend Framework - which I'm quite keen on. Check out the talk by Rob Allen from the PHP London 2011 Conference for some great information.

Web technologies for an embedded server

I've recently started a new web development project for an embedded device and wanted to solicit some recommendations for technologies to use. The device will serve HTML pages which include AJAX code to retrieve data from a JSON server. We're tentatively using Cherokee as the web server, though we're not tied to it.
Currently, I'm considering the following technologies:
Write it all in PHP. I know it's big, slow, and bloated, but I've got about 10MB available for the web interface (a lot for an embedded system), and we won't be seeing a lot of traffic on any of these devices. It does need to seem responsive for the users, however (pages should load in less than a second).
FastCGI + a C program - We're using an in-memory database, so the C program could interact with the database directly through the API. This would have much better performance than PHP, but development time and reliability is a concern since C isn't very well-suited for web development.
Lua + Kepler - This seems like a nice middle ground between performance and development time. However, I've never worked with Lua, so I'm not really sure how to implement it in an embedded web project. I'm also uncertain as to how well it integrates with the Cherokee web server.
So any opinions or past experiences with the above stated technologies? Any others I should include in the list?
Thanks,
Alex
When I was in this area, I used Lua and a simple FastCGI runner (Luaetta [for I'm sure the latest source would be available if you asked the guy] , though I'm also sure that's not the only one, and there's Kepler of course), spawned by lighttpd.
It performed quite well on an embedded media player, and was used for remotely accessing content and controlling the device. Though I don't maintain it anymore, you can find more about it at http://matthewwild.co.uk/projects/wooble . If you think the source would help just poke me for it, it's currently only available via a package manager but I can fix that given the motivation.
Another (again Lua) project in this area is LuCI. These guys are dedicated to making a web interface for embedded devices (routers specifically), and have produced a nice framework with lots of supporting libraries geared towards that kind of system.
I wouldn't be concerned with not knowing Lua. If you know any language then you can pick up Lua in a day or two, the manual documents the whole language and is quite short.
How about looking at HipHop, Facebook's PHP compiler?
https://github.com/facebook/hiphop-php/wiki
That way you can write your code in PHP and effectively compile it to C++.
ASP.NET. Assuming that you wouldn't be interested in Embedded Windows Server 2008, you could still leverage ASP.NET by incorporating Mono into Cherokee. You could leverage Visual Studio as your RAD development environment and use things like ASP.NET MVC 2. A lot of third party user controls will also 'just work' with Mono (Telerik Announces Support for their ASP.NET controls on Mono!).

Should I build my site using ASP.NET to leverage my C# knowledge or should I learn PHP and use that because of the cost?

I'm a C# programmer and I love the language. I think it's the best thing since sliced bread. Recently I have become real interested in creating a website that offers jobs and allows companies to post jobs for people to navigate through.
This is going to be a nationwide site only, no international connections.
I'm somewhat familiar with ASP.NET (I've used it before for a much smaller pet project) but I wouldn't say I'm more than a
Newb - Journeyman - Novice -
Experienced - Expert
I have absolutely zero experience hosting a website or even registering a domain. I'm familiar with HTML and making applications in XAML for WPF has given me a much easier time understand things that laid out in markup.
Is ASP.NET hosting expensive? Is PHP cheaper? I just need a little guidance. :)
Should I use ASP.NET or PHP?
I'm a PHP programmer and love the language, but with your background, I would absolutely say ASP.NET. PHP hosting tends to be cheaper and more available overall because it's usually Linux based and thus comes with no License fees, but there are good and affordable hosting options for Windows/ASP, too. And who cares if you pay a few dollars more, what you save in man hours will easily be worth it.
Don't forget that PHP usually runs on a LAMP stack, so for anything a bit bigger you will need to gain at least some knowledge of the conventions and quirks of the Linux world, Apache, and maybe MYSQL, too. If you're looking to broaden your horizon, that's certainly a great way to learn new stuff. If you want to get a job done, I'd say stick with what you know.
PHP is cheaper than ASP.Net, specially if you need multiple boxes (servers).
However I would say go with ASP.Net, you'll have less trouble than trying to pick up on PHP.
I have built a website in Drupal. I'm a C# noob and I would have wanted to build the site from the ground but I am not really familiar with security architecture and stuff. If you want to hone your skills in C# and ASP.NET, I'd say go for it. Registering a domain is basic. Building a website in a hosted environment is a good exercise.
Do not worry much about how much you will spend on this project (Host expenses, domain registration, etc). Just think that this goes to your professional portfolio. You can reference this as a tech work. Plus the experience in developing and building the actual site is priceless.
Just curious, but have you thought about using Mono? It's very nice and capable. The newer versions are much easier to install get running properly than before.
I don't know if you plan on using a virtual host or dedicated host or what but the route I initially took was to go to serveraday.com and get a dedicated server and then install Mono and then install my ASP.NET apps. If you are patient you can get a dedicated server from serveraday.com for $200 to $250 a year if you prepay the full year in advance.
I had little to no problems with compatability. It was actually pretty amazing how well the apps worked when going from developed in Visual Studio to being run by Mono.
According to your experience in programming, I would suggest using .Net. It will be easier to come up with a product that looks nice. All this because ASP.Net already has themes and Visual Studio is very user friendly, if you use Microsoft tools. However, learning PHP will get you more into the roots of HTML, JavaScript, HTTP, etc. It will normally be more work than using .Net, but at the end it make you a better programmer.
One thing to consider beyond just hosting is the ability to find talent to help you work on your site.
This is completely anecdotal. I have no stats to back this up, but it always seems to me that there are more PHP developers out there than ASP.NET. My theory has been because of the lower learning costs of PHP. I recently had three experiences to confirm this:
1) A close friend of mine is a tech recruiter in San Diego. He posted a .NET job mid 2009 and couldn't find a single qualified bite for five months.
2) I consult for an early-stage startup. A year ago, they completely converted from ASP.NET to PHP because they simply couldn't find anyone to hire.
3) It's uncommon to find a .NET job on Craigslist where I am in Austin, however I've been watching a particular one for the later half of 2009. This was for an online retailer. They kept reposting this position every two weeks or so, and the pay was very average for this market. If I recall, they stopped around November/December, and I thought they finally filled the position. At the beginning of this month, they reposted the position, but this time it was for a PHP developer who was familiar with .NET technologies.
Again, take this for what it's worth. This is just my limited observations. People will say low barrier to entry = bad coders. I don't buy that. The worst app I've ever supported was a classic ASP app. Low barriers to entry just increases the size of the talent pool. You'll have more bad coders, but you'll also have more good coders, too.
I don't find ASP.NET hosting much more expensive. The hosting company I use even throws a MS SQL Server database (most places charge $10/month for MS SQL Server database) in for free and allows PHP hosting and .NET hosting in the same account.
Check them out. They are pretty good.
Reliable
I would go with what you rather program with. I prefer to use ASP.NET so the little bit of price difference is not worth it for me to switch to PHP.

Best Language for Windows 2000-based Website

I've been contacted to see about updating an old legacy web application that was built using ASP and Access. The server is running Windows 2000 Advanced Server and I believe IIS 5.0 (I am trying to get confirmation on that, but the company isn't technical so I highly doubt Apache is running on the server).
What languages would be viable for updating this web app on the above platform? I've never touched classic ASP much less done any web development work against Windows 2000/IIS 5. There are no plans on updating the server to anything new due to budget concerns.
I'm leaning at the moment to moving to an SQLite-based database (customer isn't too keen on installing MySQL at the moment but I'm still in planning stages and this is a relatively low-traffic website) but what language would I pair with that? Does ASP.NET work well under IIS 5? Does PHP perform worth anything under this kind of setup?
I have a similar situation, did it about a year ago, and ended up using asp.net 2.0.
Generally ok, but the machine is showing it's age, I usually need to get someone to give it the 3 fingered salute every month or so, and it blew a psu recently.
If it's only low volume, you might be able to install sql express, which will make your life a lot easier than something like SQLlite, as dotnet plays nicest with other MS stuff, and there is a lot of labour saving goodness built in.
You would also be able to use the access to sql migration tools if you use sql express.
Would also suggest that you look at something like subsonic or nhibernate, which will take care of a lot of the boring and error prone stuff for you.
It really depends on where your experience lies, and how big the project is, if you've never used dotnet before, then start on something small, this may or may not be the one.
Apparently php performs well on win 2008, but as for 2000, never tried. Did have apache on a 2k box many years ago, but wasn't using php.
If the company is concerned with cost, I would be very conservative making changes. Concentrate on why they want to update- do they want to add new functionality? What are their mid-to-long term plans for the site? Are they having trouble maintaining the site? Going to a custom .NET solution may only complicate things further unless they are willing to make some ongoing investment in development.
If it's a relatively simple site, they may want to consider a platform like DotNetNuke. There are hosts out there that sell ready-to-configure sites that can do quite a lot with a minimum of configuration. That combined with a profressionally developed DotNetNuke UI template (TemplateMonster.com offers them) may be a good solution.
If they do want to go with a custom solution, ASP.NET runs fine on IIS 5.0. I believe you can run the .NET Framework up to at least 2.0, not sure about 3.0 or 3.5. Language won't make a difference to functionality, so C# or VB.NET are fine, all things being equal.
In this scenario, I would probably go with ASP.NET. Since you're running on a microsoft server, there will be plenty of documentation from MS on installing, configuring, and running the site. It's a lot easier to support something when all the components are "in the same family" so to speak. Asp.net will run fine under IIS 5. It doesn't have a lot of the security and scalability upgrades that IIS 6 does, but it will do the trick.
I was able to get a bit more information. The box is running IIS 5.0 and the IT guy handling it is more than happy to let me install whatever I need. From googling and responses below it seems like my best bet will be to convert the site to ASP.NET 2.0 with SQL Server Express 2005 running as the DB.

Categories