Apache2 shows blank page because of 000-default? - zend-framework

My situation got Zend Framework involved.
My 000-default looks like this:
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/html/zend/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/html/zend/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Whenever I am trying to use the following urls:
http://localhost
http://localhost/index.php
http://localhost/sdfkljdsflkjsddlsfkjsd
I am getting a blank page.
When I create a new php file with "echo phpinfo();", it's working fine.
So is there something wrong with my 000-default file or is there anything else that might cause this problem?

Seems I was blinded by my rage, so here's what happened.
After I looked in the error log, I found these lines:
[Sun Aug 18 17:42:00.448057 2019] [:error] [pid 17126] [client 127.0.0.1:45934] PHP Warning: require_once(Zend/Application.php): failed to open stream: No such file or directory in /var/www/html/zend/public/index.php on line 18
[Sun Aug 18 17:42:00.448116 2019] [:error] [pid 17126] [client 127.0.0.1:45934] PHP Fatal error: require_once(): Failed opening required 'Zend/Application.php' (include_path='/var/www/html/zend/library:.:/usr/share/php') in /var/www/html/zend/public/index.php on line 18
I copied the Zend Library to /usr/share/ZendFramework-1.12.20/ because it was recommended somewhere. And yet my local project had to know about the library, so I placed a softlink to that folder.
Previously I was so smart and copied THE WHOLE folder (with /bin, etc.) into the local project's library folder.
It's working now. Learning from mistakes never felt so good.

Related

How do I set up a reverse proxy in ISPConfig?

Is it possible to set up a reverse proxy in ISPConfig?
I tried this setting on a subdomain, but I only receive a error 500.
The /var/www/influxdb2.*******.***/log/error.log says the following:
==> error.log <==
[Fri Jan 01 21:24:15.963158 2021] [proxy:warn] [pid 30333] [client ***.***.***.***:59356] AH01144: No protocol handler was valid for the URL /favicon.ico (scheme 'http'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule., referer: https://influxdb2.*******.***/
For me, the proxy_http mod was missing.
Enable it via sudo a2enmod proxy_http and restart your apache with systemctl restart apache2 (thanks to https://serverfault.com/questions/773449/no-protocol-handler-valid-for-the-url-with-httpd-mod-proxy-balancer).
Also note that the "redirect type" setting sometimes seems to reset itself to "none" on saving (or at least does not display the correct value on loading the page as of ISPConfig 3.2.1). So double check that setting if something does not work.
For the "Domain" tab, settings are pretty straightforward. Just enter your domain and probably enable Let's Encrypt.
Note that this seems to use mod_rewrite for proxying. The Apache2 documentation on mod_rewrite states that better ProxyPass of mod_proxy should be used instead. So if anything breaks with some applications, this might be a starting point for further investigations (worked for me for reverse proxying to the HTTP endpoint of InfluxDB 2.0.3 at http://localhost:8086).

WSGIDaemonProcess does not affect python site

On a single CentOS server I want to manage multiple Django applications, one per domain, using virtual hosts and virtualenvs (each application has its own virtual environment).
I will present here my configuration, the logs produced and explain what I am expecting (but failing) to see.
I am using mod_wsgi 4.4 and software collections rh-python34 and httpd24.
My virtual hosts are configured like this:
Global configuration
Define RROOT "/opt/rh/httpd24/root"
Define RDOCROOT "/opt/rh/httpd24/root/var/www"
WSGIScriptAlias /wsgi "${RDOCROOT}/wsgi-bin"
WSGIProcessGroup localhost
<Directory "${RDOCROOT}/wsgi-bin">
Order allow,deny
Allow from all
</Directory>
With the above config, I would like to take care of the server accessed by IP, e.g. going to 123.123.123.123:80/wsgi/ should run the scripts in RDOCROOT/wsgi-bin. It doesn't work, and actually the request on the IP address is handled by the first virtual host. But this is a side question.
Per virtual-host configuration (DOMAIN.COM changes, e.g. example1.com, example2.com)
<VirtualHost *:80>
ServerName DOMAIN.COM
ServerAdmin webmaster#DOMAIN.COM
DocumentRoot "${RDOCROOT}/DOMAIN.COM/html"
ErrorLog "${RDOCROOT}/DOMAIN.COM/error.log"
CustomLog "${RDOCROOT}/DOMAIN.COM/access.log" combined
<Directory "${RDOCROOT}/DOMAIN.COM/html">
Options FollowSymLinks
AllowOverride All
Require all granted
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "http://DOMAIN.COM"
</IfModule>
</Directory>
ScriptAlias /cgi/ "${RDOCROOT}/DOMAIN.COM/cgi-bin/"
<Directory "${RDOCROOT}/DOMAIN.COM/cgi-bin">
AllowOverride None
Options None
Require all granted
AddDefaultCharset utf-8
</Directory>
WSGIDaemonProcess DOMAIN.COM python-path=${RDOCROOT}/DOMAIN.COM/wsgi:${RDOCROOT}/DOMAIN.COM/django-venv/lib/python3.4/site-packages/
WSGIProcessGroup DOMAIN.COM
WSGIScriptAlias /wsgi/ "${RDOCROOT}/DOMAIN.COM/wsgi-bin/"
<Directory "${RDOCROOT}/DOMAIN.COM/wsgi-bin">
Require all granted
</Directory>
</VirtualHost>
So, virtual hosts should have the html pages in DOMAIN.COM/, the /cgi-bin/ scripts in DOMAIN.COM/cgi/ and the /wsgi-bin/ scripts in DOMAIN.COM/wsgi/, and all of them work.
The problem is that the virtual env has no effect: packages from that virtual env cannot be loaded. To debug, I set the log level to info and created a test script that just fails printing the site packages directories:
$ cat wsgi-bin/app.py
import site
raise RuntimeError('Site {} {}'.format(site.getuserbase(), site.getsitepackages()))
When I access DOMAIN.COM/wsgi/app.py, error.log contains the following (without prefixes, timestamps and pids):
mod_wsgi (pid=20267): Attach interpreter ''.
mod_wsgi (pid=20267): Adding '(null)' to path.
mod_wsgi (pid=20267): Adding '/opt/rh/httpd24/root/var/www/DOMAIN.COM/django-venv/lib/python3.4/site-packages/' to path.
mod_wsgi (pid=20267): Create interpreter 'WWW.DOMAIN.COM:80|/wsgi/app.py'.
mod_wsgi (pid=20267): Adding '(null)' to path.
mod_wsgi (pid=20267): Adding '/opt/rh/httpd24/root/var/www/DOMAIN.COM/django-venv/lib/python3.4/site-packages/' to path.
[remote SOMEIP] mod_wsgi (pid=20267, process='WWW.DOMAIN.COM', application='WWW.DOMAIN.COM:80|/wsgi/app.py'): Loading WSGI script '/opt/rh/httpd24/root/var/www/DOMAIN.COM/wsgi-bin/app.py'.
[remote SOMEIP] mod_wsgi (pid=20267): Target WSGI script '/opt/rh/httpd24/root/var/www/DOMAIN.COM/wsgi-bin/app.py' cannot be loaded as Python module.
[remote SOMEIP] mod_wsgi (pid=20267): Exception occurred processing WSGI script '/opt/rh/httpd24/root/var/www/DOMAIN.COM/wsgi-bin/app.py'.
[remote SOMEIP] Traceback (most recent call last):
[remote SOMEIP] File "/opt/rh/httpd24/root/var/www/DOMAIN.COM/wsgi-bin/app.py", line 5, in <module>
[remote SOMEIP] raise RuntimeError('Site {} {}'.format(site.getuserbase(), site.getsitepackages()))
[remote SOMEIP] RuntimeError: Site /usr/share/httpd/.local ['/opt/rh/rh-python34/root/usr/lib64/python3.4/site-packages', '/opt/rh/rh-python34/root/usr/lib/python3.4/site-packages', '/opt/rh/rh-python34/root/usr/lib/site-python']
From the third line of the log it seems that the virtualenv is added correctly to the sites, but from the last line, produced by the script, appears that system-wide site-packages are used.
The directories are correct, double-checked.
Where am I failing?
WSGIPythonHome
For virtualenv installations, you may need to specifically use WSGIPythonHome instead.
WSGIPythonHome ${RDOCROOT}/DOMAIN.COM/django-venv/
Configuring WSGIDaemonProcess with python-path
You may need to change the paths you provide:
WSGIDaemonProcess DOMAIN.COM python-path=${RDOCROOT}/DOMAIN.COM/wsgi:${RDOCROOT}/DOMAIN.COM/django-venv/lib/python3.4/site-packages/
to only use one of them (see also release notes for mod_wsgi 4.4.15)
WSGIDaemonProcess DOMAIN.COM python-path=${RDOCROOT}/DOMAIN.COM/django-venv/lib/python3.4/site-packages/
Recompiling for other python
In some instances, you may need to recompile mod_wsgi for that particular python version in addition to the WSGIPythonHome or python-path tricks.
Configuring site directly in wsgi application
As a last resort, you can configure site packages in the wsgi app.py:
import site
site.addsitedir('/opt/rh/httpd24/root/var/www/DOMAIN.COM/django-venv/lib/python3.4/site-packages')
mod_wsgi known issues with WSGIPythonPath
From the release notes for mod_wsgi 4.4.15:
When specifying multiple directories for the Python module search path using the WSGIPythonPath directive, or the python-path option to WSGIDaemonProcess, it was failing under Python 3 due to incorrect logging. It was therefore only possible to add a single directory.

installation error typo3-neos- 500 internal server error

I have downloaded typo3-neos using php c:/xampp/Composer/bin/composer.phar create-project --dev --stability alpha typo3/neos-base-distribution TYPO3-Neos-1.0-alpha
my httpd.conf is :
<VirtualHost *:80>
ServerName neos.demo
DocumentRoot c:/xampp/htdocs/Typo3-Neos/Web/
SetEnv APPLICATION_ENV "development"
<Directory c:/xampp/htdocs/Typo3-Neos/Web/>
DirectoryIndex index.php
AllowOverride FileInfo Options=MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and vhost is: 127.0.0.1 neos.demo
I am geting the follwing 500 Internal Server Error (a snippet)
1355480641: Execution of subprocess failed with exit code 1 without any further output.
(Please check your PHP error log for possible Fatal errors)
More information
TYPO3\Flow\Core\Booting\Exception\SubProcessException thrown in file
C:\xampp\htdocs\TYPO3-Neos\Packages\Framework\TYPO3.Flow\Classes\TYPO3\Flow\Core\Booting\Scripts.php in line 532.
Reference code: 201310091327354b04b0
I have divided screenshot of the complete error page into three parts (error1.png, error2.png, error3.png) as the error stack is quite long, which is attached here
How can this be solved
After setting your System up, start NEOS with http://neos.demo/setup first.
I was having the same issue on my Mac machine after a successful installation. The point was that my php installation was not linked correct to the php binary, although it was set correctly in /user/bin/php and "active"
So make sure /opt/local/etc/select/php/current points to a valid php installation using the command "sudo port select php php54" (for php 5.4)
I solved this error with setup this lines in neos\Packages\Framework\TYPO3.Flow\Configuration\Settings.yaml
TYPO3:
Flow:
core:
phpBinaryPathAndFilename: 'C:/path/to/php.exe'
TYPO3:
Flow:
core:
subRequestPhpIniPathAndFilename: '/path/to/your/php.ini'
This error occur because typo3flow may be not find php and php.ini files in server.
for more help follow this link: http://wiki.typo3.org/Exception/Flow/1355480641

Error regarding running projects on WAMP which contain Zend_Session classes

I cannot run on WAMP Zend Projects containing Zend_Session classes.
After checking httpd's error log, I found this entry and other errors all connected with load of Zend_Session.
[ssl:warn] [pid 5340:tid 216] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
I've tried to open another project which doesn't contain any Zend_Session and it works. How could I solve this, in order to be able to include Zend_Session classes within my projects and successfully run it with WAMP?
This is a problem with your Apache SSL configuration.
Configure your SSL module as below:
<IfModule ssl_module>
SSLSessionCache "shmcb:C:/wamp/bin/apache/Apache2.2.17/logs/ssl_scache(512000)"
SSLSessionCacheTimeout 300
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Maybe you should also read the SSLSessionCache documentation.

PSGI application with Apache2 using Plack::Handler::Apache2 results in 'not found'

first time poster, long time lurker here.
Im using a tiny PSGI application in plackup, but id like to switch to Apache2 for subdomains. I run the application with 'plackup /home/ath88/work/kolle/script/dir.psgi -port 80'. It runs perfectly on plackup. The application is quite simple and can be found at https://github.com/ath88/Kolletilmelding/blob/master/script/dir.psgi
But, i would like to run Apache2 instead of plackup for obvious reasons. For this i want to use Plack::Handler::Apache2. My VirtualHost looks as follows:
<VirtualHost *:80>
ServerName aths.dk
ServerAdmin asbjoern#gmail.com
<Location />
SetHandler perl-script
PerlResponseHandler Plack::Handler::Apache2
PerlSetVar psgi_app /home/ath88/work/kolle/script/dir.psgi
</Location>
</VirtualHost>
Apache2 restarts fine. But when i attempt to visit aths.dk i mere get a 404 not found. The directory for the application is correct, since it results in a 500 Internal Error. Looking in the apache2/error.log i get this: [Irrelevant, see edit]
[Wed Oct 05 21:32:16 2011] [notice] caught SIGTERM, shutting down
[Wed Oct 05 21:32:17 2011] [notice] Apache/2.2.12 (Ubuntu) mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming normal operations
This happens every time i restart Apache2.
I have spent 4 hours trying to debug this. I am totally mindboggled.
Edit: Turns out the SIGTERM was from stopping Apache2 for restarting. It doesn't happen when i start it. Silly me.
Maybe your setup will benefit from a reverse HTTP proxy setup.
You can start your Plack application manually, and you can bind it to 127.0.0.1:9001 instead of 127.0.0.1:80, in which case you need a privileged user ( TCP port below 1024 ).
Then a reverse HTTP proxy config that should work could be like this one:
<VirtualHost *:80>
ServerName aths.dk
ServerAdmin asbjoern#gmail.com
ErrorLog /var/log/apache2/aths.dk-error.log
TransferLog /var/log/apache2/aths.dk.log
DocumentRoot /var/www/aths.dk
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://127.0.0.1:9001/
ProxyPassReverse / http://127.0.0.1:9001/
</VirtualHost>