Rectangle 27 2

Explanation in case of php & apache server

http & https are protocols to view web applications. Features like directory listing are done from server, not through such protocols.

When you are using commands like scandir() to read file and directory, its the server that does the reading for you. not any http or https link. The page you browse through such protocols will only deliver the output markup on the page.

Through these protocols, all files except server-side files can be delivered on their actual format.

@Ryan: I didn't do that but probably because http and https can serve files perfectly

oh I see. but is there php function that counts files through ftp?

I guess maybe if you consider that if directory listing is enabled you could sit there and count the files. Other than that no clue.

@jprofitt: how can you be sure that directory listing is a real directory listing? ;-)

php - How to count files in https? - Stack Overflow

php https ftp
Rectangle 27 552

Needed background on how PHP "integrates" with web servers:

Different web servers implement different techniques for handling incoming HTTP requests in parallel. A pretty popular technique is using threads -- that is, the web server will create/dedicate a single thread for each incoming request. The Apache HTTP web server supports multiple models for handling requests, one of which (called the worker MPM) uses threads. But it supports another concurrency model called the prefork MPM which uses processes -- that is, the web server will create/dedicate a single process for each request.

There are also other completely different concurrency models (using Asynchronous sockets and I/O), as well as ones that mix two or even three models together. For the purpose of answering this question, we are only concerned with the two models above, and taking Apache HTTP server as an example.

PHP itself does not respond to the actual HTTP requests -- this is the job of the web server. So we configure the web server to forward requests to PHP for processing, then receive the result and send it back to the user. There are multiple ways to chain the web server with PHP. For Apache HTTP Server, the most popular is "mod_php". This module is actually PHP itself, but compiled as a module for the web server, and so it gets loaded right inside it.

There are other methods for chaining PHP with Apache and other web servers, but mod_php is the most popular one and will also serve for answering your question.

You may not have needed to understand these details before, because hosting companies and GNU/Linux distros come with everything prepared for us.

Since with mod_php, PHP gets loaded right into Apache, if Apache is going to handle concurrency using its Worker MPM (that is, using Threads) then PHP must be able to operate within this same multi-threaded environment -- meaning, PHP has to be thread-safe to be able to play ball correctly with Apache!

At this point, you should be thinking "OK, so if I'm using a multi-threaded web server and I'm going to embed PHP right into it, then I must use the thread-safe version of PHP". And this would be correct thinking. However, as it happens, PHP's thread-safety is highly disputed. It's a use-if-you-really-really-know-what-you-are-doing ground.

In case you are wondering, my personal advice would be to not use PHP in a multi-threaded environment if you have the choice!

Speaking only of Unix-based environments, I'd say that fortunately, you only have to think of this if you are going to use PHP with Apache web server, in which case you are advised to go with the prefork MPM of Apache (which doesn't use threads, and therefore, PHP thread-safety doesn't matter) and all GNU/Linux distributions that I know of will take that decision for you when you are installing Apache + PHP through their package system, without even prompting you for a choice. If you are going to use other webservers such as nginx or lighttpd, you won't have the option to embed PHP into them anyway. You will be looking at using FastCGI or something equal which works in a different model where PHP is totally outside of the web server with multiple PHP processes used for answering requests through e.g. FastCGI. For such cases, thread-safety also doesn't matter. To see which version your website is using put a file containing <?php phpinfo(); ?> on your site and look for the Server API entry. This could say something like CGI/FastCGI or Apache 2.0 Handler.

If you also look at the command-line version of PHP -- thread safety does not matter.

Finally, if thread-safety doesn't matter so which version should you use -- the thread-safe or the non-thread-safe? Frankly, I don't have a scientific answer! But I'd guess that the non-thread-safe version is faster and/or less buggy, or otherwise they would have just offered the thread-safe version and not bothered to give us the choice!

So PHP-FPM is not threaded? That solves the problem then since Fast CGI is used on nginx servers.

Awesome detail, I have been programming in PHP for years and never knew this.

@Xeoncross: Generally that's correct, and in practice it's one of the great reasons to manage PHP processes outside of Apache. I go over this aspect in my answer.

Is PHP's thread safety still "highly disputed" (in 2015 and version 7) ?

multithreading - What is thread safe or non-thread safe in PHP? - Stac...

php multithreading thread-safety packages threadcontext
Rectangle 27 552

Needed background on how PHP "integrates" with web servers:

Different web servers implement different techniques for handling incoming HTTP requests in parallel. A pretty popular technique is using threads -- that is, the web server will create/dedicate a single thread for each incoming request. The Apache HTTP web server supports multiple models for handling requests, one of which (called the worker MPM) uses threads. But it supports another concurrency model called the prefork MPM which uses processes -- that is, the web server will create/dedicate a single process for each request.

There are also other completely different concurrency models (using Asynchronous sockets and I/O), as well as ones that mix two or even three models together. For the purpose of answering this question, we are only concerned with the two models above, and taking Apache HTTP server as an example.

PHP itself does not respond to the actual HTTP requests -- this is the job of the web server. So we configure the web server to forward requests to PHP for processing, then receive the result and send it back to the user. There are multiple ways to chain the web server with PHP. For Apache HTTP Server, the most popular is "mod_php". This module is actually PHP itself, but compiled as a module for the web server, and so it gets loaded right inside it.

There are other methods for chaining PHP with Apache and other web servers, but mod_php is the most popular one and will also serve for answering your question.

You may not have needed to understand these details before, because hosting companies and GNU/Linux distros come with everything prepared for us.

Since with mod_php, PHP gets loaded right into Apache, if Apache is going to handle concurrency using its Worker MPM (that is, using Threads) then PHP must be able to operate within this same multi-threaded environment -- meaning, PHP has to be thread-safe to be able to play ball correctly with Apache!

At this point, you should be thinking "OK, so if I'm using a multi-threaded web server and I'm going to embed PHP right into it, then I must use the thread-safe version of PHP". And this would be correct thinking. However, as it happens, PHP's thread-safety is highly disputed. It's a use-if-you-really-really-know-what-you-are-doing ground.

In case you are wondering, my personal advice would be to not use PHP in a multi-threaded environment if you have the choice!

Speaking only of Unix-based environments, I'd say that fortunately, you only have to think of this if you are going to use PHP with Apache web server, in which case you are advised to go with the prefork MPM of Apache (which doesn't use threads, and therefore, PHP thread-safety doesn't matter) and all GNU/Linux distributions that I know of will take that decision for you when you are installing Apache + PHP through their package system, without even prompting you for a choice. If you are going to use other webservers such as nginx or lighttpd, you won't have the option to embed PHP into them anyway. You will be looking at using FastCGI or something equal which works in a different model where PHP is totally outside of the web server with multiple PHP processes used for answering requests through e.g. FastCGI. For such cases, thread-safety also doesn't matter. To see which version your website is using put a file containing <?php phpinfo(); ?> on your site and look for the Server API entry. This could say something like CGI/FastCGI or Apache 2.0 Handler.

If you also look at the command-line version of PHP -- thread safety does not matter.

Finally, if thread-safety doesn't matter so which version should you use -- the thread-safe or the non-thread-safe? Frankly, I don't have a scientific answer! But I'd guess that the non-thread-safe version is faster and/or less buggy, or otherwise they would have just offered the thread-safe version and not bothered to give us the choice!

So PHP-FPM is not threaded? That solves the problem then since Fast CGI is used on nginx servers.

Awesome detail, I have been programming in PHP for years and never knew this.

@Xeoncross: Generally that's correct, and in practice it's one of the great reasons to manage PHP processes outside of Apache. I go over this aspect in my answer.

Is PHP's thread safety still "highly disputed" (in 2015 and version 7) ?

multithreading - What is thread safe or non-thread safe in PHP? - Stac...

php multithreading thread-safety packages threadcontext
Rectangle 27 552

Needed background on how PHP "integrates" with web servers:

Different web servers implement different techniques for handling incoming HTTP requests in parallel. A pretty popular technique is using threads -- that is, the web server will create/dedicate a single thread for each incoming request. The Apache HTTP web server supports multiple models for handling requests, one of which (called the worker MPM) uses threads. But it supports another concurrency model called the prefork MPM which uses processes -- that is, the web server will create/dedicate a single process for each request.

There are also other completely different concurrency models (using Asynchronous sockets and I/O), as well as ones that mix two or even three models together. For the purpose of answering this question, we are only concerned with the two models above, and taking Apache HTTP server as an example.

PHP itself does not respond to the actual HTTP requests -- this is the job of the web server. So we configure the web server to forward requests to PHP for processing, then receive the result and send it back to the user. There are multiple ways to chain the web server with PHP. For Apache HTTP Server, the most popular is "mod_php". This module is actually PHP itself, but compiled as a module for the web server, and so it gets loaded right inside it.

There are other methods for chaining PHP with Apache and other web servers, but mod_php is the most popular one and will also serve for answering your question.

You may not have needed to understand these details before, because hosting companies and GNU/Linux distros come with everything prepared for us.

Since with mod_php, PHP gets loaded right into Apache, if Apache is going to handle concurrency using its Worker MPM (that is, using Threads) then PHP must be able to operate within this same multi-threaded environment -- meaning, PHP has to be thread-safe to be able to play ball correctly with Apache!

At this point, you should be thinking "OK, so if I'm using a multi-threaded web server and I'm going to embed PHP right into it, then I must use the thread-safe version of PHP". And this would be correct thinking. However, as it happens, PHP's thread-safety is highly disputed. It's a use-if-you-really-really-know-what-you-are-doing ground.

In case you are wondering, my personal advice would be to not use PHP in a multi-threaded environment if you have the choice!

Speaking only of Unix-based environments, I'd say that fortunately, you only have to think of this if you are going to use PHP with Apache web server, in which case you are advised to go with the prefork MPM of Apache (which doesn't use threads, and therefore, PHP thread-safety doesn't matter) and all GNU/Linux distributions that I know of will take that decision for you when you are installing Apache + PHP through their package system, without even prompting you for a choice. If you are going to use other webservers such as nginx or lighttpd, you won't have the option to embed PHP into them anyway. You will be looking at using FastCGI or something equal which works in a different model where PHP is totally outside of the web server with multiple PHP processes used for answering requests through e.g. FastCGI. For such cases, thread-safety also doesn't matter. To see which version your website is using put a file containing <?php phpinfo(); ?> on your site and look for the Server API entry. This could say something like CGI/FastCGI or Apache 2.0 Handler.

If you also look at the command-line version of PHP -- thread safety does not matter.

Finally, if thread-safety doesn't matter so which version should you use -- the thread-safe or the non-thread-safe? Frankly, I don't have a scientific answer! But I'd guess that the non-thread-safe version is faster and/or less buggy, or otherwise they would have just offered the thread-safe version and not bothered to give us the choice!

So PHP-FPM is not threaded? That solves the problem then since Fast CGI is used on nginx servers.

Awesome detail, I have been programming in PHP for years and never knew this.

@Xeoncross: Generally that's correct, and in practice it's one of the great reasons to manage PHP processes outside of Apache. I go over this aspect in my answer.

Is PHP's thread safety still "highly disputed" (in 2015 and version 7) ?

multithreading - What is thread safe or non-thread safe in PHP? - Stac...

php multithreading thread-safety packages threadcontext
Rectangle 27 550

Needed background on how PHP "integrates" with web servers:

Different web servers implement different techniques for handling incoming HTTP requests in parallel. A pretty popular technique is using threads -- that is, the web server will create/dedicate a single thread for each incoming request. The Apache HTTP web server supports multiple models for handling requests, one of which (called the worker MPM) uses threads. But it supports another concurrency model called the prefork MPM which uses processes -- that is, the web server will create/dedicate a single process for each request.

There are also other completely different concurrency models (using Asynchronous sockets and I/O), as well as ones that mix two or even three models together. For the purpose of answering this question, we are only concerned with the two models above, and taking Apache HTTP server as an example.

PHP itself does not respond to the actual HTTP requests -- this is the job of the web server. So we configure the web server to forward requests to PHP for processing, then receive the result and send it back to the user. There are multiple ways to chain the web server with PHP. For Apache HTTP Server, the most popular is "mod_php". This module is actually PHP itself, but compiled as a module for the web server, and so it gets loaded right inside it.

There are other methods for chaining PHP with Apache and other web servers, but mod_php is the most popular one and will also serve for answering your question.

You may not have needed to understand these details before, because hosting companies and GNU/Linux distros come with everything prepared for us.

Since with mod_php, PHP gets loaded right into Apache, if Apache is going to handle concurrency using its Worker MPM (that is, using Threads) then PHP must be able to operate within this same multi-threaded environment -- meaning, PHP has to be thread-safe to be able to play ball correctly with Apache!

At this point, you should be thinking "OK, so if I'm using a multi-threaded web server and I'm going to embed PHP right into it, then I must use the thread-safe version of PHP". And this would be correct thinking. However, as it happens, PHP's thread-safety is highly disputed. It's a use-if-you-really-really-know-what-you-are-doing ground.

In case you are wondering, my personal advice would be to not use PHP in a multi-threaded environment if you have the choice!

Speaking only of Unix-based environments, I'd say that fortunately, you only have to think of this if you are going to use PHP with Apache web server, in which case you are advised to go with the prefork MPM of Apache (which doesn't use threads, and therefore, PHP thread-safety doesn't matter) and all GNU/Linux distributions that I know of will take that decision for you when you are installing Apache + PHP through their package system, without even prompting you for a choice. If you are going to use other webservers such as nginx or lighttpd, you won't have the option to embed PHP into them anyway. You will be looking at using FastCGI or something equal which works in a different model where PHP is totally outside of the web server with multiple PHP processes used for answering requests through e.g. FastCGI. For such cases, thread-safety also doesn't matter. To see which version your website is using put a file containing <?php phpinfo(); ?> on your site and look for the Server API entry. This could say something like CGI/FastCGI or Apache 2.0 Handler.

If you also look at the command-line version of PHP -- thread safety does not matter.

Finally, if thread-safety doesn't matter so which version should you use -- the thread-safe or the non-thread-safe? Frankly, I don't have a scientific answer! But I'd guess that the non-thread-safe version is faster and/or less buggy, or otherwise they would have just offered the thread-safe version and not bothered to give us the choice!

So PHP-FPM is not threaded? That solves the problem then since Fast CGI is used on nginx servers.

Awesome detail, I have been programming in PHP for years and never knew this.

@Xeoncross: Generally that's correct, and in practice it's one of the great reasons to manage PHP processes outside of Apache. I go over this aspect in my answer.

Is PHP's thread safety still "highly disputed" (in 2015 and version 7) ?

multithreading - What is thread safe or non-thread safe in PHP? - Stac...

php multithreading thread-safety packages threadcontext
Rectangle 27 545

Needed background on how PHP "integrates" with web servers:

Different web servers implement different techniques for handling incoming HTTP requests in parallel. A pretty popular technique is using threads -- that is, the web server will create/dedicate a single thread for each incoming request. The Apache HTTP web server supports multiple models for handling requests, one of which (called the worker MPM) uses threads. But it supports another concurrency model called the prefork MPM which uses processes -- that is, the web server will create/dedicate a single process for each request.

There are also other completely different concurrency models (using Asynchronous sockets and I/O), as well as ones that mix two or even three models together. For the purpose of answering this question, we are only concerned with the two models above, and taking Apache HTTP server as an example.

PHP itself does not respond to the actual HTTP requests -- this is the job of the web server. So we configure the web server to forward requests to PHP for processing, then receive the result and send it back to the user. There are multiple ways to chain the web server with PHP. For Apache HTTP Server, the most popular is "mod_php". This module is actually PHP itself, but compiled as a module for the web server, and so it gets loaded right inside it.

There are other methods for chaining PHP with Apache and other web servers, but mod_php is the most popular one and will also serve for answering your question.

You may not have needed to understand these details before, because hosting companies and GNU/Linux distros come with everything prepared for us.

Since with mod_php, PHP gets loaded right into Apache, if Apache is going to handle concurrency using its Worker MPM (that is, using Threads) then PHP must be able to operate within this same multi-threaded environment -- meaning, PHP has to be thread-safe to be able to play ball correctly with Apache!

At this point, you should be thinking "OK, so if I'm using a multi-threaded web server and I'm going to embed PHP right into it, then I must use the thread-safe version of PHP". And this would be correct thinking. However, as it happens, PHP's thread-safety is highly disputed. It's a use-if-you-really-really-know-what-you-are-doing ground.

In case you are wondering, my personal advice would be to not use PHP in a multi-threaded environment if you have the choice!

Speaking only of Unix-based environments, I'd say that fortunately, you only have to think of this if you are going to use PHP with Apache web server, in which case you are advised to go with the prefork MPM of Apache (which doesn't use threads, and therefore, PHP thread-safety doesn't matter) and all GNU/Linux distributions that I know of will take that decision for you when you are installing Apache + PHP through their package system, without even prompting you for a choice. If you are going to use other webservers such as nginx or lighttpd, you won't have the option to embed PHP into them anyway. You will be looking at using FastCGI or something equal which works in a different model where PHP is totally outside of the web server with multiple PHP processes used for answering requests through e.g. FastCGI. For such cases, thread-safety also doesn't matter. To see which version your website is using put a file containing <?php phpinfo(); ?> on your site and look for the Server API entry. This could say something like CGI/FastCGI or Apache 2.0 Handler.

If you also look at the command-line version of PHP -- thread safety does not matter.

Finally, if thread-safety doesn't matter so which version should you use -- the thread-safe or the non-thread-safe? Frankly, I don't have a scientific answer! But I'd guess that the non-thread-safe version is faster and/or less buggy, or otherwise they would have just offered the thread-safe version and not bothered to give us the choice!

So PHP-FPM is not threaded? That solves the problem then since Fast CGI is used on nginx servers.

Awesome detail, I have been programming in PHP for years and never knew this.

@Xeoncross: Generally that's correct, and in practice it's one of the great reasons to manage PHP processes outside of Apache. I go over this aspect in my answer.

Is PHP's thread safety still "highly disputed" (in 2015 and version 7) ?

multithreading - What is thread safe or non-thread safe in PHP? - Stac...

php multithreading thread-safety packages threadcontext
Rectangle 27 1

Surely typing /usr/sbin/apache2 -v into the shell is the best and quickest way to go, by the way here's another option, just in case there's PHP too in your server and you're interested into gathering Apache version (and much more infos) in quick programmatical steps.

Just make an info.php file in your Apache web root folder (or whatever you like) and write these inside it:

<?php
    phpinfo();
?>

You'll see your Apache version in PHP Variables section, here's an example:

Also, please notice that these steps obviously apply to any web server with PHP integration, so it's not limited to Apache and once created that page could be handy while developing (just don't forget to remove it on production environments!!)

Version of Apache installed on a Debian machine - Stack Overflow

apache debian version
Rectangle 27 11

You shouldn't use PHP for downloading files because it's a task for an Apache or Nginx server. Best option is to use X-Accel-Redirect (in case of Nginx) / X-Sendfile (in case of Apache) headers for file downloading.

Following action snippet can be used with configured Nginx to download files from Symfony2:

UPD1: Code for apache with configured mod_xsendfile:

return new Response('', 200, array(
    'X-Sendfile'          => $filename,
    'Content-type'        => 'application/octet-stream',
    'Content-Disposition' => sprintf('attachment; filename="%s"', $filename))
));
X-Sendfile
X-Accel-Redirect

php - Symfony2 - Force file download - Stack Overflow

php symfony header download
Rectangle 27 12

These are the steps to follow when you want your PHP application to be installed on a LAN server (not on web)

  • Get the internal IP or Static IP of the server (Ex: 192.168.1.193)
  • Open XAMPP>apache>conf>httpd.conf file in notepad
  • Change the IP address and replace it with the static IP
  • Save the httpd.conf file ensuring that the server is pointed to #Listen 192.168.1.193:80
  • In the application root config.php (db connection) replace localhost with IP address of the server

Note: If firewall is installed, ensure that you add the http port 80 and 8080 to exceptions and allow to listen. Go to Control Panel>Windows Firewall>Allow a program to communicate through windows firewall>Add another program Name: http Port: 80 Add one more as http - 8080

If IIS (Microsoft .Net Application Internet Information Server) is installed with any Microsoft .Net application already on server, then it would have already occupied 80 port. In that case change the #Listen 192.168.1.193:80 to #Listen 192.168.1.193:8080

I need the solution with iis but its not working

This solved it for me. Great stuff! I always had deleted the # in front of the local IP address and it was not working, when I included the comment hash # it worked out of the box without restarting the guest VM, just the XAMPP Apache service and bang it is there. Nice one. Now how do I get it to link to my assigned VirutalHosts on the Host machine?

To access the assigned VirtualHosts on the Host machine from the guest I simply had to enter the Host's IP and the name of the VirtualHost server(s) in the Guest's HOSTS file. Done. Anyone know how to pick up traffic from the Guest's browser to the Hosts Apache server with Fiddler. Work on the Host but not getting traffic from guest.

Hi, what about a range of IP addresses for e.g. 192.168.1-100. How to set that?

apache - Accessing localhost (xampp) from another computer over LAN ne...

apache xampp localhost httpd.conf
Rectangle 27 1

This functionality cannot be implemented using only PHP. You need to configure URL rewriting for your HTTP server, which will transform the user-friendly URLs into query strings which your scripts can understand. In the case of Apache, you should look into mod_rewrite, which can usually be configured through .htaccess files.

php - User-friendly URLs instead of Query Strings? - Stack Overflow

php url
Rectangle 27 1

This functionality cannot be implemented using only PHP. You need to configure URL rewriting for your HTTP server, which will transform the user-friendly URLs into query strings which your scripts can understand. In the case of Apache, you should look into mod_rewrite, which can usually be configured through .htaccess files.

php - User-friendly URLs instead of Query Strings? - Stack Overflow

php url
Rectangle 27 1

My guess is that the PHP process is killed by the server due to some (mis)configuration on your host (I suspect that mod_fastcgi/mod_fcgid is used; you can check this with phpinfo()). Also, you execute the call on each 10 seconds which could hit some limit. What I would do in your case:

mod_fastcgi
mod_fcgid
Server API
phpinfo()
  • Check the Apache access_log and see if a pattern exists for 500 status code for script is_it_midnight.php.
  • Try to increase the setInterval refresh time to 15s, 20s, 25s, 30s and etc. to see if there is any improvement.
  • Place error_log (memory_get_usage()); before echo json_encode($is_it_midnight); to see what is the memory usage allocated to the script (although it is very unlikely that the memory usage is a problem given the small script).

php - How to get more information about error 500 - internal server er...

php ajax apache http internal-server-error
Rectangle 27 8

How is PHP being run? If it's through Apache mod_cgi, I'm afraid you cannot get hold of the authentication information at all. Apache won't pass it to CGI apps unless you compile it with the SECURITY_HOLE_PASS_AUTHORIZATION flag. (Whether it's actually a security hole or not depends on whether other users on your server have a lower or greater privilege than your website users.)

If it's IIS CGI, you have to ensure that only Anonymous directory access is configured, or IIS will try to step in and authenticate credentials itself.

echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";

HTML-injection security hole (well, if it worked). Use htmlspecialchars(). Man, is that PHP doc page full of highly questionable advice and code.

You can try to look at $_SERVER['HTTP_AUTHORIZATION'] as well, though I suspect it's the mod_cgi issue in which case neither variable will be present and you will have to resort to cookie-based login instead. Or change to a host with a more modern approach to PHP hosting, such as FastCGI or mod_php.

How can I use Basic HTTP Authentication in PHP? - Stack Overflow

php authentication http-authentication http-basic-authentication server-variables
Rectangle 27 4

How to upgrade php in xampp:-

  • Lots of time you need to use multiple version of php for your different project. In this case either you want to install xampp on different port or you can install one xampp and upgrade php. In this article I will demonstrate how you can upgrade php in your xampp server. I will demonstrate the complete process by adding PHP 5.4 with XAMPP. Following is the step by step process of upgrading php in your xampp server. Before trying these steps please take complete backup of your code and database alognwith xampp because any small mistake can lead to the corruption of your regular XAMPP.

Upgrade PHP in XAMPP server

  • Download PHP : If you are using xampp ofcourse you are using windows operating system. So first download your desired version of php binary from http://windows.php.net/download/ website. Be careful while choosing binary. If you are using XAMPP then your webserver is apache. So always download Thread Safe binary. Also read the compiler suggestion carefully on the windows.php.net site. I will recommend to download zip version.

Configure New PHP Version with your xampp: Unzip the downloaded version of the PHP in a separate folder. Please make sure that your new php folder name is not PHP. May be you can use filder name as the version name. For example for php 5.4 you can use php54. Copy the new php folder into your xampp folder. Now go to yourxampp/apache/conf/extra folder. Open file httpd-xampp.conf from the folder extra. Change the following variables:

Save the file httpd-xampp.conf. Restart your XAMPP apache server. If your server get restarted successfully then your server php version is upgraded. You can check the status of your php version by URL http://localhost/xampp/phpinfo.php .

Simply place the new package folder with the name "php" is working. Why we have to go for long method. If you want backup just rename the older one.

yes,according to our requirement we can follow methods.

Upgrade PHP on XAMPP 1.8.3 windows 7 installation - Stack Overflow

php xampp
Rectangle 27 1

If you are running PHP in "CGI mode" and not as an Apache module, then using php_value as such will throw that "Internal Server Error". In such case, set upload_max_filesize in php.ini.

php - php_value is not working in .htaccess files - Stack Overflow

php .htaccess
Rectangle 27 1

I would say definitions vary. In the generalized context, a Web Server is a server that can receive incoming web-requests and have knowledge about how they should be handled and responded to. Some requests are static (html files, images etc), some are dynamic. In the case of dynamic requests, the web server will know where to route handling of the request, could be a JSP page or a java servlet, a PHP script, a perl CGI script etc etc.

While the "web server" in this context executes the dynamic handler, it is not considered to include any supporting middleware features for the dynamic handler.

An Application Server, by contrast, is a general execution environment that offers some type of middleware tier support. Examples are EJB containers or the .NET framework built into Windows (in where Windows in itself is an "application server"). There is no inherent requirement that an application-server have anything to do with web requests (although many do), it's just a general execution context and container for any type of application that offers some sort of additional middleware support.

In a purely web-centric context, many people will draw the line at static vs dynamic content. In this definition, a "web server" can only handle requests for static information itself and it will pass on requests for dynamic content to the "application server". For example, Apache httpd is a web server and Tomcat is an application server. IIS is a combination of both. In the Java web world, an application server can be either a servlet container (like Tomcat), or a full blown Java EE container (like JBoss, WebLogic or WebSphere) that provides the Java EE middleware support (EJB) container in addition to the servlet container.

java - Difference between web server and application server - Stack Ov...

java web-applications webserver weblogic application-server
Rectangle 27 1

I realize this is an old question, but I started having the same issue today on Apache running on a Linode virtual server. In my case, the solution was simply to enable Zend Opcache. It was disabled due to an error in one of the ini files in '/etc/php5/apache2/conf.d/' directory.

I was getting intermittent errors, where most of the time pages and images would load just fine, but once in a while they would fail. Images would be broken and instead of seeing a page I would get "connection error".

These are some additional errors I was seeing in the Apache's error.log file:

[core:notice] [pid 8186] AH00052: child pid 9008 exit signal Segmentation fault (11)
[core:notice] [pid 8186] AH00052: child pid 9007 exit signal Aborted (6)
*** Error in `/usr/sbin/apache2': free(): invalid pointer: 0x00007f56840b63c0 ***

and of course the infamous:

[:error] [pid 8829] [client nnn.nnn.nnn.n:24471] PHP Fatal error:
  Allowed memory size of 134217728 bytes exhausted (tried to 
  allocate 94008222532912 bytes) in Unknown on line 0, referer:
  https://www.mysiteurlhere.com/node/page

After enabling zend opcache, there are no more errors in error.log, and everything works as it should.

php - PhpMyAdmin | Fatal error: Allowed memory size of 134217728 bytes...

php mysql phpmyadmin fatal-error
Rectangle 27 1

I realize this is an old question, but I started having the same issue today on Apache running on a Linode virtual server. In my case, the solution was simply to enable Zend Opcache. It was disabled due to an error in one of the ini files in '/etc/php5/apache2/conf.d/' directory.

I was getting intermittent errors, where most of the time pages and images would load just fine, but once in a while they would fail. Images would be broken and instead of seeing a page I would get "connection error".

These are some additional errors I was seeing in the Apache's error.log file:

[core:notice] [pid 8186] AH00052: child pid 9008 exit signal Segmentation fault (11)
[core:notice] [pid 8186] AH00052: child pid 9007 exit signal Aborted (6)
*** Error in `/usr/sbin/apache2': free(): invalid pointer: 0x00007f56840b63c0 ***

and of course the infamous:

[:error] [pid 8829] [client nnn.nnn.nnn.n:24471] PHP Fatal error:
  Allowed memory size of 134217728 bytes exhausted (tried to 
  allocate 94008222532912 bytes) in Unknown on line 0, referer:
  https://www.mysiteurlhere.com/node/page

After enabling zend opcache, there are no more errors in error.log, and everything works as it should.

php - PhpMyAdmin | Fatal error: Allowed memory size of 134217728 bytes...

php mysql phpmyadmin fatal-error
Rectangle 27 695

The HTTP_HOST is obtained from the HTTP request header and this is what the client actually used as "target host" of the request. The SERVER_NAME is defined in server config. Which one to use depends on what you need it for. You should now however realize that the one is a client-controlled value which may thus not be reliable for use in business logic and the other is a server-controlled value which is more reliable. You however need to ensure that the webserver in question has the SERVER_NAME correctly configured. Taking Apache HTTPD as an example, here's an extract from its documentation:

If no ServerName is specified, then the server attempts to deduce the hostname by performing a reverse lookup on the IP address. If no port is specified in the ServerName, then the server will use the port from the incoming request. For optimal reliability and predictability, you should specify an explicit hostname and port using the ServerName directive.

Update: after checking the answer of Pekka on your question which contains a link to bobince's answer that PHP would always return HTTP_HOST's value for SERVER_NAME, which goes against my own PHP 4.x + Apache HTTPD 1.2.x experiences from a couple of years ago, I blew some dust from my current XAMPP environment on Windows XP (Apache HTTPD 2.2.1 with PHP 5.2.8), started it, created a PHP page which prints the both values, created a Java test application using URLConnection to modify the Host header and tests taught me that this is indeed (incorrectly) the case.

After first suspecting PHP and digging in some PHP bug reports regarding the subject, I learned that the root of the problem is in web server used, that it incorrectly returned HTTP Host header when SERVER_NAME was requested. So I dug into Apache HTTPD bug reports using various keywords regarding the subject and I finally found a related bug. This behaviour was introduced since around Apache HTTPD 1.3. You need to set UseCanonicalName directive to on in the <VirtualHost> entry of the ServerName in httpd.conf (also check the warning at the bottom of the document!).

<VirtualHost *>
    ServerName example.com
    UseCanonicalName on
</VirtualHost>

Summarized, SERVER_NAME is more reliable, but you're dependent on the server config!

Okay, this solves my problem, which is unrelated to the OP but relevant. I was very concerned about security issues by using anything that a browser could supply. This answer was a HUGE help. Thank you for taking the time to put it together.

Why do you say HTTP_HOST is not reliable? Yes it is supplied by the user, but if the user give some bogus value, your server config would automatically return 503 and your PHP script wouldn't even be run!

@Pacerier: at the time of writing this answer, it did not. Versions are mentioned in the answer. I don't keep up with PHP anymore, so I can't say if it has indeed changed in a newer version.

An easy way to trick Apache from WinXP is to add a line to 'hosts' file stating that the IP of the server is assigned to another domain, like this: "127.0.0.1 mydomain.com". I've used this a lot of times to show a local website tricking my audience to think I've got internet connection and site loaded really fast. You could go the other way, and trick Apache to think it's running locally, with "173.194.41.5 localhost", so you should never trust SERVER_NAME fully unless you are sure your Apache is well configured.

I just want to add, that NGINX+PHP-FPM returns the value set by the server_name directive. Especially if no server_name is set also _SERVER["SERVER_NAME"] will be empty.

apache - What is the difference between HTTP_HOST and SERVER_NAME in P...

php apache server-variables
Rectangle 27 694

The HTTP_HOST is obtained from the HTTP request header and this is what the client actually used as "target host" of the request. The SERVER_NAME is defined in server config. Which one to use depends on what you need it for. You should now however realize that the one is a client-controlled value which may thus not be reliable for use in business logic and the other is a server-controlled value which is more reliable. You however need to ensure that the webserver in question has the SERVER_NAME correctly configured. Taking Apache HTTPD as an example, here's an extract from its documentation:

If no ServerName is specified, then the server attempts to deduce the hostname by performing a reverse lookup on the IP address. If no port is specified in the ServerName, then the server will use the port from the incoming request. For optimal reliability and predictability, you should specify an explicit hostname and port using the ServerName directive.

Update: after checking the answer of Pekka on your question which contains a link to bobince's answer that PHP would always return HTTP_HOST's value for SERVER_NAME, which goes against my own PHP 4.x + Apache HTTPD 1.2.x experiences from a couple of years ago, I blew some dust from my current XAMPP environment on Windows XP (Apache HTTPD 2.2.1 with PHP 5.2.8), started it, created a PHP page which prints the both values, created a Java test application using URLConnection to modify the Host header and tests taught me that this is indeed (incorrectly) the case.

After first suspecting PHP and digging in some PHP bug reports regarding the subject, I learned that the root of the problem is in web server used, that it incorrectly returned HTTP Host header when SERVER_NAME was requested. So I dug into Apache HTTPD bug reports using various keywords regarding the subject and I finally found a related bug. This behaviour was introduced since around Apache HTTPD 1.3. You need to set UseCanonicalName directive to on in the <VirtualHost> entry of the ServerName in httpd.conf (also check the warning at the bottom of the document!).

<VirtualHost *>
    ServerName example.com
    UseCanonicalName on
</VirtualHost>

Summarized, SERVER_NAME is more reliable, but you're dependent on the server config!

Okay, this solves my problem, which is unrelated to the OP but relevant. I was very concerned about security issues by using anything that a browser could supply. This answer was a HUGE help. Thank you for taking the time to put it together.

Why do you say HTTP_HOST is not reliable? Yes it is supplied by the user, but if the user give some bogus value, your server config would automatically return 503 and your PHP script wouldn't even be run!

@Pacerier: at the time of writing this answer, it did not. Versions are mentioned in the answer. I don't keep up with PHP anymore, so I can't say if it has indeed changed in a newer version.

An easy way to trick Apache from WinXP is to add a line to 'hosts' file stating that the IP of the server is assigned to another domain, like this: "127.0.0.1 mydomain.com". I've used this a lot of times to show a local website tricking my audience to think I've got internet connection and site loaded really fast. You could go the other way, and trick Apache to think it's running locally, with "173.194.41.5 localhost", so you should never trust SERVER_NAME fully unless you are sure your Apache is well configured.

I just want to add, that NGINX+PHP-FPM returns the value set by the server_name directive. Especially if no server_name is set also _SERVER["SERVER_NAME"] will be empty.

apache - What is the difference between HTTP_HOST and SERVER_NAME in P...

php apache server-variables