CakePHP cake bake giving error after selecting default - cakephp

I just created a new project with CakePHP according to the main page you get after configuring everything i'm all in the green even database connection.
i run this command:
octavius#octavius-VirtualBox:/opt/lampp/htdocs/acltutorial/cake/console$ ./cake bake all
and this happens:
Welcome to CakePHP v1.3.7 Console
---------------------------------------------------------------
App : app
Path: /opt/lampp/htdocs/acltutorial/app
---------------------------------------------------------------
---------------------------------------------------------------
Bake All
---------------------------------------------------------------
Use Database Config: (default/test)
[default] >
PHP Fatal error: Call to undefined function mysql_query() in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 600
Fatal error: Call to undefined function mysql_query() in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 600
I went into my php.ini file and added extension = 'mysql.so' and it still doesn't work. Anybody have any ideas?
PS: Doing table by table yields the same error
EDIT: After doing what dogmatic69 suggested i got these warnings:
PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 552
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 552
PHP Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 558
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 558
PHP Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 566
Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 566
PHP Warning: mysql_query() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 600
Warning: mysql_query() expects parameter 2 to be resource, boolean given in /opt/lampp/htdocs/acltutorial/cake/libs/model/datasources/dbo/dbo_mysql.php on line 600
Your database does not have any tables.
Still doesn't work.

undo the changes you have made and then do something like this
sudo apt-get install php5-mysql
sudo service apache2 restart

It's not CakePHP error for sure. This means that mysql library is not loaded. When you added the extension did you restart the server? run phpinfo() in a file and see if the mysql is loaded.

This wasn't a cake error, apparently I had to specify the port in the database.php file like so:
'port' => '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'
it couldn't connect to the database for baking, though it worked for the app itself, this fixed it.

This was running me crazy as well. I am on Ubuntu with XAMPP. Managed to fix it using 8vius' solution
In the /app/config/database.php file
'port' => '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock'

Related

Cakephp 3.x => 4.0 migration: Fatal error in PHPStan\Analyser\MutatingScope

When I run the rector script bin/cake upgrade rector --rules cakephp40 ../project/src I get the following error:
Notice: Undefined property: PhpParser\Node\Stmt\ClassMethod::$attrGroups in phar:///Users/uscreen/Sites/upgrade/vendor/phpstan/phpstan/phpstan.phar/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php on line 216
Warning: Invalid argument supplied for foreach() in phar:///Users/uscreen/Sites/upgrade/vendor/phpstan/phpstan/phpstan.phar/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php on line 216
Fatal error: PHPStan\Analyser\MutatingScope cannot implement PHPStan\Analyser\Scope - it is not an interface in phar:///Users/uscreen/Sites/upgrade/vendor/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php on line 92
The script then exits with no changes made, but it echos Rector applied successfully. I don`t know where to start to debug this.

React Native - Failed to execute aapt

I have just configured React Native FCM, when I try to start the packager:
npm install && gradlew clean
I get the following error:
enter code here
E:\projects\deets-mobile-sp\android\app\build\intermediates\res\merged\debug\values-zh-rCN\values-zh-rCN.xml:73: AAPT: warning: string 'instabug_str_empty' marked untranslatable but exists in locale 'zh-CN'
E:\projects\deets-mobile-sp\android\app\build\intermediates\res\merged\debug\values-zh-rCN\values-zh-rCN.xml:87: AAPT: warning: string 'instabug_str_plus' marked untranslatable but exists in locale 'zh-CN'
E:\projects\deets-mobile-sp\android\app\build\intermediates\res\merged\debug\values-zh-rCN\values-zh-rCN.xml:88: AAPT: warning: string 'instabug_str_powered_by_instabug' marked untranslatable but exists in locale 'zh-CN'
E:\projects\deets-mobile-sp\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:120:31-47: AAPT: No resource found that matches the given name (at 'resource' with value '#mipmap/ic_notif').
E:\projects\deets-mobile-sp\android\app\build\intermediates\res\merged\debug\values-zh-rCN\values-zh-rCN.xml:73: warning: string 'instabug_str_empty' marked untranslatable but exists in locale 'zh-CN'
E:\projects\deets-mobile-sp\android\app\build\intermediates\res\merged\debug\values-zh-rCN\values-zh-rCN.xml:87: warning: string 'instabug_str_plus' marked untranslatable but exists in locale 'zh-CN'
E:\projects\deets-mobile-sp\android\app\build\intermediates\res\merged\debug\values-zh-rCN\values-zh-rCN.xml:88: warning: string 'instabug_str_powered_by_instabug' marked untranslatable but exists in locale 'zh-CN'
warning: string 'instabug_str_record_audio' has no default translation.
E:\projects\deets-mobile-sp\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:118: error: Error: No resource found that matches the given name (at 'resource' with value '#mipmap/ic_notif').
:app:processDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4 mins 17.331 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
As I can see it is trying to find the resource with name ic_notif
Error: No resource found that matches the given name (at 'resource' with value '#mipmap/ic_notif').
Try the following fix.
Go to all of four android/app/src/main/res/mipmap-(hdpi/mdpi/xhdpi/xxhdpi),
Make a copy of ic_launcher and rename it to ic_notif.
Or you can get these png image files from example project
Hope this helps you.

Mailchimp with cakephp

I am download sample code from mailchimp site and copy paste in my c:/xampp folder now i am run the index.php file but i got following warning and error
Warning:
include(C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master/Vendor/pear-pear.cakephp.org/CakePHP\Cake\bootstrap.php):
failed to open stream: No such file or directory in
C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master\webroot\index.php
on line 107
Warning: include(): Failed opening
'C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master/Vendor/pear-pear.cakephp.org/CakePHP\Cake\bootstrap.php'
for inclusion (include_path='.;C:\xampp\php\PEAR') in
C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master\webroot\index.php
on line 107
Fatal error: CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to
the directory containing your \cake core directory and your \vendors
root directory. in
C:\xampp\htdocs\Dropbox\Demos\mailchimp\mcapi2-php-examples-master\webroot\index.php
on line 114
Now I am install composer and create phar file and try to update with composer update command but following error display
http://prntscr.com/5d2cgw
In composer.json file change require property with this lines
"require": {
"cakephp/cakephp": "2.5.*",
"mailchimp/mailchimp": ">=2.0.0"
},

Table net-Snmp : Error in packet. Reason: notWritable (That object does not support modification)

I'm working with net-snmp C API , i create a MIB file ( containt a table of information ).
After that i used the mib2c that gives me two file "myproject.h" and "myproject.c"
I copy this two files in the directory : /net-snmp/agent/mibgroup
and i compile like this :
1) ./configure --with-mib-modules=myproject
2) make
3) sudo make install
and from a terminal i run this command : snmpd -f -L -Dmyproject
and i get the message below : registered debug token myproject,1
Turning on AgentX master support
NET-SNMP version 5.7.2
My question is :
that when i try to run snmptable for this table i get the messsage : NO ENTRIES
and when i try to make snmpset to this table : i get this massage
Error in packet. Reason: notWritable (That object does not support modification)
*NOTE : in my file myproject.c i followed the example given by the net-Snmp :data_set.c
http://www.net-snmp.org/dev/agent/data__set_8c-example.html
but my table has not been initialisated
please i need help
thanks in advance
thanks K1eran for your reply .
the problem that i have it's not because of a badcommunity , here is my community configuration in the file of snmpd located in /usr/local/share/snmp:
full access from the localhost
rocommunity public localhost
rwcommunity private
really i don't know what is the problem ?
Possibly related to community strings i.e. snmpset's -c flag . It would be better to see details of snmpset and snmptable commands however as described at :
net-snmp snmpset tutorial ...
Note that if you don't have write permission to the object ...
% snmpset -v 2c -c badcommunity test.net-snmp.org ucdDemoPublicString.0 s "hello"
Error in packet.
Reason: notWritable
`
In snmpd.conf file the "#rocommunity public localhost " default settings will be commented(meaning localhost public not permitted read/write),
so
UnComment the "rocommunity public localhost" and change to "rwcommunity public localhost" then restart the snmpd service and check

CakePHP 1.2 application with non-regular Cake path throwing errors

I'm having trouble with a CakePHP website. I've dropped my app directory into a staging folder so it's a duplicate of the live site. So the structure looks like this:
app
config
...
webroot
cake
config
...
tests
docs
staging
app
config
...
webroot
vendors
vendors
I've set the CAKE_CORE_INCLUDE_PATH constant in /staging/app/webroot/index.php to the root directory where my cake folder is, and set my database settings in /staging/app/config/database.php.
Now, although the site at http://domain.com/staging/ seems to be working, I'm getting the following errors at the top of my page:
Warning (2): mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 117]
Warning (2): mysql_select_db(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 122]
Warning (2): mysql_get_server_info(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 130]
Warning (2): mysql_real_escape_string() expects parameter 2 to be resource, boolean given [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 247]
Warning (2): mysql_query(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 152]
Warning (2): mysql_errno(): supplied argument is not a valid MySQL-Link resource [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 329]
Warning (2): session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /users/ia/www.cantifix.co.uk/cake/basics.php:111) [CORE/cake/libs/session.php, line 535]
Warning (2): Cannot modify header information - headers already sent by (output started at /users/ia/www.cantifix.co.uk/cake/basics.php:111) [CORE/cake/libs/session.php, line 536]
What's going on? My database connection settings seem to be correct as like aforementioned, the site works as it should (except for these error messages).
If any one has any tips or pointers for multiple apps using a single cake library, I'd be most grateful.
i used dozens of those "app" folders in the same dir.
it all works perfectly without any configuration overhead
why are you changing your CAKE_CORE_INCLUDE_PATH?
leave it as it was.
also leave ROOT as dynamic default:
define('ROOT', dirname(dirname(dirname(__FILE__))));
cake will take care of everything itself.
also note:
you should set your VirtualHost down to webroot. example setup:
http://www.dereuromark.de/2011/05/29/working-with-domains-locally/
then there should be no problem.
I too have many projects in Cakephp and all I needed to do was to clone app/ and rename it. I did not need to change cake_core_include_path. All I needed was to setup another vhost to point to the new directory's webroot.
Maybe you copied a lock file?
Warning (2): mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2) [CORE/cake/libs/model/datasources/dbo/dbo_mysql.php, line 117]
This seem to be the error that is triggering all the rest of the errors. The rest of the mysql errors were expecting resource but got a false boolean. The header errors are due to the error outputs most likely
Fixed! Turns out it was a problem with my database.php configuration file. I copied the values from my $staging array to the $default array and cleared the tmp folder, and balance was restored in the universe.

Resources