Open files in PHPStorm with Vagrant+Symfony application - symfony

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

Related

Alfresco Share - Unable to change the default port number

I am trying to configure Alfresco Community 3.3 on a port other than its default port of 8080. I need it to run on 8989. I think I have change all instances of 8080 (where it is mentioned in configuration files) to 8989, and I am able to access Alfresco Explorer okay. So far so good.
But, when I try to access http://localhost:8989/share I get the following error
java.io.IOException: Unable to test document path:
alfresco/site-data/configurations/slingshot.site.configuration.xml in
remote store: alfresco due to error: 404
The files I have changed are as follows:
tomcat/conf/server.xml
tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/file-severs.xml
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/repository.properties
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystem/sysAdmin/default/sysadmin-parameter.properties
tomcat/webapps/alfresco/wsdl/access-control-service.wsdl
tomcat/webapps/alfresco/wsdl/administration-service.wsdl
tomcat/webapps/alfresco/wsdl/action-service.wsdl
tomcat/webapps/alfresco/wsdl/authentication-service.wsdl
tomcat/webapps/alfresco/wsdl/authoring-service.wsdl
tomcat/webapps/alfresco/wsdl/classification-service.wsdl
tomcat/webapps/alfresco/wsdl/content-service.wsdl
tomcat/webapps/alfresco/wsdl/dictionary-service.wsdl
tomcat/webapps/alfresco/wsdl/repository-service.wsdl
virtual-tomcat/conf/server-minimal.xml
virtual-tomcat/conf/server.xml
Have I missed something obvious?
(Please make no suggestions about upgrading......)
I think you have overdone it.
According to
http://wiki.alfresco.com/wiki/Changing_Default_Port_Configuration
you should only change it in share-config-custom.xml
Change all the files back but share-config-custom.xml
Four are the files to be changed in Alfresco 5.2 in order to set the various ports:
[alfresco-community_instDir]\properties.ini
[alfresco-community_instDir]\tomcat\conf\server.xml
[alfresco-community_instDir]\tomcat\shared\classes\alfresco-global.properties
[alfresco-community_instDir]\tomcat\webapps\share\WEB-INF\classes\alfresco\share-cmis-config.xml

trying to use log4j.xml file within WinRun4j

has anyone tried to use a log4j.xml reference within a WinRun4j service configuration. here is a copy of my service.ini file. I have tried many configuration combinations. this is just my latest attempt
service.class=org.boris.winrun4j.MainService
service.id=SimpleBacnetIpDataTransfer
service.name=Simple Backnet IP DataTransfer Service
service.description=This is the service for the Simple Backnet IP DataTransfer.
service.startup=auto
classpath.1=C:\Inbox\DataTransferClient-1.0-SNAPSHOT-jar-with-dependencies.jar
classpath.2=WinRun4J.jar
classpath.3=C:\Inbox\log4j-1.2.16.jar
arg.1=C:\Inbox\DataTransferClient.xml
log=C:\WinRun4J-Service\SimpleBacnetIpDataTransfer\NBP-DT-service.log
log.overwrite=true
log.roll.size=10MB
[MainService]
class=com.shiftenergy.ws.App
vmarg.1=-Xdebug
vmarg.2=-Xnoagent
vmarg.3=-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
vmarg.4=-Dlog4j.configuration=file:C:\Inbox\log4j.xml
within the log4j.xml file, there is reference to a log file for when the application runs. if I run the java -jar -Dlog4j.configuration=file:C:\Inbox\log4j.xml ...., the log file is created accordingly. if I register my service and start the service, the log file does not get created.
has anyone had success using the -D log4j configuration, using winrun4j?
thanks
I think that you provided the vmarg.4 parameter incorrectly. In your case it has to be like:
vmarg.4=-Dlog4j.configurationFile=[Path for log4j.xml]
I am also using the same and in my case, it is working perfectly fine. Please see below example:
vmarg.1=-Dlog4j.configurationFile=.\log4j2.xml
Have you tried setting the path in your code instead:
System.setProperty("log4j.configurationFile", "config/log4j.xml");
I'm using a relative path to a folder named config that contains log4j.xml. An absolute path is not recommended, but may work as well.
Just be sure to set this before making any calls to log4j, including any log4j config settings or static method calls!
System.setProperty("log4j.configurationFile", "config/log4j.xml");
final Logger log = Logger.getLogger(Main.class);
log.info("Starting up");
I didn't specify the log4j path in the ini file, only placed log4j.xml file at the same place the jar was placed.
Also without specify the
System.setProperty("log4j.configurationFile", "config/log4j.xml");
In the Java project it was stored in (src/main/resources) and will be included in the jar, but it will not be that one used if placed outside the jar.

Symfony 2 pdo exception

I'm using Symfony 2 and have this row in my parameters.ini:
database_driver = pdo_pgsql
When I was creating database structure with Doctrine everything was good. But if I want to add some doctrine object to my darabase (insert row), I catch an exception:
What I have to do with this?
Are you sure you're using pdo_pgsql? Are you running on localhost? It might be very certain that you are using pdo_mysql driver instead.
However you have to check the following:
php.ini
extension=pdo.so
extension=pdo_mysql.so
or in your case
extension=pdo.so
extension=pdo_pgsql.so
You can check the phpinfo(); to find out the configured database driver.
In your symfony project you have to check the parameters.ini file in config folder. E.g.
[parameters]
database_driver="pdo_mysql"
database_host="localhost"
Besides try to avoid this error
'stty' is not recognized as an internal or external command,
operable program or batch file.
https://github.com/symfony/symfony/issues/4974
First of all, verify your php.ini file: the extensions php_pdo_pgsql and php_pdo must be enabled. Make sure you apply this changes on php.ini file that your symfony project is using, check this on localhost/path_to_your_project/web/config.php. You know if this extensions are enabled executing the function phpinfo().
This command is also helpfull: php -m. It lists on console all the php modules that are loaded.
Tip: check out you Apache error log, there could be something wrong with the load of your extensions. This file is located according to your server configuration.

convert .WAR for auto deploy in karaf/servicemix

I've got very simple .WAR containing example servlet. I'm able to deploy it in servicemix using the following command:
osgi:install file:///home/seiho/apache-servicemix-4.4.2/deploy/TestServlet.war?Bundle-SymbolicName=TestServlet&Webapp-Context=/TestServlet
And then see it in my browser. But only with full path to a file, e.g.: localhost:8080/TestServlet/index.html or localhost:8080/TestServlet/TestServlet (my servlet is TestServlet class).
I'd like to launch the index.html page automatically after entering: localhost:8080/TestServlet
how to do it?
MORE IMPORTANT
I need a way to convert the .WAR file or servlet project (I've got the sources) so that new .WAR file can be auto-deployed by copying it to $SERVICEMIX_HOME/deploy directory.
I've tried editing the MANIFEST.MF file, but with no success. Probably I'm doing something wrong.
Thanks for any advice/help.
To be recognised as a wab, you need to add a context path header to your manifest:
Web-ContextPath: TestServlet
It's working now! I was doing my MANIFEST.MF according to this page: http://team.ops4j.org/wiki/display/ops4j/Pax+Web+Extender+-+War+-+OSGi-fy
The problem was that for some reason "Bundle-Version: 1.0" line was required as opposed to optional as stated on that page.
Honestly, just adding the Bundle-Version fix-it.
I knew it was something wrong with the MANIFEST.MF and after Holly Cummins' question I played with it a bit more. Thanks Holly.
I still can't do anything with the manual site launching (have to manually enter the index.html).
http://localhost:8080/TestServlet/ gives me this:
HTTP ERROR 404
Problem accessing /TestServlet/. Reason:
Not Found
Powered by Jetty://
http://localhost:8080/TestServlet/index.html gives me proper site.

Flex, zend production error

I've got my flex, php & zend project working fine on localhost but when I try to move it to production I get the following error:
Class "testService" does not exist: Plugin by name 'testService' was not found in the registry; used
paths:
: /home/myNewFolder/services/
#0 /home/ZendFramework/library/Zend/Amf/Server.php(550): Zend_Amf_Server->_dispatch('paged', Array,
'testService')
#1 /home/ZendFramework/library/Zend/Amf/Server.php(626): Zend_Amf_Server-
>_handle(Object(Zend_Amf_Request_Http))
#2 /home/myNewFolder/gateway.php(69): Zend_Amf_Server->handle()
#3 {main}
I've got my amf_config file as follows:
[zend]
webroot =/home/myNewFolder
zend_path =/home/ZendFramework/library
[zendamf]
amf.production = false
amf.directories[]=services
my .swf & services folder are located in "myNewFolder", which is located under the root of my directory.
I am using Zend version 1.9.4, Flex SDK 4.1. My localhost is windows & production host is Linux
two potential problems, the home on the server is not the path you think. Print home to screen to see what is there. Second, always, always use small letters. Too many problems arise when you write myApp, MyApp or Myapp. just write myapp, and do not worry again
Edit: wait a second, your services path is wrong. I assume it is under New Folder. Your amf directories should change to amf.directories[]=./services
Remember that Unix is case sensitive, and Windows doesn't so check the case, your file should be named testService.php, or TestService.php.

Resources