We were working on a Symfony2 project. Now, it's done and ready to be deployed. We uploaded the whole project files to the server (via ftp of course) and the database as well. Now when we open any page of it we got just a blank page (empty source code). Cache is clean, logs do not show anything new. We googled the steps of deploying a Symfony2 project to a hosting but we did not find a good explanation (even these ones were about Symfony not-version-2).
We believe it maybe a configuration issue, but no idea so far.
Any help will be greatly appreciated.
Thanks in advance.
Edit: the blank page is in Firefox. Google Chrome is saying something:
Server error The website encountered an error while retrieving
http://*.com/mammoky/web/app_dev.php/main. It may be down for
maintenance or configured incorrectly. Here are some suggestions:
Reload this webpage later. HTTP Error 500 (Internal Server Error): An
unexpected condition was encountered while the server was attempting
to fulfill the request.
error_log is showing:
[24-Mar-2012 23:29:24] PHP Parse error: syntax error, unexpected
T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in
/home/leadow33/public_html/mammoky/web/app.php on line 7
It's: use Symfony\Component\HttpFoundation\Request;
And
[24-Mar-2012 23:15:08] PHP Warning: Unexpected character in input:
'\' (ASCII=92) state=1 in
/home/leadow33/public_html/mammoky/web/config.php on line 84
It's: $reflector = new \ReflectionExtension('intl');
EDIT: I've posted my solution, check it out down here.
Answer:
I got it to work, this is my experience:
Upload the whole project folder to the server.
Enter www.your-website.com/project-name/web/config.php.
It should say: "This script is only accessible from localhost".
Open this web site: http://www.whatismyip.com, it should show you your public IP address, copy it.
Open the config.php from the admin panel (like cPanel) and edit that config.php:
if (!in_array(#$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1', /*your IP here*/))) {
header('HTTP/1.0 403 Forbidden');
die('This script is only accessible from localhost.');
}
Refresh your config.php file, the page will tell you if your system is missing some required conditions like: PHP version, APC extension, giving /cache and /log folders permissions to write on, etc.
After you provide the required conditions you'll see a form of configuring you project to connect to a database if you have one, this step is pretty simple.
Open the link www.your-website.com/project-name/web/app_dev.php, it'll help you get started with Symfony2 project.
In case you got in app_dev.php this message: You are not allowed to access this file... just do the same thing to app_dev.php as you did in steps 4 and 5 (add your public IP address to the array).
Note of Hakan Deryal (comment): If you don't have a fix IP address, you need to do this last step each time you get a new IP adrdress from the DHCP. So to solve that, open the app_dev.php and comment out the line die('You are not allowed to.., however this is not a recommended way because you're disabling the built-in security of the file.
One thing stopped me and may stop you too, the server I deployed the project on, was case-sensitive (unlike the localhost on my computer), so it kept telling me that the template (Index.html.php for example) does not exist, however it does exist, but I did return $this->render('...:index.html.php') with small i in DefaultController.php. So render the exact template (file) name with the same letters cases.
Now everything is going well, I hope that helps you.
In my case it was the php version* and I catched the error by running config.php with removed lines for checking ip address. On my hosting I just changed the default version of PHP for my scripts.
*Since namespaces are only from 5.3.
production isnt app_dev but app.. The page might be the same did you do a view source? Did you try to run the config.php that comes with the framework zip ?
If your installation runs on a shared webserver, try setting the following line into the app.php:
date_default_timezone_set('America/Los_Angeles');
This solves the problem in my case.
Related
As I am using the local hosting of MAMPbut " There has been a critical error on this website" this is error is coming. What should I do?
Diagnostic steps worth giving a shot, follow from top to bottom order;
Is MAMP really running with Web server (and additionally the database server)?
Do you see the default MAMP index/home screen?
Put a simple HELLO WORLD HTML document to your project root and check if you can see it on browser
Put a simple HELLO WORLD PHP script to your project root and check if you can see it on browser
At this point, if everything above went well, it is definitely an issue with your actual PHP script, check the PHP error log file
Put an INFO.PHP PHP script at your project root and check you have all the required extensions available for your PHP project
Check if database connection is working (if required)
At this point, I cannot imagine what else would go wrong, try PHP debugger (xDebug needs to be installed with MAMP and your PHP editor may need a configuration for this) with break points and step into each line of your PHP code with debugger.
I have a vBulletin 3.8 forum.
When we click Edit button of any post (so the Quick Edit form should displayed), I get this error on the browser's console:
XML Parsing Error: xml processing instruction not at start of external entity
Location: http://www.xxxxx.xx/ajax.php?do=quickedit&p=438
Row number 2, Column 1:
... the Quick Edit form is not appearing the the progress bar displayed permanently.
I have try to disable hooks/ plugins, but the problem still appears.
I have this row on config.php: ini_set("display_errors", false); so I don't think it is a fatal error/ warning by PHP which brokes the xml normal syntax.
I have informed that this appear starts after the move of the site to another server. Does it say something to you?
Any general idea about this error?
EDIT:
Well, I found the reason of this issue, but I don't know how to fix it. Exact the same site on a localhost testing board works perfectly, but on the live server ANY html page/ ajax call etc, has a useless empty line as line #1.
For normal html pages, there is no reason for the browser to return an error, but when we're talking about an ajax call, this empty line at the top of the response, breaks the xml parsing from the browser. So it seems it is a server/ PHP/ Apache setting that applies this empty line. Any idea how to fix it? https://imgur.com/a/4neb0
It might be late for you but any new comers with php/nginx/apache can get an understanding of why.
Answer is simple: When moving the code, you might not be using git/rsync/scp but let me guess, you used zip (and probably Windows/Linux involved).
How to discover it was a two-day journey with many things tried:
We have the same error, we were also moving our servers. We tried:
We thought the server software version was a problem.
We thought the cloud provider OS image was a problem.
We used docker to avoid these problems, but the empty line problem persists.
We thought the code ?> ending was a problem, I went through all of them. But it wasn't.
I finally asked my colleague: How did you get the code? From Git? He said he downloaded from ZIP and then uploaded to server.
I removed code on the server (which extracted from a zip) and used git to download a fresh copy from our github.
Magic, problem solved. The empty line gone.
So I think the problem is with the zipping progress might have changed some file empty lines. Always use git.
I am new to cakephp, and following the 'Bookmarkers Tutorial'. I get to know that I can access the project using two kind of urls(I am using apache and the folder is located at /var/www/html/bookmarker):
localhost:8765
and
localhost/bookmarker
Now, when I use the first url, I get the following warning message on top:
warning(2) : file_put_contents(/var/www/html/bookmarker/logs/error.log): failed to
open stream: Permission denied [CORE/src/Log/Engine/FileLog.php, line
133]
But is not the case with the second url !
Why is there such a difference b/w these two urls? Which one should be used? And how to resolve that message appearance? Any help is greatly appreciated!
It's two servers here.
"localhost:8765" is the server built-in by CakePHP when you run the command: "bin/cake server" but you already have Apache web server at "localhost", so you don't need it.
And 2 servers being ran by 2 users:
localhost:8765 is you
localhost is apache
That's why you don't have permission to write log file (owned by apache)
Just stop the server built-in (bin/cake server), and use Apache server (2nd URL)
In case you want to use the server built-in, stop Apache server and remove everything inside "/var/www/html/bookmarker/logs/", the error message will gone.
I have a problem, i moved my drupal site, and i can see all my sites working. But sometimes when i editing them it comes "Internal Server Error". I think there is something wrong with my htaccess or my webconfig. As someone told me IIS doesn't use htaccess, but than it uses web.config. The problem is it sometimes shows Error, sometimes not. So i think it has something to do with timeouts or something like that? Could that be?
I find out, what to do that the browser shows me the exact error:
It's this: "PHP Warning: session_start(): Trying to destroy uninitialized session in D:\Parallels\Plesk Panel\Vhosts\example.de\httpdocs\Intranet\includes\bootstrap.inc on line 1165
PHP Warning: session_start(): Failed to decode session object. Session has been destroyed in D:\Parallels\Plesk Panel\Vhosts\example.de\httpdocs\Intranet\includes\bootstrap.inc on line 1165"
Can you see something, where there is something wrong?
IIS doesn't use .htaccess files. It is a different beast altogether. It is unusual to run Drupal on Windows much less IIS, so you may not find much information. Luckily, Microsoft has their own Drupal distro that you can find at http://www.microsoft.com/web/drupal. You can use their distro as-is or as a template for configuring your own installation.
Hi i am using EZ publish , when i try to access my site i am getting this error .
Unexpected error, the message was : Unable to connect to the database server 'localhost'
Error #0: in /var/www/lib/ezdb/classes/ezpostgresqldb.php on line 125
in my
/var/www/settings/siteaccess/plain_site/site.ini.append.php
/var/www/settings/siteaccess/nor/site.ini.append.php
/var/www/settings/siteaccess/plain_site_admin/site.ini.append.php
i have defined
[DatabaseSettings]
DatabaseImplementation=ezpostgresql
Server=localhost
server as localhost ,
also my database user name and passwords are correct
also my site url is correct
[SiteSettings]
SiteName=test
SiteURL=xxxxxxx/index.php
also my database server is starts correctly
/etc/init.d/postgresql restart
in my web browser it only gives the error
An unexpected error has occurred. Please contact the webmaster.
so
1.are there any log files i should check ?
2.what are the possible reasons for this error , thank you very much
I have never used postgresql with eZ Publish myself but if you are sure that your settings are OK, try to replace localhost by 127.0.0.1. Depending on the PHP library which is used, it can help.
If you are looking for logs, check /path/to/ezp/var/log/*. If this directory is empty, then please make sure that your webserver can write into /path/to/ezp/var.
Check what username and password is being used (lib/ezdb/classes/ezpostgresqldb.php).
It may be that your in settings are not being read. Ensure that you have loaded your siteaccess properly in your override site.ini (settings/override/site.ini). It sounds like you have your connection strings lined up in your siteaccess ini files, but your siteaccesses are not being loaded.