White page when deploying Symfony2 Project - symfony

After I finished my project of symfony2 on windows I wanted to deploy it on a digitalocean server with Linux-Ubuntu OS. But there are some problems I can't figure them out. Please help me soon.
I uploaded the web folder files to folder html on server and other files (src , app , bin, vendor) to www folder. I also followed the instructions on config.php and solved the problems. But yet:
1- When I trying to type url : ip_address/app.php/ on browser a white page comes. No page and No error!
2- When I want to clear the cache in production env using the putty this error happens. ( Unable to write in the "C:/wamp/www/my-project/app/cache/prod" directory) but there is no such problem when clearing on localhost (I think this problem is because of transferring the project from windows to linux)
Please help me.

You probably have some errors (maybe cache directory).
For testing open the file web/app_dev.php and comment this:
/*if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !in_array(#$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
*/
Now you can access your page via ip_address/app_dev.php/ and see errors. When you finish, don't forget to uncomment this.
If you have problems with cache, then I suggest you to upload code without cache directory. Then create this directory in the server and give it right permissions.

Related

deploying symfony 3 with cPanel

I have some troubles deploying a Symfony 3 app in cPanel.
I had no problems deploying in Heroku or Fortrabbit.
The problem is :
I can't connect to my backend using example.com or example.com/app.php
from my frontend and I have to use example.com/app_dev.php.
This only works because I commented these lines in my backend's app_dev.php:
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(#$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
But I don't think this is the right way to do it.
Is there anyway to set SYMFONY_ENV=prod in cPanel?
As far as I know you can't. That's on the feature request list:
https://features.cpanel.net/topic/setenv-for-addon-domains-and-subdomains
You could try to edit the .bash_profile file on your cPanel account (if you have ssh access you can do it via ssh, if not you can use FileManager from cPanel and try to add something like this:
export SYMFONY_ENV=prod
Then try again.
UPDATE:
That file is usually found in /home/cpanelusername/.bash_profile

Open files in PHPStorm with Vagrant+Symfony application

I know you can open files from Symfony profiler or exception file links using this in project/app/config.yml :
framework:
ide: "phpstorm://open?file=%%f&line=%%l"
More info: http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application
However as I'm using vagrant, the file path of the server doesn't match my host.
I have created a PHP web application server in PHPStorm with the propper path mappings, but still doesn't work.
Any ideas?
Thanks
When running your app in a container or in a virtual machine, you can tell Symfony to map files from the guest to the host by changing their prefix. This map should be specified at the end of the URL template, using & and > as guest-to-host separators:
// /path/to/guest/.../file will be opened
// as /path/to/host/.../file on the host
// as /path/to/host/.../file on the host
'phpstorm://%f:%l&/path/to/guest/>/path/to/host/&/foo/>/bar/&...'
Symfony FrameworkBundle Configuration - IDE
The answer given by Jeffry no longer works unfortunately :(. When In configure that with my paths the profiler throws:
ParameterNotFoundException
You have requested a non-existent parameter "f:".
I have configured the path according to this line in the SF docs: This map should be specified at the end of the URL template, which results in this:
phpstorm://open?url=file://%%f&line=%%l&/path/to/guest/>/path/to/host/
However, it does open PHPStorm, but phpstorm does not open the file, so i'm a bit stuck here now.
This solves the issue with the file not opening in PhpStorm from a Vagrant:
phpstorm://open?file=%%f&line=%%l&/path/to/guest/>/path/to/host/
Source: https://youtrack.jetbrains.com/issue/IDEA-65879

Artifactory has lost track of local artifacts

I'm using Artifactory OSS 4.1.0 and Java 1.8.0_51.
When I try to download one of my local artifacts from the Artifactory web interface, I get this:
{
"errors" : [ {
"status" : 500,
"message" : "Could not process download request: Binary provider has no content for 'bab1c4e18f6c5edfb65b2503a388dea2fed0deb8'"
} ]
}
But I found this file in my Artifactory data area: ./files/ba/bab1c4e18f6c5edfb65b2503a388dea2fed0deb8, and upon further inspection it is the WAR file I tried to download.
I've come across other people on the web with the same error message, but their issue was with caching external artifacts, and their workaround was to delete the cache.
Does anyone have an idea what's going on and how I can fix the problem? BTW, I did stop and restart our Artifactory server, but with no noticeable difference.
Artifactory doesn't store the binaries under ./files directory, but under $ARTIFACTORY_HOME/data/filestore.
It looks like you had a symbolic link from the files directory to the filestore directory and this link was deleted.

Symfony2 on nginx shared hosting

i've a symfony 2.3.16 project which work great on localhost.
But today i wanted to host it on my remote server : its a shared hosting on nginx 1.4.7
i've changed the public folder (from /web to /public_html : still working great on localhost)
i've cleared then deleted the dev and prod cache,
added my remote IP to app_dev.php and activate the debuger in app.php
and then uploaded all files to my shared hosting.
the tree is like this :
app
bin
public_html
- bundles
- app.php
- app_dev.php
- config.php
- .htaccess
src
vendor
and when i try to access some pages, i've always ended with a 404 Not Found error.
here, you can see : http://dojonantais.cwebh.org/app.php/admin/
i have no route defined for /
my app/config/routing.yml is like this :
dnAdmin:
resource: "#dnAdminBundle/Resources/config/routing.yml"
prefix: /admin
also, when i try dev environnement http://dojonantais.cwebh.org/app_dev.php
it says there is no route for /, which is logic, but i've another error with the debug bar :
An error occurred while loading the web debug toolbar (404: Not Found).
Do you want to open the profiler?
and when i open the profiler : 404 not found
again, i can access the config.php and it says my server is ok to run Symfony, but cant access the configurator (404 error)
So, what is missing?
Thanks again.
So, problems coming from my remote host on nginx.
i change the host to a 1and1 server and all is ok.

Drupal: The selected file intersection.png could not be uploaded

I don't understand why I get this error when I upload images...
The selected file intersection.png could not be uploaded. The file is not a known image format.
It is just a png file, and the problem came when I moved the website on the server. On localhost everything was perfect.
1) I've deleted the "files" folder and created it again with a php script (to make the server the owner)
2) drupal automatically creates 2 folders into it (imagecache and temp) so I assume it has the privilegies to write into it.
3) I've changed the temporary folder in Settings > Filesystem from "/tmp" to "temp", since I got an error before (probably the /tmp folder on the server is not writable by drupal
thanks
http://drupal.org/project/transliteration I think this module help me in my problem related this issue.
There's a known problem with Drupal 6.15 and IIS (see http://drupal.org/node/419734). If you're on 6.15, try backing down to 6.14 until a fix is completed.
I solved it. The rewrite module is not enabled on my IIS server, so I had to change a line of code inside the imagecache.module to add "index.php?q=
return url($GLOBALS['base_url'] . '/index.php?q=' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args);

Resources