I just created a EC2 instance and installed LAMP on Ubuntu 16.04 LTS. I'm using AWS EC2 with 1 core processor and 1GB RAM. I have WordPress installed on it with its default theme. When I scanned my website on pagespeed insights, it is showing that I need to reduce my server response time.
I'm using PHP 7.1 and FPM for better performance and disabled .htaccess, yet no success. I tried finding to tune Apache performance but all the articles are almost same and nothing helped me.
Related
We have developed Laravel based software, locally tested with Laravel Valet and everything is working fine. One installing on a staging (direct admin) webserver with exactly the same database and code the memory usage dramatically increased.
Local testing specs:
OS: MacOS Catalina
Proc: 2.3 GHz 8-Core Intel Core i9
Memory: 16 GB 2667 MHz DDR4
Staging server specs:
OS: CentOS 7.0 64-Bit
Processor Speed (MHz) 2693.670
Total Memory 1014728 kB
This is a basic static page:
Staging server: 21MB, PHP 7.4.2
Development machine: 5MB, PHP 7.4.4
Another larger page (which needs optimization):
Staging server: 101MB, PHP 7.4.2
Development machine: 85MB, PHP 7.4.4
We know this development machine is a lot slower but we cannot explain the memory usage increase. Does anybody know how to analyze and resolve this?
The used framework is Laravel v6.18.20
Well Laravel Valet uses a very lightweight web server and that is a huge difference, I suggest to configure your webserver to use Nginx instead of Apache and be sure you are using PHP as FPM module, generally speaking, servers with Direct Admin uses Apache webserver by default and that will increase the memory usage of every request.
Try to switch to an Nginx webserver
I have a site deployed to both Windows server 2012 and ubuntu 14.04 and there is a significant performance difference. The code base and DB data is exactly the same.
Windows environment
Windows Server 2012 in AWS EC2 t2.medium (dual core 4GB ram)
PHP 5.5 64 bit ts
Apache 2.4.23
Linux
Ubuntu 14.04 in AWS EC2 t2.medium (dual core 4GB ram)
PHP 5.5 64 bit ts
Apache 2.4
Both site have OpCache enabled.
The execution time (sole PHP execution time, excluding all network traffic)
Windows: 2.6-2.8s
Linux: 200-400ms
In windows, what we notice is there is a almost 100% CPU load peak and a 3-4MB IO read peak on single page load.
I have already came across various post in Stackoverflow regarding php performance in windows but we have already applied/tested suggestion from those post to no avil
PHP factor 30 performance difference from Linux to Windows
Windows 7 php + Symfony2 terribly slow
Any advice would be appreciated!
Finally got myself an answer to this
The performance difference is due to php function is_dir() perform terrible in Window
Test1: run simple script to loop 1000 times to invoke is_dir()
Windows: 217ms
Mac: 8ms
Test2: profile the code with xdebug
and is_dir() sit at top of the list for highest execution time
Some other reference also point out the same issue
https://github.com/facebook/hhvm/issues/4431
Hope this post can help others facing the same problem
I recently downloaded WAMP server to get started developing a website locally on my Windows 7 32 bit computer. It was working fine.
Not long after, I downloaded a few different OSGeo4W packages mainly to use QGIS and develop plugins. This is when I began having issues accessing the phpmyadmin local host (page not found error).
I tried uninstalling WAMP in order to re-install it, and now it seems to be taking a very long time to extract files, blocking on the apache 2.4.9 files. Does anyone have any idea if this may be because OSGeo4 installed another version of Apache on my computer? How can I solve this issue?
This is because apache is already running via OSGeo4W application. You can turn it off by launching OSGeo4W-Apache-Monitor and stopping the services. (start/all programs/Apache/OSGEO4W-Apache-Monitor.
Then restart wamp and it should work fine.
I have a machine configured for ASP.NET 4 & IIS7.
I want to run PHP on the same machine without interrupting ASP.NET. Anyone know the steps and I will research it more.
You can install php for windows. http://php.iis.net/ Its almost the same as installing it on your local machine. It wont interrupt any existing asp.net applications unless you mess with iis and their directories/applications. Amazon should give you access to the ec2 instance to install and configure iis.
Walkthrough.
I have written a simple web application mostly full of static web pages with several you-tube embeddings. Few forms and so on. All this is developed using CodeIgniter.
The site is very similar to Academic Earth. With videos served from Youtube. It has got 400 users only 30-40 are active.
I am not interested in shared hosting and want a machine with root access. My budget allows me to hire RackSpace cloud server with 256MB Ram.
Is it sufficient to run my application?
Or should this question go on ServerFault.
Yes, you can run a simple server on 256MB RAM. You would want to look at things like http://www.lighttpd.net/ instead of Apache and do some tweaking to settings (I read that Debian is better at using less RAM out-of-the-box though not sure how true that is.)
Read this:
http://www.lowendbox.com/blog/yes-you-can-run-18-static-sites-on-a-64mb-link-1-vps/
I've had great success running apps on tiny VPS hosts like Slicehost and Linode.
You'll probably be fine with the apache/php/mysql from your distribution's package manager. I've had good results compiling my own AMP stack from source and tweaking things. With PHP 5.3.3, PHP-FPM (FastCGI Process Manager) is built in, and provides much better FastCGI support.
Running PHP under FastCGI can be adventageous in low-memory situations, since you can then run apache with the worker MPM, which is much more efficient, memory-wise than running prefork-apache/mod_php
Note that currently, Linode will give you a 512MB server for $20/month. However, my experience has been that Linode has semi-frequent network issues (see http://status.linode.com), but otherwise they've been great.
If all you can afford is $20/month, you probably can't do much better. The other nice thing about these VPS hosts is that if you need to grow later, all it takes is a couple of clicks in a control panel and you can upsize your server.