Images, Stylesheets and scripts not loading on zend website - zend-framework

I have migrated a Zend (Version 1.9.3) website to another server and now I can only get the home page with no scripts or stylesheets and images loaded.
I noticed that most files use the baseUrl for links like
$this->baseUrl = 'http://' . $_SERVER['HTTP_HOST'];
However if I manually set the baseUrl inside the default.php file some stylesheets are loaded and some are not using
$this->baseUrl = '/ctm/example.com/public/';
My virtual host points to:
/home/e-smith/files/ibays/ctm/html
Does this anything to do with how my virtual host was setup or pointing to? Any help Im still new to zend framework?

Your Virtual Host's Directory should actually be pointing to:
<Directory "/home/ctm/example.com/public/">
AllowOverride All
Require all granted
</Directory>

Related

Apache2 Links are beeing encoded

i have a Apache2 Webserver with a VirtualHost which has a Directory Directive looking like this:
<Directory /path/to/folder>
Order allow,deny
Allow from all
Require all granted
Options Indexes
</Directory>
The path/to/folder includes some static HTML files. In these HTML files ive got link tags which refer to documents on the webserver.
When clicking or hovering on the link, the URL gets fully encoded (eg, / will be encoded to %5C). Those links do not work. Why dont they work?
I already tried the AllowEncodedSlashes NoDecode option, this did not work.

Mezzio skeleton application on Centos 8

I try to run a Mezzio application on my server I do the following steps :
- Create a Mezzio project
composer create-project mezzio/mezzio-skeleton symphonie
I choose modular application, fast router, service manager, plates renderer and Whoops
I create my virtual host like this :
<VirtualHost *:80>
Alias /symphonie "/data/symphonie/public"
<Directory "/data/symphonie">
Options Indexes MultiViews FollowSymlinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
But when I enter this url in Google Chrome : https://app.inra.fr/symphonie/ I got a 404 error.
I have no messages in the apache logs. By cons all the links on the page redirects me to https://app.inra.fr/ and not to https://app.inra.fr/symphonie/
Here is the configuration of my server:
Centos 8
Apache 2.4 with rewrite module enabled
PHP 7.3
Do you have any leads to solve my problem?
thanks in advance
Shishi
Mezzio application does not have built-in support for base path.
You would need to handle following aspects:
web server rewrites for subfolder. Looks like you did that part.
middleware will need to be piped early to remove base path from request object before passing it further
base path url helper.
Mezzio provides url helper in mezzio/mezzio-helpers package. Middleware from the previous step could also be used to inject base path into url helper. If some of your middlewares use different ways to handle urls, those will need to be setup as well.
Mezzio documentation have the page covering this use case:
https://docs.mezzio.dev/mezzio/v3/cookbook/using-a-base-path/
It is not too detailed and pull requests to improve it are welcome ;)

SugarCRM error on module loader on shared hosting

I’ve a shared hosting account and installed SugarCRM. Everything is fine except the message i get for the module loader. Here i get the message to add suhosin.executor.include.whitelist = “upload://” to the php.ini file.
The message is:
Upload stream is blocked by Suhosin, please add "upload" to
suhosin.executor.include.whitelist (See sugarcrm.log for more
information)
Because i have a shared hosting account i don’t have access to my etc map and therefore also not to my php.ini file.
I want to use the .htaccess file for this but don't know exact code. Can anyone help me?
You Can Try Add this to your .htaccess file as suggested in http://forums.sugarcrm.com/f6/upload-stream-blocked-suhosin-82116/
<IfModule mod_php.c>
php_value suhosin.executor.include.whitelist upload://
</IfModule>
In my case I'm using php-fpm so I modified the php.ini locater in /etc/php5/fpm/conf.d/suhosin.ini and I have no more warnings from SugarCRM
; configuration for php suhosin module
extension=suhosin.so
suhosin.executor.include.whitelist="phar"
suhosin.executor.include.whitelist="upload"
The solution posted by Carlos Quijano didn't work for me.
I've found that the solution is different depending if PHP is run as module, CGI or FASTCGI .
This is the documentation I've found about the different methods you can use to use a custom php.ini file for your domain (or even subdomains)
First you should check which one is your case.
For this, you can use the phpinfo command:
Create a php file called phpinfo.php with this content: <?php phpinfo(); ?>
and upload it into your domain root, then visit www.yourdomain.com/phpinfo.php,
you'll see a table and next to "Server API" you'll see which way PHP is run.
For me it was "CGI/FastCGI", so I had to get a copy of the global php.ini, which I didn't know how to get since it was not accessible by FTP access. I've found a solution in a Drupal forum:
Create a php file you can call gettheini.php with this content:
<?php system("cp /usr/local/php5/lib/php.ini /home/YOURCPANELUSERNAME/php.ini"); ?>
*The first path must be the path next to "Configuration File (php.ini) Path" in the table obtained before (phpinfo.php), with php.ini at the end. The second path is the path where you want to copy it to.
Upload it into your domain root, then visit www.yourdomain.com/gettheini.php.
This command will copy the global php.ini file yo the path you specified.
Then you can edit that file adding
; configuration for php suhosin module
extension=suhosin.so
suhosin.executor.include.whitelist="phar"
suhosin.executor.include.whitelist="upload"
save it and upload it.
As my hosting service had made some arrangements php.ini overriding, when I checked again the phpinfo page, the new file was already working (check next to "Loaded Configuration File").
Don't forget to protect the new file, add
<Files php.ini>
order allow,deny
deny from all
</Files>
to the end of yout .htaccess file (in the same root folder of your domain or subdomain)
I hope my experience can help you to solve your problem or at least give you some guidance.

How to hide Zend's application.ini from the public?

I am using the Zend Framework for construction of my site, which uses the application.ini file to store database info (such as username and password). I discovered that typing /application/configs/application.ini in the web browser plainly shows all the contents of the applications.ini file.
How can I prevent this? I tried setting the chmod public access to nothing, but then the website couldn't function anymore because of access rights. Anyone familiar with this?
Your document root setting in your web server configuration should point to the subdirectory that has your index.php in it, not the top-level directory of the whole application install.
E.g., you have something like:
myapp/application/Bootstrap.php
myapp/application/configs/application.ini
myapp/application/controllers/...
myapp/application/views/...
myapp/library/...
myapp/tests/...
myapp/public/index.php
Set your document_root to myapp/public and not myapp.
I solved this problem by writing the following in the .htaccess file:
<Files application.ini>
order allow,deny
deny from all
</Files>
If you don't have access to change your document root and you are using the Apache web server, the "quick and dirty" approach might be to create a ".htaccess" file with the following contents, created in:
/application/configs
Contents:
deny from all

"URL not found" error at my localhost setup of TYPO3 website.

I have setup TYPO3 successfully on my local server. But I am having problem when clicking on any menu item: It's showing "url not found on server".
When I type in the URL manually into the browser it shows the page. It's only having problems when redirecting after clicking on a page item at any frontend website page.
That might be related to the domain config or RealURL... or both ;)
Do you use RealURL? Or do you use the standard url config?
If links to sub pages look like index.php?id=12345 you are using the standard config.
My guess is that the local DNS ("hosts file") is not configured correctly.
With the hosts file you can simulate how the web site will appear when it's online, hooked up to a "real/global" DNS. (Not quite, but in a nutshell)
So if you set up Typo3 to be reached under http://www.example.com/ you need to tell your local DNS ("hosts file") to route a request to http://www.example.com/ to your local host e.g. http://127.0.0.1/ . In that case your host file needs an entry like so:
127.0.0.1 http://www.example.com/
What Domain do you enter to reach your web site? Where do the links from the menu link to?
If you wanna know mor about the "hosts file" look here:
http://accs-net.com/hosts/how_to_use_hosts.html
If you can log in into the TYPO3 backend (/typo3/) and can access the frondend through /index.php, but not through the generated menu links, then RewriteRules for mod_rewrite don't apply.
Usually TYPO3's installer should detect this configuration and disable RealURL, which is responsible for generating such nice looking URLs (instead of index.php?id=123). It seems like this failed (or you copied everything afterwards without the .htaccess file?).
Make sure that you have TYPO3's .htaccess file in place in the root directory of your installation. If this is the case, make sure that mod_rewrite is enabled in your Apache config.