Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: dentonlt on March 08, 2010, 05:51:43 AM
-
I know that more than one person has been through this. I've read lots of manuals (apache, PHP, others ...), and I just can't get Apache + PHP working.
* TC 2.9
* Installed PHP, MySQL, Apache
* followed PHP info file instructions, repeatedly
* followed apache info file instructions, repeatedly
PHP works fine from the command line, but I can't get it to work from the browser. error_log says:
(8)Exec format error: exec of '/usr/local/htdocs/index.php' failed, referrer: http://127.0.0.1/
Premature end of script headers: index.php, referrer: http://127.0.0.1/
my index.php is simple:
<?php phpinfo(); ?>
I read Rob's advice about using lighttpd instead, but I'd reeeeely like this to work on apache. I am trying to duplicate a production server that runs debian+apache+drupal.
I am afraid that I have to recompile PHP and create the apache libphp5.so module, then load that in httpd.conf?
Any/all advice welcome!
-
Most likely this seems to be a user/group rights problem of the cgi script and apache.
Did you follow the advise in the apache help?
The most common cause of this problem is the script dying before sending the complete set of headers, or possibly any at all, to the server. To see if this is the case, try running the script standalone from an interactive session, rather than as a script under the server. If you get error messages, this is almost certainly the cause of the "premature end of script headers" message. Even if the CGI runs fine from the command line, remember that the environment and permissions may be different when running under the web server. The CGI can only access resources allowed for the User and Group specified in your Apache configuration. In addition, the environment will not be the same as the one provided on the command line, but it can be adjusted using the directives provided by mod_env.
(found at http://httpd.apache.org/docs/1.3/misc/FAQ-F.html#premature-script-headers )
-
I know that more than one person has been through this. I've read lots of manuals (apache, PHP, others ...), and I just can't get Apache + PHP working.
* TC 2.9
* Installed PHP, MySQL, Apache
* followed PHP info file instructions, repeatedly
* followed apache info file instructions, repeatedly
PHP works fine from the command line, but I can't get it to work from the browser. error_log says:
(8)Exec format error: exec of '/usr/local/htdocs/index.php' failed, referrer: http://127.0.0.1/
Premature end of script headers: index.php, referrer: http://127.0.0.1/
my index.php is simple:
<?php phpinfo(); ?>
I read Rob's advice about using lighttpd instead, but I'd reeeeely like this to work on apache. I am trying to duplicate a production server that runs debian+apache+drupal.
I am afraid that I have to recompile PHP and create the apache libphp5.so module, then load that in httpd.conf?
Any/all advice welcome!
I've been through this several times and have found that it's hard to beat using the Xampp stack approach. The only problem I have had is php moving to version 5.3 which deprecated several functions causing many php programs to fail. But now time has passed by and most programs of any significance have been updated. The Xampp team keeps the "stack" up to date and insures everything works "right out of the box". Give it a try to see how everything works and then you can always go back to the "build your own" approach.
-
I too would suggest to look at XAMPP. It easily installs to /opt
Use Tiny Core's persistent /opt and you are set to go.
-
Have you used a #!/usr/local/bin/php shebang? I've found that since I updated php to 5.3.1 apache likes to have the shebang, though previously it didn't. You can also try /usr/local/bin/php-cgi
I find apache a bit cumbersome compared to lighttpd, both on resources and setup. Why do you want/need to use apache?
-
gutmensch: that is something I hadn't seen - I'll definitely dig that one up and try.
robc/roberts/bigpcman: yep, downloading xampp now. I'll give that a try, too. As mentioned, I'm trying to copy a production server setup (commercial installation), but the xampp set is pretty close.
It will be the weekend again when I get time for this, but I'll report back!
-
gutmensch: that is something I hadn't seen - I'll definitely dig that one up and try.
robc/roberts/bigpcman: yep, downloading xampp now. I'll give that a try, too. As mentioned, I'm trying to copy a production server setup (commercial installation), but the xampp set is pretty close.
It will be the weekend again when I get time for this, but I'll report back!
As a reminder when unpacking Xampp, tar needs to have the 'f' switch at the end, as anything after that is taken as the input filename. `tar zxvf somefile.tar.gz ` should work.
Also the Xampp scripts are written assuming the Bash shell is present so you will need to install the bash.tcz extension.
Edit: Here's a couple of mod tips for Xampp:
- To enable web pages with php code to run using an html extension (webpage.html) add to the apache config file (/opt/lampp/etc/httpd.conf) "AddType application/x-httpd-php .html"
- There are several php configuration options (/opt/lampp/etc/php.ini) that can be set for different execution environments such as development or production. I found it useful to change some of the options to use the production environment option. The most important option change for me was to turn off php error reporting (display_errors = Off) since I found that many php applications are still generating error messages when running under PHP 5.3. They run fine but mess up the html webpage rendering.
-
roberts: thanks for suggesting persistent /opt. Only catch ... no luck getting persistent opt to work. I scourged the wiki + forum, but must have missed something important. If there are directions somewhere, I'll appreciate a point in the right direction.
I use persistent home, no problem (home=hda2). Easy to set, stable on reboot.
I've added boot arg opt=hda2, but I get nothing on hda2. /opt directory stills reside in RAM, so all is lost on reboot. I've tried a few things (I had/removed an hda2/opt directory from Xubuntu; changed permissions, etc. etc.).
Perhaps my backup file is overwriting the directory set by the boot code? I don't have /opt in filetool, though ... just files ...
EDIT: Yep, xampp working. Good to load firewall + bash extensions. I had to change the file permissions of opt/lampp/htdocs/xampp/lang.tmp to 666, but I think I'm good to go. I'll edit all the config files and such as I go.
-
/opt problem fixed. Totally don't know how or why, but ... it just works now.
Problem fixed, thread closed.