We would like to deploy Zend framework in Bluemix. We used the recommended buildpack https://github.com/zendtech/zend-server-php-buildpack-bluemix, however it does not help. For deployment we need to change Document Root to their 'public' folder.
In practice it can be done via changing apache configs or adding htaccess file. So we are not able changing the apache configs, therefore we added htaccess file for it. The folder has been created and via htaccess the document root has been changed (it works). But when the framework has been pushed it does not work (The blank page is appeared without PHP run-time errors).
There is a environment variable that configures the document root for an application using this buildpack:
ZEND_DOCUMENT_ROOT.
Using this instead of the htaccess rewrite rules should work.
Related
I have a Blazor Server app that is running under IIS. I see that it generates a web.config file upon publish with some settings in it.
I need to add some more settings to the web.config as they are used by another component (asp.net 4 app). Does anyone know which file I need to create/modify in order to be able to add these values.
At this stage I do not need to use transforms on the web.config, but it would be nice to know this as well.
What I found is that the web.config works as per Asp.Net Core documentation. In brief for a Blazor server app hosted under IIS (this is my understanding)
If there is no web.config existing in the root of the project directory, one is created during the build and copied to the bin directory. It will contain default information.
If a web.config exists in the root of the project directory, it is copied to the bin folder unmodified (note: it requires some default settings inside).
If transforms exist, they will be applied.
I didn't realise that the web.config is created if it did not exist hence my original question.
Also, I have not been able to get transforms to work yet.
I found that if you publish the project the web.config in the root gets ignored and uses the auto-generated one.
Adding this to my blazor project file solved it and can see the web.config getting published to Azure now:
<PropertyGroup>
<PublishIISAssets>true</PublishIISAssets>
I have created a project locally using Zend Framework 1.11. I have spent a long time learning the basics of the framework from all the online tutorials I can find, and I now feel fairly comfortable using the ZF Tool and locally working on my project on WAMP. I decided it was time to upload my project and deploy it on my shared hosting server, which happens to be Hostmonster.
After uploading my project, I have been struggling to get it to function correctly on the remote host. I have successfully uploaded my Zend Framework Library and included it in my PHP.ini, and all tests show it is seen by the server.
My directory structure, which was originally created to the standard format by the ZF Tool locally on the command line, is not pointing to the same paths on the remote server, so everything was messed up when I navigated to the Project/public folder. After much more Googling, I found several posts by various bloggers related to modifying .htaccess files, etc., which resulted in all my other sites hosted on the server being disrupted.
The closest I have been able to come to re-creating my initial local site on the Hostmonster host is by:
Taking all the directories out of my "public" ZF folder, and putting them directly in the web root of my server, (public_html), and:
Changing the 'APPLICATON_PATH' of my index.php file from the ZF public folder with the path to my ZF library (changed to reflect where it is in relation to the new location).
With this (tedious) setup, I am now seeing my index view being rendered with all CSS and Javascript, but I am unable to navigate to any of the other views, and the form I have displayed via a view script is likewise not showing up, only the index view is rendered.
My Zend Framework Library is located in a directory in the web root-- public_html, with the php.ini adding it to the include path.
This is becoming very frustrating as I like a lot of the features of ZF, but the restructuring of the site is proving impossible. If anyone has instructions or experience with this setup, I would greatly appreciate it. I am also hosting multiple other sites on this server, so I'm hoping I don't have to change from the single php.ini configuration(5.3) I'm currently using or mess around with a bunch of .htaccess files.
Thanks for any help anyone may have!
I have ZF running on HM no problem. Just place your index.php and .htaccess in your public_html dir, and what I did was created a public_html/zend/library folder and in my index.php including that library to get things working.
Also what do u mean you're running other sites off this server? Are you serving the application on the root of your domain? ie in your http://domain.com/ path? or different subdomains?
I have a Zend app which I am trying to port over to a [new] computer. I have it working already on the previous machine.
When I go to the URL localhost/myapp, the application loads the correct index page (i.e. runs my IndexController.indexAction() as it should). However, when I go to any other page, I get an error that the controller "myapp" cannot be found.
I have confirmed that rewrites are working (the error page that is rendered is via my custom ErrorController) - it seems that for some reason, Zend is treating the webroot as localhost, which means that the first parameter after that, "myapp", is being treated as the controller.
Any ideas as to what might cause this, and how to fix it without moving the entire application into the root of the web directory?
Found the answer with the addition of the following line in my htaccess file:
RewriteBase /myapp
I'm not quite sure why this line is needed (it's completely omitted on the original computer where the application works just fine), but adding it in solved the issue.
This was working because your .htaccess file is at the root directory so by localhost/myapp it was going to its index.php but couldnt find .htaccess in the project's folder
I am starting to learn Zend Framework with book Beginning Zend Framework (Apress), I have trouble aceesing different controllers through URL. I setup the directory structure for Zend Framework and setup Apache2.2\htdocs\testproject\public as the default for localhost. If i try to access a different controller by typing localhost/new I get a 404(Not Found).
My directory structure looks like this:
htdocs
--testproject
----application
------configs
------controllers
--------IndexController.php
--------NewController.php
------models
------views
------Bootstrap.php
----docs
----library
----public
----tests
----.zfproject.xml
Make sure you have enabled apache's rewrite module.
Make sure you have AllowOverride All in your httpd.conf settings.
Can you confirm above points and restart your apache and try once again? I am sure you won't face this problem again.
I want to deploy my project made in zend framework to my shared hosting.
My project has such structure:
application
docs
library
Obsolete
public
scripts
tests
This is what I have done:
I copied Zend folder (all library files) into library folder
I copied all the structure above into public_html/projects/project
(so if I type www.mydomain.com/projects/project/public I run the project
I tried to click on some link so that it redirected me to www.mydomain.com/projects/project/public/someController/someAction
Unfortunately all i see is a white, empty page.
Locally (using Zend server CE) it worked perfectly
Here it looks like Zend doesn't recognize that it should do anything with this url and redirecto to appropriate action.
What have I missed?
Greetings!
The reason you see empty page instead of errors is that error_reporting is probably off by default on your production server.
You may change the settings concerting displaying errors and exceptions in application.ini.
The other cases the errors are not displayed is something goes wrong in the view (eg. view helpers), which must return string, not the exception.
Things to check:
paths
include_path
permissions to write for files/dirs which do require this
PHP version
.htaccess setup
stating the obvious here but I'd check your apache error log.
You should check if the server is running php as a module or CGI, in the later case it will not read the SetEnv of .htaccess and you will have to set to development mode in index.php by hand, or specify your config in php.ini