CakePHP 2.1 bake test app and failed - php

I download cakephp 2.1 from the official website. When I copied files to my www directory on Windows 7 64bit, (using WAMP 2.2 with PHP 5.3.8), and configured path to link to cake bake.bat in console folder I have problem. When I run cmd and typing cake bake testapp (to generate some test app and test new futures) I see in console strength error:
File app/View\Pages\home.ctp exists
Do you want to overwrite?
I answered y. The bake app is ready but If I type my localhost in my browser I see
The action index is not defined in controller AppController
so I type manual pages to url I see 404!
Please help me because I want start a new project with new CakePHP 2.1 not 2.0.6...

This issue is fixed.
If you still getting error comment the following code in C:\wamp\www\cake\lib\Cake\Console\Command\Task\ProjectTask.php file
if ($this->createHome($path)) {
$this->out(__d('cake_console', ' * Welcome page created'));
} else {
$this->err(__d('cake_console', 'The Welcome page was <error>NOT</error> created'));
$success = false;
}
NOTE: C:\wamp\www\cake - This is my cake liberary path, change yours if its different.

Related

Symfony 5.1.2 page not found with new project

I created a new project using Symfony 5.1.2, then I tried to run the server using
symfony serve. Once I tried to access localhost:8000, I had this warning in the terminal : [Web Server/PHP ] Jun 22 13:47:55 |WARN | SERVER GET (404) / ip="::1".
Moreover, the page I had was symfony's default page saying "#Page not found".
I checked the existing routes and I had default ANY ANY ANY /.
I also checked the DefaultController, but everything looks fine, since it is the auto generated controller...
I don't know what else to check, how could I get this default page working ?
I had a similar issue : I had run symfony server:start and was even seeing it react to my entering HTTP addresses in the browser, but I kept having that "# Page not found" message.
Quite simply, my symfony project was in Group/SubGroup/Project... and I was running symfony server:start from Group/SubGroup. When I stopped Symfony and ran it again from Group/SubGroup/Project, it worked like a charm.
A beginner's mistake, to be sure, but beginners use this site too.
Did you run the symfony project? It will show if you didn't run the symfony project. Run the project from terminal.
cd my-project/
symfony server:start
ip="::1" is the localhost on windows and wsl 2. Symfony server listen on 127.0.0.1:8000.
You must edit the windows hosts file at C:\Windows\System32\drivers\etc\hosts.
Add this line : 127.0.0.1:8000 localhost:8000
It works for me.

Laravel Socialite Login, localhost:8000 my laravel project is not running here... Guide please

I am trying to create Socialite Login using laravel. I have wamp server, and my project is running on http://localhost/SocialiteLogin/ <- on this url I am getting laravel logo/demo page.
Project is running well on my browser but when I type this address into (Create OAuth client ID->Authorized JavaScript origins) it gives me this error:
Invalid Origin: URIs must not contain a path or end with "/".
I have seen different videos related to this, their laraval project are running directly on localhost:8000 and they paste the same address into "Authorized JavaScript origins" but when I type this url(localhost:8000) I am getting error:
This site cannot be reached.
Please tell me how can I set my project so that it run on localhost:8000 so that I can use it in Create OAuth client ID.

laravel - Move app to another server, blank page and artisan error

I need to move app in laravel from web server to local sever (I trying on XAMPP). I moved all files, database and in files I changed URI in:
/index.php
<? header("Location: http://localhost/public"); ?>
but I get errors in:
On http://localhost/ I have blank page
On http://localhost/public and every another route I getting error: http://pastebin.com/zUFqS8ET
When I use php artisan or another commands I getting error:
[ErrorException]
Undefined index: HTTP_USER_AGENT
I forgot about somethink?
EDIT:
Ok, I downgrade my PHP to 5.6.* but artisan still not working - same error, what's the problem?
EDIT 2:
Here is logs - problem is in SMF but I don't know why ...
http://pastebin.com/HZQ7CZeg
Sorry, I know this is obvious. But, have you run PHP composer install? And as a basic test you can create an empty laravel project to test your computer's configuration. If it works then you know its something in your project you need to update.
Laravel installation

Call method from out-of-process COM component using PHP on Azure

I've written a simple PHP script which instantiates a COM object for an out-of-process (i.e. exe file) COM component and uses it to call a COM method that the component exposes. This COM method very simply quadruples the number passed as the first argument, returning the result in the second argument (passed by reference). The script shown below works successfully on my local development machine on WampServer 2.0 (Apache 2.2.11 / PHP 5.3.1). The COM component is a Win32 executable built using Delphi.
<?php
// ensure no time limit is imposed
set_time_limit(0);
// show all errors, warnings and notices whilst developing
error_reporting(E_ALL);
$numIn = 3;
$numOut = new VARIANT(1, VT_I4);
echo '----- BEFORE ---------' . '<br>';
echo 'NumIn: ' . $numIn . '<br>';
echo 'NumOut: ' . $numOut . '<br>';
echo '----------------------' . '<br>';
$oleapp = new COM("OleAutomationFeasibilityModel.Automation") or die ("Could not initialise feasibility model object.");
echo '<br />COM object created version = ' . $oleapp->Version . '<br /><br />';
$oleapp->CalculateWithVariants($numIn, $numOut);
unset($oleapp);
echo '----- AFTER ---------' . '<br>';
echo 'NumIn: ' . $numIn . '<br>';
echo 'NumOut: ' . $numOut . '<br>';
echo '----------------------' . '<br>';
?>
Note: as I understand it, one can only pass a parameter by reference to a COM method using a VARIANT type, as common data types like integers and strings won't work (see http://www.php.net/manual/en/ref.com.php#45038).
I then created and deployed an Azure Web Role (Cloud Service) with a startup script that registers the COM component successfully i.e. the appropriate registry keys appeared in the registry. To further confirm that the COM component could be interacted with, I used RDP to connect to the cloud service instance and installed Microsoft Access Runtime 2010 as I have an Access application that provides a GUI to test the methods of the COM component. I was able to run this application and successfully interacted with the COM component, using it to pass an integer to the CalculateWithVariants method and the expected quadrupled result was returned. So, I've established that the COM component is installed and can be interacted with on the Azure cloud service instance.
Next I included the above PHP script in the Web Role and deployed it on Azure. Unfortunately, calling the script from a browser results in an HTTP Error 500 (Internal Server Error) and I'm struggling to find out why. If I comment out all lines referencing $oleapp, I still get the same error. If I additionally comment out the line that instantiates a variant object, no error occurs. If I reinstate the line which instantiates the COM object and the line below it, I receive no error message but the only text echoed is from the lines preceding the COM object creation line i.e. the call to the Version method fails. So it appears to be struggling with the variant object creation and the COM object creation.
I'm a bit stuck in terms of how to resolve this issue. I would therefore be very grateful if anyone has any pointers as to a way forward.
UPDATE 1
I decided to try a different course of action on the Azure platform by...
creating an Azure Virtual Machine with a Windows Server 2008 R2 OS
installing WampServer 2.2E (Apache 2.2.22 / PHP 5.3.13 / MySQL
5.5.24) in the VM as a quick and easy way to test whether this approach would work
copying the above PHP script into the WampServer "www directory"
launching WampServer
selecting the "Put Online" option from the WampServer Menu (accessed by left-clicking the WampServer icon in the Windows Taskbar Notification area)
creating an "Inbound Rule" for the VM firewall to allow connections to port 80
...and thankfully the script ran successfully!
Ideally, I would still like to get this working as an Azure cloud service as it shouldn't be necessary for me to maintain the PHP installation in a full VM.
UPDATE 2
I tried restarting the cloud service, then remotely connecting to an instance of the cloud service and looking in the Application Event Viewer. I saw that WMI logged 1 error during startup:
Event filter with query "SELECT * FROM __InstanceModificationEvent WITHIN 60
WHERE TargetInstance ISA "Win32_Processor" AND TargetInstance.LoadPercentage > 99"
could not be reactivated in namespace "//./root/CIMV2" because of error 0x80041003
Events cannot be delivered through this filter until the problem is corrected.
I then ran the above script a couple of times and rechecked the Application Event Viewer but nothing had been logged.
I also checked the IIS logs and the Azure log, startup-tasks-log and startup-tasks-error-log files to no avail.
After giving up on solving this last year. I made another concerted effort to resolve it this week and succeeded!
I basically needed to (a) enable the php_com_dotnet.dll to allow use of COM and VARIANT classes, and (b) grant default Local Activation permission to IIS_IUSRS to allow access to the COM component. I've listed the detailed steps I took below...
Add a folder called php in the web role's bin folder
As of PHP 5.3.15 / 5.4.5, in order to use the COM and VARIANT
classes, the php_com_dotnet.dll needs to be enabled inside of
php.ini. Previous versions of PHP enabled these extensions by
default (source: http://www.php.net/manual/en/com.installation.php). In
the php folder, create a php.ini file containing only the following
lines...
[COM_DOT_NET]
extension=php_com_dotnet.dll
Create a SetDCOMPermission.reg file in the bin folder which contains the following content, to grant default Local Activation permission to IIS_IUSRS...
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OLE]
"DefaultLaunchPermission"=hex(3):01,00,04,80,74,00,00,00,84,00,00,00,00,00,\
00,00,14,00,00,00,02,00,60,00,04,00,00,00,00,00,14,00,1F,00,00,00,01,01,00,\
00,00,00,00,05,12,00,00,00,00,00,18,00,1F,00,00,00,01,02,00,00,00,00,00,05,\
20,00,00,00,20,02,00,00,00,00,18,00,0B,00,00,00,01,02,00,00,00,00,00,05,20,\
00,00,00,38,02,00,00,00,00,14,00,1F,00,00,00,01,01,00,00,00,00,00,05,04,00,\
00,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,01,02,00,00,00,00,00,\
05,20,00,00,00,20,02,00,00
I don't know if the above registry change will work for everyone, so the process I used is documented here (it essentially involved using a program called RegFromApp to record the changes made to the registry when granting default Local Activation permissions for IIS_IUSRS in COM Security and to save the registry changes as a .reg file into the web role's bin folder).
Copy and paste the out-of-process COM component (OleAutomationFeasibilityModel.exe file) into the bin folder
Create a RegisterOleAutomationFeasibilityModel.cmd file in the bin folder to register the COM component and set the necessary permissions to launch it...
chcp 1252>NUL
OleAutomationFeasibilityModel.exe /regserver
regedit.exe /s SetDCOMPermission.reg
exit /b 0
In the ServiceDefinition.csdef file, insert a reference to the .cmd file immediately before the closing Startup tag...
<Task commandLine="RegisterOleAutomationFeasibilityModel.cmd" executionContext="elevated" />
Publish the web role
Hope that helps someone in a similar situation!

Symfony: Widget schema does not include the following field(s): title

I'm working in a symfony-based project. I did not do.
The page works in a simple webserver (debian+apache+php) and i move this from my home server, with Debian + Nginx + php-fpm, this works, but it throws an error that did not.
The complete error is here: http://pastebin.com/PCy0v1J6
Have you moved all your files? I guess that Brick is an object in your schema.yml, and it has a property 'title'. You should have a file BaseBrickForm.class.php in lib/form/doctrine/base, if you don't you should execute ./symfony doctrine:build --all-classes. It's common to have the autogenrated classes ignored by a versioning system, so it may be the source of your problem.
In SF_ROOT_DIR/lib/form/brickForm.class.php line 23ff you have :
$this->useFields(array('title', 'content'));
Please check the widgets defined in your BaseBrickForm.class.php file and if brickForm.class.php is extending BaseBrickForm !

Categories