Questions tagged [cakephp]

CakePHP is an open-source web, rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. It uses commonly known design patterns like MVC and ORM within the convention over configuration paradigm.

Filter by
Sorted by
Tagged with
114 votes
3 answers
219k views

"[notice] child pid XXXX exit signal Segmentation fault (11)" in apache error.log [closed]

I am using Apache/PHP/MySQL stack. Using as framework CakePHP. Every now and then I get a blank white page. I can't debug it through Cake, so I peek in the apache error.log and here's what I get: [...
mgPePe's user avatar
  • 5,837
110 votes
9 answers
132k views

Best way to document Array options in PHPDoc?

I'm struggling to write readable and easy to understand documentation that describes the multi-tree structure for Array options that are passed to a function. Here is an example array structure. $...
Reactgular's user avatar
  • 53.8k
101 votes
6 answers
144k views

Set Response Status Code [duplicate]

I have an API call for which I need to be able to run some checks and potentially return various status codes. I don't need custom views or anything, I just need to return the proper code. If the user ...
Rob Wilkerson's user avatar
87 votes
7 answers
124k views

How do you make strings "XML safe"?

I am responding to an AJAX call by sending it an XML document through PHP echos. In order to form this XML document, I loop through the records of a database. The problem is that the database ...
JayD3e's user avatar
  • 2,187
80 votes
9 answers
269k views

How to check not in array element

I am trying to check if an element is not in array than want to redirect page: My code is as below: $id = $access_data['Privilege']['id']; if(!in_array($id,$user_access_arr)) { $this->Session-...
s4suryapal's user avatar
  • 1,920
79 votes
9 answers
158k views

How can I see CakePHP's SQL dump in the controller?

Is there a way that one can cause CakePHP to dump its SQL log on demand? I'd like to execute code up until a point in my controller and see what SQL has been run.
Justin's user avatar
  • 799
76 votes
2 answers
13k views

Fat models, skinny controllers and the MVC design pattern [closed]

I just read a blog post that explains MVC with a banking analogy. I have a few months of experience with web application development with an MVC framework (CakePHP), so I get the basics, but I began ...
ryonlife's user avatar
  • 6,583
69 votes
18 answers
110k views

CakePHP 3.0 installation: intl extension missing from system

Using the CakePHP docs, I am trying to install 3.0-beta2 using composer but I got this error: cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from ...
Juan Carlos's user avatar
  • 1,093
69 votes
2 answers
195k views

What is /var/www/html? [closed]

I am starting to pick up PHP / MySQL, but in all the documentation I'm reading, it mentions /var/www/html as being the folder you want to install a framework such as CakePHP, or for example /var/www/...
Jason Sherman's user avatar
67 votes
15 answers
232k views

PHP Fatal error: Class 'PDO' not found

PHP Fatal error: Class 'PDO' not found in /home/bd/public_html/app/webroot/Cake/Model/Datasource/Database/Mysql.php on line 177 PHP INFO: PDO PDO support => enabled PDO drivers => sqlite, ...
Amanada Smith's user avatar
63 votes
25 answers
151k views

How to get complete current url for Cakephp

How do you echo out current URL in Cake's view?
Passionate Engineer's user avatar
63 votes
15 answers
164k views

Input value doesn't display. How is that possible?

This must be something utterly stupid that I've done or am doing, but I have an input with a value attribute that simply isn't being displayed: <div class="input text required"> <...
Rob Wilkerson's user avatar
63 votes
7 answers
244k views

Request exceeded the limit of 10 internal redirects due to probable configuration error

I'm getting the following error in my CakePHP application: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit ...
Stephen's user avatar
  • 4,775
62 votes
4 answers
208k views

Generate ER Diagram from existing MySQL database, created for CakePHP [closed]

For CakePHP application, I created MySQL database. Which tool to be used to create ER Diagram of database? Fields and relations between tables are created in a way cakePHP likes. thank you in ...
user198003's user avatar
  • 11.1k
56 votes
8 answers
79k views

Can I use one model inside of a different model in CakePHP?

Can I use another Model inside one model? Eg. <?php class Form extends AppModel { var $name='Form'; var $helpers=array('Html','Ajax','Javascript','Form'); var $components = array( '...
useranon's user avatar
  • 29.4k
56 votes
9 answers
34k views

symfony vs cakephp [closed]

What is conceptually the difference between symfony and cakephp?
user avatar
52 votes
9 answers
85k views

CakePHP: Find where field is not null

I need to select all rows where User.site_url is not null. It's simple enough to do this in a regular MySQL query but how is this done in CakePHP? The manual mentions the following: array ("not&...
DanCake's user avatar
  • 2,003
51 votes
14 answers
79k views

How can I tell which CakePHP version is a project made with?

Is it possible to know the version of CakePHP used to generate a project with only the app code available? My problem: I downloaded a project made with CakePHP, and I really can't tell which Cake ...
Mauricio Pasquier Juan's user avatar
51 votes
6 answers
149k views

CentOS: Enabling GD Support in PHP Installation

How do I go about enabling GD Support in a CentOS Installation?
AKKAweb's user avatar
  • 3,795
50 votes
22 answers
125k views

What is the equivalent to getLastInsertId() in Cakephp?

If I do getLastInsertId() immediately after a save(), it works, but otherwise it does not. This is demonstrated in my controller: function designpage() { //to create a form Untitled $this->...
useranon's user avatar
  • 29.4k
50 votes
3 answers
23k views

How to unit test your API?

I'm at the point where I need to write unit tests for a REST API written using CakePHP 1.3. The API supports GET, POST and PUT requests for querying and manipulating data. Is there any established ...
deceze's user avatar
  • 517k
49 votes
7 answers
60k views

Is PHP Object-oriented?

Is PHP an object-oriented language? If not, then what about the framework CakePHP? Is it an object-oriented MVC implementation of PHP? Also, can a PHP application wholly built using classes be called ...
avon_verma's user avatar
  • 1,249
48 votes
1 answer
20k views

How to store repeating dates keeping in mind Daylight Savings Time

I'm storing events in my database. I have 'start' and 'end' date times, 'tickets_start' and 'tickets_end' (for when ticket sales actually start/end - as opposed to the start/end of the actual event). ...
Dave's user avatar
  • 28.9k
48 votes
3 answers
22k views

PHPUnit's returnValueMap not yielding expected results

I'm trying to use PHPUnit's returnValueMap() to stub out the results of a read. It isn't yielding the expected results, but an equivalent returnCallback() does. I've made my test case available if ...
Brad Koch's user avatar
  • 19.8k
47 votes
12 answers
59k views

What is a .ctp file used for in CakePHP?

I'm starting to use CakePHP, and I'm in the process of reading the manual. About halfway down the page, there's this comment: // Render the element in /views/elements/ajaxreturn.ctp So a very ...
Dirk's user avatar
  • 6,804
45 votes
11 answers
88k views

CakePHP - get last query run

I want to get the last query CakePHP ran. I can't turn debug on in core.php and I can't run the code locally. I need a way to get the last sql query and log it to the error log without effecting the ...
user avatar
44 votes
3 answers
115k views

CakePHP find method with JOIN

Hi, I need to do the following query using the CakePHP find method: SELECT * FROM `messages` INNER JOIN users ON messages.from = users.id WHERE messages.to = 4 ORDER BY messages.datetime DESC ...
geoffs3310's user avatar
  • 13.9k
43 votes
2 answers
24k views

Display CTP Files as PHP Files in PHPStorm

I have a project running on CakePHP. All of my views are stored as ctp files. How do I render my ctp files so I have the same visual formatting that's present when I look at a file that is stored as ...
Lloyd Banks's user avatar
  • 35.9k
42 votes
3 answers
164k views

how we add or remove readonly attribute from textbox on clicking radion button in cakephp using jquery?

Here is my cakephp generated HTML radio box and text box script: <input type="radio" id="need_staff_on_site" name="data[CaterRequest][need_staff_on_site]" value="yes" class="staff_on_site"><...
Pank's user avatar
  • 14k
41 votes
5 answers
108k views

How do you update a cookie in PHP?

If I call setcookie() two times with the same cookie name, I get two cookies created. How do you update an existing cookie?
Cookie's user avatar
  • 421
40 votes
13 answers
49k views

php e() and h() functions?

I and lately I'm seeing h() and e() functions in PHP. I have googled them, but they are so short that results don't give any idea of what they are. I got results like exponential or math related ...
nacho4d's user avatar
  • 44.4k
40 votes
7 answers
71k views

save() returning false, but with no error in CakePHP

My debug value is set to 2, and it's displaying all the queries, except the one I need. I have an Items controller method that is calling this method in the User model (Item belongsTo User): ...
Dan's user avatar
  • 401
40 votes
3 answers
65k views

Cakephp cake_core_ cache was unable to write 'cake_dev_en-us'

I have tried EVERYTHING but i keep getting the following cake error: ( ! ) Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /var/www/bloglic-2013/cake/lib/Cake/Cache/...
Marc Rasmussen's user avatar
39 votes
4 answers
62k views

The processing instruction target matching "[xX][mM][lL]" is not allowed [duplicate]

I'm outputting XML in CakePHP. But I'm getting this error when I put my XML into a validator: The processing instruction target matching "[xX][mM][lL]" is not allowed. I am using correct XML layout ...
Passionate Engineer's user avatar
39 votes
2 answers
43k views

Cakephp check if record exists

I am wondering, is there a function that allows me to check instantly if a record in the database exists? Right now I am using the following piece of code to detect if a record exists, but I can ...
Jelmer's user avatar
  • 2,673
39 votes
8 answers
10k views

Speeding up CakePHP

I've been a keen fan and user of CakePHP for about 2.5 years now, but the main bugbear that most fellow developers level at the framework is that it's slow, and the dispatch cycle takes too long to ...
David Yell's user avatar
  • 11.8k
38 votes
3 answers
28k views

How to declare the type for local variables using PHPDoc notation?

I use Zend Studio to develop in PHP with CakePHP, and one of the problems with CakePHP is that the views all reference undeclared local variables. So for example, in the controller you would $this-&...
Reactgular's user avatar
  • 53.8k
37 votes
7 answers
95k views

base_url in CakePHP

In most web applications we need global var base_url. In cakephp to get base_url currently i put the following code on beforeRender method in app_controller.php function beforeRender(){ $this->...
Musa's user avatar
  • 4,004
36 votes
19 answers
79k views

CakePHP Database connection "Mysql" is missing, or could not be created

There have been several other posts about this, but none of the answers seemed to work for me. When I navigate to the CakePHP page on my local machine, there is one error: Cake is NOT able to ...
Ben Caine's user avatar
  • 1,198
35 votes
12 answers
507k views

404 Not Found The requested URL was not found on this server

I'm having small troubles and was wondering if someone can help me over the hump. I pulled a copy of a website down from Hostgator and I'm trying to set it up on my local machine using WAMP but, I ...
SkillSet's user avatar
  • 621
35 votes
3 answers
52k views

Loading Vendor Files in CakePHP 2.0

I'm currently upgrading one of our projects to CakePHP 2.0. Unfortunately the "first line" of code makes problems, and I can't find a solution to that problem. In CakePHP 1.3 I had an App::import("...
Johannes N.'s user avatar
  • 2,374
34 votes
12 answers
18k views

To Use a PHP Framework or Not? [closed]

I've started writing a few applications in PHP, and I'm becoming more familiar with the language. Someone told me about CakePHP, and CodeIgniter. I wanted to get a better understanding of how these ...
Jonathan Lyon's user avatar
34 votes
4 answers
178k views

Undefined variable: $_SESSION

I'm getting E_NOTICE errors in a core CakePHP file when it tries to reference a never-set or unset session (cake/libs/cake_session.php line 372): function read($name = null) { if (is_null($name)) ...
Ian Hunter's user avatar
  • 9,665
33 votes
2 answers
37k views

How can I run composer without user interaction?

I'm trying to run composer install on a cakephp installation, however it asks the user if they want to they want to set folder permissions: Note, this is an example. In production the composer ...
John Hunt's user avatar
  • 3,932
33 votes
4 answers
21k views

Asynchronous processing or message queues in PHP (CakePHP) [closed]

I am building a website in CakePHP that processes files uploaded though an XML-RPC API and though a web frontend. Files need to be scanned by ClamAV, thumbnails need to be generated, et cetera. All ...
Sander Marechal's user avatar
32 votes
7 answers
106k views

Rendering controller to a different view in CakePHP

Is there a way to render a controller to a different view then normal? I'm trying to pass some data from the controller to a non-default view. Meaning my controller is called: class ...
devmonster's user avatar
  • 1,739
32 votes
7 answers
62k views

How do I update 1 field in CakePHP?

I want a function to alter one field, "is_featured" to 1(true) of Event model of given ID, to mark an event as "Featured". class EventsController extends AppController{ function feature($id){} }
Moe Sweet's user avatar
  • 3,713
31 votes
10 answers
33k views

How do you specify an HTTP status code in Cakephp?

In my controller, I check a condition to see if the user is allowed to do something. If the check fails, I want to send a 403 back to the browser. How do I do that in Cakephp?
allyourcode's user avatar
  • 22.2k
31 votes
7 answers
42k views

CakePHP 2.0 - How to make custom error pages?

I read that the AppError class is now for backwards compatibility and that Exceptions should be used instead. How does one go about creating custom error pages for things like 404 errors, or ...
BadHorsie's user avatar
  • 14.3k
31 votes
9 answers
32k views

Using CakePHP FormHelper with Bootstrap Forms

CakePHP's FormHelper is how you generate forms when making CakePHP applications. As one might assume, this includes generating input elements, like so: $this->Form->input('abc'); Which will ...
lericson's user avatar
  • 1,318

1
2 3 4 5
634