require_once of certain file works on local windows, not on dev linux machine - linux

I'm trying to integrate Goutte http://github.com/fabpot/Goutte into my existing symfony 1.4 project and am running into a problem.
I have everything working on my local wamp server, here are the two lines in question:
require_once('path_to_goutte.phar');
$client = new Goutte\Client();
Now to debug I've put a print statement before and after the require_once statement and the second print statement doesn't get fired off. No error logs are generated - the error is silent and very frustrating.
Any ideas as to why this might be happening?

"No error logs" is something that should be fixed! Check your php configuration (the php;ini file). Is the log_errors setting set to on?

Related

Symfony3: Developing in Windows, Deploying in Linux. DIRECTORY-SEPARATOR

I have following problem:
I wrote a little homepage under Win10. All is fine but when I deploy my work in a Linux system I get the following message:
[2015-12-17 09:28:41] request.CRITICAL: Uncaught PHP Exception Twig_Error_Loader:
"The "/info/wwv/data/someone\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle/Resources/views" directory does not exist."
at /info/wwv/data/someone/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 94 [...]
I think there is some problem with the DIRECTORY_SEPARATOR or similar. The path exists and I can access it when I replace the backslashes with slashes.
Also my log is written in the directory app\logs instead real subdirectory app/logs.
Are you generating the cache on Windows and deploying the cache too instead of building it on the Linux server ? This is indeed not meant to work properly, due to differences between the OS.
Recent versions of Symfony allow to build the cache before deployment and copy it to the other server, but this does not work with Windows on one side and Linux on the other.
I had a similar issue. One day symfony 3.4 (on php7.2.16) stops working. After changing some path settings in AppKernel.php from '/' to '\\', everything works fine.
e.g.
public function getLogDir()
{
return dirname(__DIR__).'\\var\\logs';
}
It seems to be a windows-related issue with path-settings.
I had the same problem as my production server did not let me allocate enough ram to run composer and I had to run it locally.
Afterwards I got similar error (having wrong access path \ instead of / for linux)
Steps I took:
Replacing \\ with / in composer.json and composer.lock
Clearing the var/cache/*

Creating/Migrating rBac in Yii2

I'm just getting started with Yii2 and I am following a tutorial here about setting up Yii2/AdminLTE and I am unable to finish the setup as I am getting errors in Terminal on the last step.
The part I am not able to finish is:
finaly we create rbac dbmanager with simple code, you can see in
folder "console/RbacController" with specific level for :
Admin : can do everything Editor : can edit, add and view Author : can
add and view viewer ; just viewer create rbac :
"yii migrate --migrationPath=#yii/rbac/migrations"
"yii rbac/init"
dont forget to chmod -R 777 on your web/assets if linux environment
and please free to update your setting on menu setting.
So in terminal on my mac, I tried both:
yii migrate --migrationPath=#yii/rbac/migrations
with the error: -bash: yii: command not found
and
/.yii migrate --migrationPath=#yii/rbac/migrations
with error: -bash: /.yii: No such file or directory.
I was able to complete the beginning of the tutorial, it is just this last step. I am already working in my yii2-advanced-adminlte directory
UPDATED:
Added screenshot of terminal window
Normally the yii command is located in
fro advanced template in project directory parent of backend, frontend, console and not in console
be sure of find the right dir and then accessing this try launche your command
yii migrate --migrationPath=#yii/rbac/migrations
eventually adjust your path to rbac/ migrations
Found it out, the problem was using MAMP I had to manually set the php bin to 5.5.23 in terminal because once I started down the path scaisEdge showed me I was getting a No such File or Folder error.
Eventually this is the command that worked for me (check your php MAMP path):
/Applications/MAMP/bin/php/php5.5.23/bin/php yii migrate
Source link: http://www.yiiframework.com/forum/index.php/topic/47043-error-on-using-db-migration-w-mysql#entry222568

Azure Websites Git Deployment dropping "/" in SCM_BUILD_ARGS

Description
We are in a current project based on MVC4/Umbraco using Azure Websites to host it.
We are using SCM_BUILD_ARGS to change between different build setups depending on which site in Azure we deploy to (Test and Prod).
This is done by defining an app setting in the UI:
SCM_BUILD_ARGS = /p:Environment=Test
Earlier we used Bitbucket Integration to deploy and here this setting worked like a champ.
We have now switched to using Git Deployment, pushing the changes from our build server when tests have passed.
But when we do this, we get a lovely error.
"MSB1008: Only one project can be specified."
Trying to redeploy the same failed deployment from the UI on Azure works though.
After some trial and error I ended going into the deploy.cmd and outputting the %SCM_BUILD_ARGS% value in the script.
It looks like the / gets dropped from SCM_BUILD_ARGS but only when using Git deploy, not Bitbucket Integration or redeploy from UI.
Workaround
As workaround I have for now added a / to the deploy.cmd script in front of the %SCM_BUILD_ARGS%, but this of course breaks redeploy, since we then have //p:Environment=Test in the MSBuild command when the value of %SCM_BUILD_ARGS% has been inserted.
:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
:: Added / to SCM_BUILD_ARGS
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\www\www.csproj" [....] /%SCM_BUILD_ARGS%
) ELSE (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\www\www.csproj" [....] /%SCM_BUILD_ARGS%
)
Question
Anyone know of a better solution for this problem or is it possibly a bug in Kudu?
We would love to have both deploy from Git and Redeploy working.
Could you try changing from "/" to "-"? For instance, AppSettings from /p:Environment=Test to -p:Environment=Test, see if it helps.
-p:Environment=Test did not work for me, the setting which worked for me at the time of this writing (September 2015) was
-p:Configuration=Test
There is clearly a Kudu bug in there, and you should open an issue on https://github.com/projectkudu/kudu. But for now, I can give you a workaround.
Instead of using an App Setting, include a .deployment file at the root of your repo, containing:
[config]
SCM_BUILD_ARGS = /p:Environment=Test
I think this will work in all cases. I suspect the bug has to do with bash messing up the environment in post receive hook scenarios, which only apply to direct git push but not to Bitbucket and Redeploy scenarios.
UPDATE: In fact, it's easy to see such weird bash behavior. Try this:
Open cmd.exe
Run: set foo=/abc to set a variable
Run bash
From bash, run cmd to launch a new cmd on top of bash (so cmd -> bash -> cmd)
Run set foo to get the value of foo
Result:
FOO=C:/Program Files (x86)/git/abc
So the value gets completely messed up. The key also gets upper cases, though that's mostly harmless. Strange stuff...

Can't get azure web role to run locally using the emulator

I have a web role that I'm trying to run locally using the emulator. I have it working on another computer, but I cannot get it working on a different one, and have gone as far as to reformat it and start from scratch.
When I launch the site from Visual Studio, Chrome shows the following message:
This webpage is not available
The connection to 127.0.0.1 was interrupted.
There is also an error code listed at the bottom:
Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
One interesting thing from the build output are these lines:
Starting process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' with arguments '"C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web"'...
Process 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure Tools\v1.8\Debugger\WindowsAzureDebugger.exe' exited with exit code 0.
If I run C:\Program Files\IIS Express\iisexpress.exe" /trace:error /config:"C:\Users\brian\AppData\Local\dftmp\Resources\159c7254-b7d0-4076-a4fd-820b00feca5f\temp\temp\RoleTemp\applicationHost.config" /site:"deployment18(27).AzureApp.MyApp.Web_IN_0_Web" from the command line, I get the following message:
The system cannot find the file specified.
Unable to start IIS Express in background.
I have no idea what file it cannot find, but I've verified that the config file I'm passing does in fact exist. Anyone have a clue what's going on here??
While I can not tell you what could be the actual root cause of your problem I can suggest a few ways to troubleshoot it:
Try changing IIS Express to Full IIS and see if it changes the behavior. You can do it by going to your Windows Azure Application project properties and look at "Web" option.
Try running application without debugging it
Launch CSrun at command prompt with /launchDebugger parameter of the /run option to verify that debugger does run without any issue
Try using IE as default browser
Clean your dftemp folder completely for any residual configuration and then launch Azure Emulator separately to verify there are no issues
Procmon "http://technet.microsoft.com/en-us/sysinternals/bb896645" may help you find the file that is missing...
Hopefully someone stumbles upon this answer with similar symptoms. When removing in role caching the <dataCacheClients> section was removed from . Somehow there was a left over <dataCacheClients> section left in the web.config. Everything and compiled and deployed to the emulator successfully. However, the role would fail to start since applicationHost.config was missing.
The fix was simply remove the unnecessary <dataCacheClients> section from the web.config file.

Database error during MODx setup

Using MAMP/phpMyAdmin on Mac OS X Lion, I'm trying to install MODx on a virtual host. During the process, I encounter this:
I've been looking around and have as of yet not found anyone with the same problem. The file it claims is missing does in fact exist at that location. Attaching my database setup as well in case it helps. I'd greatly appreciate any help with this, as databases/virtual hosts are very much not my forté.
Is your login and password correct? MAMP by default uses root for each of these. Try that out.
Sounds like a configuration problem.
http://rtfm.modx.com/display/revolution20/Troubleshooting+Installation
If it's not a connection error (that will be found below), I'd suspect that PDO is not installed or active, or that caching (eAccellerator,APC, etc) is interfering.
This is from modx site:
1)
You have eAccelerator disabled during install. eAccelerator can cause problems when doing the heavy lifting during the install process.
2)
PDO Error Messages
If you are getting PDO-related error messages during install, before proceeding to specific error messages as below, please confirm that your PDO configuration is setup correctly. You can do so by running this code (replace user/password/database/host with your setup):
< ? php
/* Connect to an ODBC database using driver invocation */
$dsn = 'mysql:dbname=testdb;host=localhost';
$user = 'dbuser';
$password = 'dbpass';
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
? >
If this fails, then your PDO setup is not configured correctly.
As it turns out, I had forgotten to turn off Web Sharing, so somewhere along the way there was a conflict between the two Apache configurations.

Resources