I upload files with curl in php running on Windows Server 2008 (via POST), but it always only uses about 10% of the possible speed. I've tried every solution that I could find:
-Using HTTP 1.0
-Using another cURL version
-another PHP version
-Using another Apache, use XAMPP, use WAMP, use IIS
-Changing the buffer size
-edit the registry of windows (windows socket stack problem)
-use another server
-use other files
-use different scripts
As said I've used different versions of everything I can change. Windows server 2008 seems to be the problem, but I can't change it because it is a rented server paid for a year. I will now try it with a virtual apache system on the server but this isn't a good solution. Is there any solution for this problem?
Related
I have a production virtual web server that is being migrated to a new virtual web server on the same local network. The problem is that there is a performance problem on the new server.
For example, there is one page that loads in about 1 second on the original server, but takes over 25 seconds to load on the new one. I have already ruled out the database connection as the problem.
Both servers are Ubuntu Apache servers running PHP. There are slight differences in the versions of the servers, I will list as best I can here.
My main question is: is there a general way to profile the web requests on each server?
Similar to the way I can profile a python script or function and get a break-down of which parts of the program take the most time, I would like to profile the web requests on one server compared to the other.
Of course a web requests to the server are fundamentally different than programs run on a local computer, but I need to find where the bottleneck is. Any help is greatly appreciated.
Old Server Config
Ubuntu 14.04 - PHP version 5.5.9
New Server Config
Ubuntu 16.04 - PHP version 5.6.31 (also tested with version 7, same result)
I would suggest to log PHP script execution time.
If it comes from somewhere in the PHP execution, you will notice it easily.
Do a log at the start and one at the end. Then you can stress test both and see different execution time.
I seriously doubt the problem comes from PHP but if you do that you could also see differences with PHP7 which should be 30% faster.
We are running nginx on CentOS 6.4 and upgraded the curl packages from 7.19 to 7.41 yesterday and since then cURL no longer checks the hosts file to resolve host names (and so will not connect to xyz.local)
We use cURL via Guzzle and are no longer able to connect to the various services on our local machines.
John Hart posted this answer which is helpful but would require a fairly significant change to how our site (a LOT of legacy code) manages connections for our local and dev environments.
Is it possible to just tell cURL to use the hosts file?
As a workaround you can install a DNS server that reads your hosts file, and use it as system DNS resolver. For example dnsmasq does this by default.
I have set up a DMZ to run a web site. Most of the code is on an application server running Debian Release 7.0 (wheezy) 64-bit. I also have a web server running CentOS 6.5. It acts as a proxy for the application server. I have set up LAMP on both and my web pages are written in PHP. A PHP script on the web server calls a PHP script on the application server. The application server script calls a long running (> 1 minute) executable (that had been developed in C++). After 60 seconds (timed by my watch), the script fails with the following message.
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /appServer/scriptName.php.
Reason: Error reading from remote server
Apache/2.2.15 (CentOS) Server at sitename.com Port 80
I commented out code in the application server PHP script and narrowed the problem down to the long-running C++ executable. I also ran the executable in the shell without any problems. So there is clearly a time-out issue and it seems to be associated with the web server. I have only recently replaced an old version of Ubuntu, with Centos 6.5, on the web server and I did not have this problem before I did that. Also, the PHP code is the same as before I made the switch and it did not give me this problem prior to that. So I am convinced that the problem lies with something on the web server and one of the setting I have, with php or apache, on the new system.
I edited /etc/php.ini, on the web server, and changed all of the uncommented-out 60 second time limits (max_input_time, default_socket_timeout, mysql.connect_timeout) from 60 seconds to 600 seconds. I still get the above proxy error after 60 seconds.
Solution.
On the (CentOS) web server, edit /etc/httpd/conf/httpd.conf
Include the line
ProxyPass /appServer/ http://[private IP address]/ timeout=600 Keepalive=On
Specifically add the
timeout=600 Keepalive=On
part.
I also restarted apache to be on the safe side.
Is there any way that I can set up Apache to run locally, specifically NOT connecting to the internet, so that it may serve dynamic content (PHP) over a LAN?
I'm trying to set up a development environment on my Windows XP SP3 box and gain some experience with building web PHP driven web applications. I have residential Rogers service, and it's a violation of the TOS to have a server running over that connection.
Umm yes. Just download apache and fire it up. The only way it's going to get to the outside is if you specifically open up ports in your firewall/router to let http traffic in and route it to your machine. And if you're serious about getting some experience, ditch XP and get a quality linux distro on your "development" box. You can always remote desktop or ssh to it from a windows machine if you feel more comfortable that way.
My experience has been that many hosting companies use CentOs for their client servers, so I'd recommend trying that first if the purpose is gaining useful experience.
Oh by the way, Linux happens to be free.
You can use WAMP. It installs everything you'll need to get a testing server up and running in minutes
Using a packaged solution like WAMP or XAMPP will provide you with the basics for setting up an Apache web server + PHP + MySQL + the phpMyAdmin interface for working with MySQL outside of the command line.
I am new to Windows IIS and I need to run a php/mysql application on it. For local php development on windows, I have found WAMP to be the easiest.
But can WAMP be used in this case instead of installing php and mysql separately ?
This needs to be done on an ec2 Windows 2003 instance. So far, I have already tried installing WAMP and setting up apache to listen on port 8080 instead of 80. From inside the remote desktop, both IIS and WAMP work properly in parallel on their respective ports.
However, when I try to connect from another computer using the ip address http://184.**.***.***, IIS works fine serving the default web page but cannot connect to apache on http://184.**.***.***:8080.
Is it possible to use WAMP at all for this purpose and if yes, would there be any disadvantages in using it instead of installing php/mysql seperately ?
Edit :
I dont know if this is a problem of blocked 8080 port. To verify this I stopped IIS and configured apache to listen to 80. Even then http://184.**.***.*** doent show the WAMP homepage. IS anything needed to be configured in IIS ?
RESOLVED :
Added the port 80 in Windows Firewall Exceptions and it started working.
Also, its necessary to select "Put Online" in the WAMP tray otherwise it gives a forbidden response as suggested by some answers.
Thanks
I haven't used EC2 in this way before, but broadly speaking, I'd encourage you to use the same server for development and production environments if at all possible - the installation effort can be a bit of a pain, but it's nothing compared to developing an app locally and then finding an IIS configuration issue causes it to break on production.
This approach also lets you keep your PHP configurations in source code control - php.ini and any modules you're using - and automatically deploy them alongside your application; again, forgetting to deploy the correct PHP.ini usually makes your application do crazy things...
So, your choices appear to be:
- switch off IIS and have WAMP listen to port 80. Not sure WAMP is designed for production level traffic, but in the past, I've run low-traffic public websites in this way.
- work out why port 8080 is blocked, and if it can be unblocked. This would still require you to run your website on an unusual port, which makes for ugly and hard-to-communicate URLs.
- install PHP on your IIS instance. One benefit of having installed WAMP is that MySQL should already be up and running, and the basic PHP installation should also be there; getting PHP to run on IIS is no longer a dark art ([http://php.iis.net][1])
For my money, I'd go for the latter option...IIS is a production quality server, and it's clearly what Amazon want you to use in this instance.
Of course, running IIS on your development environment may be a problem.
Have you put the server online? Think it is offline by default, meaning it's only accessible from your local machine. It's an option in the systray menu to put it online.
If I remember well, there is an option "go public" (or "put online") on the system traya icon of wamp.
This option modifies the httpd.conf to authorize public access.
You should give a try.
On a side note, you can make php work with IIS. This is another option to help you manage your server. (Mysql and Php have to be installed separatly but, this is very easy to do as far as I remember :) )