User login

Apache, PHP, and disaster

Help! I've installed Apache 2.2 and PHP 5.2 and all my PHP is printed plain text!

Isn't this right?

# Use for PHP 5.x:
LoadModule php5_module        modules/libphp5.so
AddHandler php5-script php

PHP and Apache are both running, appear to know about each other, but cannot get PHP files to be interpreted? This is an emergency help situation.

I'd say it happens to the best of us, but modesty precludes.

I threw into httpd.conf:

AddType application/x-httpd-php .php

PHPIniDir "/usr/local/apache2/php/php.ini"

one of them did it.

OK, PHP is now recognized. Now it seems to be the same problem as before-- I understand the Zend optimizer has to be turned off, was that in PHP.ini?

It is: zend_optimizer.enable_loader = 0 or zend_optimizer.optimization_level=0 would do it, but that (probably) wasn't the problem in this case.

The problem was short tags (<? ?>) in a custom theme-- turned short tags on for now in PHP.ini.

Now it seems there are still some settings wrong in httpd.conf... index.php shows up, but the document root isn't quite working right...

Set the document root (not server root!) to the very top directory you want the page served from. We'll deal with virtual domains some other time...

Help! I've installed Apache 2.2 and PHP 5.2 and all my PHP is printed plain text!

Isn't this right?

# Use for PHP 5.x:
LoadModule php5_module        modules/libphp5.so
AddHandler php5-script php

PHP and Apache are both running, appear to know about each other, but cannot get PHP files to be interpreted? This is an emergency help situation.

I'd say it happens to the best of us, but modesty precludes.

I threw into httpd.conf:

AddType application/x-httpd-php .php

PHPIniDir "/usr/local/apache2/php/php.ini"

one of them did it.

OK, PHP is now recognized. Now it seems to be the same problem as before-- I understand the Zend optimizer has to be turned off, was that in PHP.ini?

It is: zend_optimizer.enable_loader = 0 or zend_optimizer.optimization_level=0 would do it, but that (probably) wasn't the problem in this case.

The problem was short tags (<? ?>) in a custom theme-- turned short tags on for now in PHP.ini.

Now it seems there are still some settings wrong in httpd.conf... index.php shows up, but the document root isn't quite working right...

Set the document root (not server root!) to the very top directory you want the page served from. We'll deal with virtual domains some other time...

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.