Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I installed PHP 5.4 on Debian from source and I run php scripts on the PHP Built-in web server with new php features without any error but php scripts do not run with apache2 with new php features.

I did not understand the relationship between php and apache2 completely. So I have a few questions:

  1. I can run php scripts with the built-in php server, so is the built-in web server enough to serve php script without any web server such as apache or nginx ? (If you say no, please explain why. )
  2. How can I use PHP 5.4 with apache2 ?
  3. Why does apache2 not interpret new PHP features even though I installed PHP 5.4 ?
  4. Must I compile apache2 again? If so, why ?
  5. What is the relationship betwen apache2, mod_php module and php ?
share|improve this question

migrated from stackoverflow.com Mar 7 '12 at 17:25

This question came from our site for professional and enthusiast programmers.

    
(reference) php.net/migration54 –  Gordon Mar 7 '12 at 17:17
1  
2  
remaining questions belong on ServerFault IMO. –  Gordon Mar 7 '12 at 17:19
    
Thanks @Gordon for useful links –  mesuutt Mar 8 '12 at 8:38

1 Answer 1

up vote 0 down vote accepted

I can run php script with built-in php server, so Does built-in web server enough to serve php script without any web server such as apache or nginx ? (If you say no, why? )

  • Yes, but ONLY for development. The built in server is very primitive and not meant for production in any shape or form.

How can I use php 5.4 with apache2?

  • Install via your distro package manager (if available in a repo) - or compile it; I'd highly suggest you install the Apache devel headers for your mpm. Look into the configure option '--with-apxs2' in the documentation which takes an extra step out of configuration for apache.

Why apache2 does not interpret new PHP features although that I installed PHP 5.4 ?

  • If you restarted Apache and it's still running say, 5.3 - then You didn't install or configure it correctly when compiled.

Do I must compile apache2 again , why ?

  • Not enough information to help you out on this

How does process relation among apache2,mod_php module and php ?

  • Without being too winded: Apache configuration loads the php module (a mere 'key' mapped to the module) which is a .so file. Then it associates files of the PHP filetype to be processed with that SAPI.
share|improve this answer
    
thanks @thinice :) –  mesuutt Mar 8 '12 at 8:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.