|
Aniki posted:Edit: Fixed. I'll explain the fix in another post. Ok, I figured out the issue. You can't have multiple actions of the same type directed to a POST or GET request. So a GET and a POST request to the same route is fine, but two POST requests to the same route, even if they are directed to different functions, will cause a conflict. Below is an example of working route code: php:<? Route::get('/orders/orderStep5', 'OrdersController@getOrderStep5'); Route::post('/orders/orderStep5/newCheck', 'OrdersController@postOrderStep5NewCheck'); Route::post('/orders/orderStep5/newCC', 'OrdersController@postOrderStep5NewCC'); ?> http://stackoverflow.com/questions/17338237/laravel-4-multiple-forms-on-same-page Aniki fucked around with this message at 22:42 on Mar 31, 2015 |
# ? Mar 31, 2015 22:39 |
|
|
# ? Jun 1, 2024 16:04 |
|
New to PHP and before I make a big mistake I have a couple of stupid questions: I already have mySQL installed. I want to install Wampserver, with an older version of mySQL as part of the package. There are no options or auto-detection of installed software. Will there be any conflict if I installed Wampserver and have two instances and versions of mySQL? I'm assuming it's a whole separate service with no conflict? I've searched online, but it's mostly people just trying to import current databases into their Wampserver's DB. I really don't want to uninstall my newer mySQL now because it comes with a lot of things used by other development environments. I just have doubts, like whether it'll know which service I'm using if I log in through the console. It seems to be dependent on the folder. Dumb questions but I've never been forced to have two installs of similar database software before.
|
# ? Apr 1, 2015 16:12 |
|
Aniki posted:I would prefer to not store/handle any payment information, but this company changes processing banks and payment gateways frequently and relies heavily on recurring billing, so as much as I'd like to just store an encrypted reference number, it would cause too many problems on their end. Don't you have to worry about being PCI compliant the second you touch card info?
|
# ? Apr 5, 2015 04:13 |
|
hayden. posted:Don't you have to worry about being PCI compliant the second you touch card info? Yep. Pretty clearly D since January of this year. Even without passing cardholder data through a form submit a site's still A:EP.
|
# ? Apr 5, 2015 04:18 |
|
spacebard posted:Yep. Pretty clearly D since January of this year. Even without passing cardholder data through a form submit a site's still A:EP. Someone else handles PCI compliance and they are fully compliant, but I'm not sure on which standard. As for the application, it will be used in a call center setting by sales agents and will not be accessible to the public. If it were accessible to the public, then at least one of our merchants would require us to use their portal for entering payment info and processing requests. I'd prefer to let the merchant deal with payment entry, validation, and processing, but I don't see that happening at this time, so all I can do is take steps to make that process as secure as possible, which is a big part of why I'm using Laravel, since they have built in CSFR protection, SQL injection projection, encryption, validation, and an auth/permissions system to further restrict who can access or enter payment info. I know it's not ideal for me to handle this on my own even with a framework, but that's all I can do for now and the system will be built so that they can easily switch to using the merchant's portals if that becomes a requirement.
|
# ? Apr 6, 2015 22:42 |
|
The OP is going on about 7 years old at this point. Is there a recommend book for beginners wanting to learn PHP? Just as a hobbyist, not needing it for work.
|
# ? Apr 7, 2015 00:17 |
|
I can't help with an actual book, but books will help you learn the language and a methodology, usually with an arbitrary CMS-esq goal using approah Y. Do you actually want to build a specific thing? Do you have any prior experience or knowledge in other languages or with PHP itself? Depending on your starting position, it might be OK for you to pick a suitable framework for whatever task you want to accomplish and focus your learning there.
|
# ? Apr 7, 2015 05:04 |
Is the book Easy Laravel 5 any good? I've worked with low-medium level PHP before and used the more basic Laravel 4 elements but it looks like they've introduced a lot of new stuff in 5 and if I do work with it I would like to make use of their smartypants solutions rather than just slapping my meatfists around to make things work. Is it worth the $15?
Sulla Faex fucked around with this message at 17:57 on Apr 8, 2015 |
|
# ? Apr 8, 2015 17:55 |
|
Sulla-Marius 88 posted:Is the book Easy Laravel 5 any good? I've worked with low-medium level PHP before and used the more basic Laravel 4 elements but it looks like they've introduced a lot of new stuff in 5 and if I do work with it I would like to make use of their smartypants solutions rather than just slapping my meatfists around to make things work. Is it worth the $15? I was curious so I did some Googling and found this discussion: http://laravel.io/forum/02-10-2015-easy-laravel-5-book-is-it-worth-getting I'm inclined to agree with the general sentiment there that you're better off using Laracasts or something.
|
# ? Apr 10, 2015 07:38 |
So, I did "composer install...," and, "laravel new...," and then I sat there being confused for a while, because I didn't know Laravel 5 had happened. Holy cow is the information on Laravel 5 schizophrenic. There seems to be an awful lot of mixing-and-matching going on with the "old" style and the new. I have a controller and a Request. I finally figured out how to do customized validation in the Request (although I am almost certainly doing it wrong, since my method is a hodgepodge of what I could pull together from the official documentation and the forums.) I am also using route model binding with this controller, so that /edit/{blah} automatically loads the model with id {blah}, and passes it to my controller. Now, I would like to access the {blah} model inside my Request class. In the controller, it's a snap. I just type-hint like so code:
code:
code:
So, am I supposed to be able to access the {blah} model inside the Request? I can get to it just fine in the controller, but I want to use it in the request for validation purposes. Short version: can I inject or access a model from inside a Request object the same way I can when I use (\App\Models\MyModel $myModel) inside a controller? Edit: Maybe I really am supposed to use $this->route()->blah? That seems kind of bad. Centripetal Horse fucked around with this message at 12:31 on Apr 15, 2015 |
|
# ? Apr 15, 2015 11:05 |
|
It makes a little more sense if you consider how the route binding is just swapping out the contents of a route parameter with an instance of the Model. Here's an example from a project I'm working on:PHP code:
|
# ? Apr 15, 2015 13:42 |
|
Any guesses why my site is loading so slow? http://www.besiegedownloads.com/ It seems like it's not the actual loading of resources that's taking forever, it's just the "first byte" time that's slooow. It's on DigitalOcean and the resource graphs are fine, it's at like 50% CPU and plenty of free memory. hayden. fucked around with this message at 21:29 on Apr 18, 2015 |
# ? Apr 18, 2015 21:10 |
|
How heavy use is it? If you are default-configured the PHP/Apache, you might have a pool of like 2 php-fpm workers and 10 maxclients on apache or something equally ridiculous.
|
# ? Apr 18, 2015 21:22 |
|
It has maybe 20-30 people at a time according to Google analytics, like 11k page views per day. Seems pretty low in the grand scheme of things?
|
# ? Apr 18, 2015 21:28 |
|
Are you using anything to cache stuff in memory like Redis or Memcache? Are you using CloudFlare or some other reverse proxy/CDN to offload the server? I'm guessing the "first byte" problem isn't even on your end, it seems likely something's happening on DO's end. Probably some site on the same server getting DDOS'd. Looking at the Safari inspector, you have a few assets that return 404s including unminimized Bootstrap CSS files. wolffenstein fucked around with this message at 15:36 on Apr 19, 2015 |
# ? Apr 19, 2015 15:21 |
|
It seems better today, so it does maybe seem like a DO issue? I will transition to a CDN eventually and probably clean up some other stuff eventually too. Just a hobby site for now so I can't dedicate too much time to it. edit: for anyone curious, the cause of slowness were some super slow mysql queries running on every page. Hooray for being fixed! hayden. fucked around with this message at 05:56 on Apr 26, 2015 |
# ? Apr 19, 2015 19:11 |
|
Could anyone recommend me a decent SOAP library for PHP? Pear::SOAP isn't supported anymore and the native PHP SOAPClient is buggy garbage.
|
# ? Apr 30, 2015 18:57 |
|
Stephen posted:Could anyone recommend me a decent SOAP library for PHP? Pear::SOAP isn't supported anymore and the native PHP SOAPClient is buggy garbage. Packagist lists some https://packagist.org/search/?q=soap but I've been using the native PHP SOAP client for years without issue so I'm unfamiliar with any of those.
|
# ? Apr 30, 2015 19:31 |
|
musclecoder posted:Packagist lists some https://packagist.org/search/?q=soap but I've been using the native PHP SOAP client for years without issue so I'm unfamiliar with any of those. Upon further review, I think I prematurely blamed PHP SOAP. The WSDL loaded fine in my other applications, but I guess PHP SOAP is more strict regarding parsing which is why I thought it was a PHP fault.
|
# ? Apr 30, 2015 20:18 |
|
I'm actually having a problem I started looking into at the end of the day yesterday with the PHP SoapClient. Trying to extend it from inside of a namespace. It's possible I'm not familiar enough with PHP namespaces and its global classes, but the basic situation looks like this:code:
quote:SoapClient::SoapClient() [<a href='soapclient.soapclient'>soapclient.soapclient</a>]: Invalid parameters Line: 19 File:address.php If I remove the name space it runs fine. If I remove the \ from SoapClient then it looks for SoapClient within the namespace and throws an error. Some googling suggests I can take off the \ and then at the top declare an alias. use \SoapClient as SoapClient but that gives me the same error about parameters. (which makes sense). The problem seems to be that the $wsdl parameter isn't being passed correctly. It even confuses php storm. From where I'm calling it: code:
So either it's something stupid with the $wsdl parameter, or the $classmap is getting screwed up in the name space as well. Most of this was done with wsdl2php and was okay until we realized that some of the services use the same names for classes and it was causing issues if you used them within the same scope.
|
# ? May 1, 2015 13:49 |
|
is $wsdl_url actually set or accessible from that?
|
# ? May 1, 2015 13:58 |
|
Yeah in the actual code I'm setting it there, a la $wsdl = "http://x.com/address.svc/wsdl" I just tried new address\address("http://x.com/address.svc/wsdl"), just to see what happens, but now I'm getting an "Unauthorized Line" error. The line it references is the return line on the function I'm actually using. Very odd. Edit: I put a break point on the foreach in the address constructor. If I don't pass the wsdl manually like so: new address\address() then it never even hits the for each. If I remove the namespace, take the \ out, and then call new address() it hits the for each. It's kind of like when I'm using the namespace and going address extends \SoapClient then the public function address isn't actually being recognized as my constructor/new method. Fake edit: Googled after typing that out and it looks like it my be a php version issue. http://php.net/manual/en/language.oop5.decon.php quote:<?php So we're above 5.3.3 so this makes sense... But then why the hell does it work at all? Unless that part is only true when using namespaces? Edit2: Yup! quote:For backwards compatibility, if PHP 5 cannot find a __construct() function for a given class, and the class did not inherit one from a parent class, it will search for the old-style constructor function, by the name of the class. Effectively, it means that the only case that would have compatibility issues is if the class had a method named __construct() which was used for different semantics. Edit3: Still getting bodied by namespaces. Any attempt to return a value from the extended SoapClient results in it not being able to find the class to return. Using the example I have above. Say on the address class I have a function that returns the street class: code:
itskage fucked around with this message at 15:32 on May 1, 2015 |
# ? May 1, 2015 14:20 |
|
I am trying to add a Google Geocoder package to a Laravel 5 project and I don't seem to be having much success. I started out by trying to configure this package. I followed all of the instructions detailed in the document and added Google Geocoding API key that I created. I setup a very basic demo inside of an existing controller as well as the routing: php:<? namespace App\Http\Controllers; use App\Http\Requests; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class TestController extends Controller { public function getAddress() { $param = array( "address"=>"76 Buckingham Palace Road London SW1W 9TQ", "components"=>"country:GB" ); $reponse = Geocoder::geocode('json', $param); dd($reponse); } } ?> quote:1/1 The line in question is located inside of a protected function. I am wondering if I need to import Geocoder when I call that function or if I need to do some sort of namespace call in the controller. I did find it odd that in the instructions, they didn't mention anything about creating an alias, but even if I add one: php:<? 'aliases' => ] ... 'Geocoder' => 'Alexpechkarev\GoogleGeocoder\Facades\GoogleGeocoderFacade', ], ?> I had also looked into a different Geocoder package and the problem that I run into with that one is that when I run: quote:sudo php artisan vendor:publish --provider="toin0u/geocoder-laravel" It returns a message stating, "Nothing to Publish" and it does not create the config/geocoder.php file that it is supposed to. I thought maybe it was a permissions issue, so I got of the project and ran sudo chown [account-name] [project-name] -R and that had no impact. It seems like if I am running into issues with two packages, then it seems like I am missing something fundamental about using packages in Laravel. Has anyone used either of these Geocoder packages and/or have suggestions for what I could try to get them working properly? I am currently trying the first package and made sure to all references to other package in the code and then ran sudo composer update to remove the files from the vendor directory. Edit: For the first package, do I need to try and do some sort of method injection like you would for adding a request object? e.g. public function test(Request\test $request) Aniki fucked around with this message at 00:30 on May 5, 2015 |
# ? May 5, 2015 00:28 |
|
quote:FatalErrorException in GoogleGeocoder.php line 71:
|
# ? May 5, 2015 00:53 |
|
McGlockenshire posted:The wording there is a red herring - there's nothing wrong with your code. You don't have the curl extension installed, and the library has a hard dependency on it but doesn't list it in the composer.json. File a bug with the library author to fix their requirement list, and then go install curl. Thank you, I will file a bug report and install cURL in the morning. It would have never occurred to me that cURL wasn't installed, since it seems like such a standard PHP feature.
|
# ? May 5, 2015 01:05 |
|
itskage posted:I will get "Class 'street' not found" probably because working on the extended SoapClient does something when it's checking the datatype to return and uses the global namespace for that. gently caress. http://stackoverflow.com/questions/4807171/php-soapclient-example-using-typemap-option
|
# ? May 5, 2015 01:18 |
|
Not really strictly a PHP question, but I was getting this error message (according to logs) since 6 hours ago on my site: Could not connect: Too many connections No pages were being served at all. The issue wasn't too much traffic causing too many connections since no pages were being served. I did a simple restart of apache and mysql and it cleared right up. Most Google results are people saying increase the max number of connections, which I previously already did. What should I be looking for as the actual cause of this, though?
|
# ? May 5, 2015 02:10 |
|
hayden. posted:Not really strictly a PHP question, but I was getting this error message (according to logs) since 6 hours ago on my site: Need to know what this is from. mysql? apache? your own webapp? Is apache returning a 503 or something? Are you passing through an error from mysql?
|
# ? May 5, 2015 02:13 |
|
It's a web app I made using MySQL and PHP. I have a piece of PHP that was displaying it: if (!$con) { die('Could not connect: ' . mysql_error()); } right after trying a mysql_connect() (yeah yeah it's deprecated I know).
|
# ? May 5, 2015 02:39 |
hayden. posted:It's a web app I made using MySQL and PHP. I have a piece of PHP that was displaying it: I'm guessing you are hitting the mysql connection limit. You can increase this, but I don't think that's the best course of action. My guess is that you are failing to properly close the connection in your custom app, so you are leaking connections and eventually you run out. The bandaid for now, as you found, was to simply restart MySQL.
|
|
# ? May 5, 2015 02:46 |
|
Would it only rarely "leak" one though? Because the site has been working fine for months without this issue.
|
# ? May 5, 2015 03:17 |
|
Really depends on the exact setup and usage. You might have only just hit the connection pool limit, or it might be only one operation that results in a hanging connection. You can find out if fletcher is right though, by running this command on the server: code:
Edit: If that is the problem, see this SO post for a basic implementation of closing mysql_connect connections during destruct: http://stackoverflow.com/questions/17450971/too-many-connections-error-due-to-many-sleep-connections Alternatively upgrade to PDO, which I would recommend you do right now. Every second you learn something related to mysql_connect is a second wasted. v1nce fucked around with this message at 04:05 on May 5, 2015 |
# ? May 5, 2015 04:00 |
|
Is PHPBB still the general go-to solution for message boards?
|
# ? May 5, 2015 04:04 |
|
hedgecore posted:Is PHPBB still the general go-to solution for message boards? phpbb 3.1 is actually very very nice: https://www.phpbb.com/about/launch/ don't use any older version; ANYTHING below 3.1 - they're all poo poo
|
# ? May 5, 2015 04:05 |
|
PhpBB has a high popularity, mostly because it was the first thing on the market. It's still popular because the code is simpler, which can sometimes be limiting. SMF in my experience is better (edit: than PhpBB2) in most aspects. The downside is that plugins work by editing core files, which is a dogshit system that causes eternal pain during maintenance. MyBB is apparently the new hotness. I know nothing about this one, but glancing at the code it looks like a reasonable middle ground with slightly less awful code. I'd recommend you set up a webserver locally, then install all 3 and see which makes you least angry. Should only eat a few hours. Fake edit: Why are all forum controllers just a dump of code? Have these people never heard of event or service architecture? Modularisation?
|
# ? May 5, 2015 04:23 |
|
I mean that poo poo has to run on PHP 5.1 or whatever godawful trash $1/m indian cpanel hosts use without any idea what sysadmining is I currently use Discourse - http://discourse.org/ in production on many of my sites for a forum. It's absolutely amazing, but this is a PHP thread, so not php. Also it doesn't work on shared hosting or OpenVZ, but that's just as well because it is incredibly heavy on resources.
|
# ? May 5, 2015 04:41 |
|
You could make the same argument for the way half of Wordpress was global function-based so it ran on PHP4, but seeing as the current minimum supported version of PHP is 5.4 (security fixes only) then perhaps as a matter of responsibility people should stop writing code targeted at versions lower than that. Not to mention that the tools needed to make architecture more MVC/Service/Event/Modular have been around since at least PHP 5.0 (2004). This kind of thing just makes me despair.
|
# ? May 5, 2015 04:58 |
|
I run 5.6.99-hhvm and often do strongly typed PHP, so
|
# ? May 5, 2015 05:02 |
|
v1nce posted:I don't know if this is useful to you or not because there was so little to go on, but here's something: Thanks for this. It lead me in the right direction. So basically my example above should have been: code:
Going to say I was not happy at first because that is a lot of updating to do. The just one of the 6 WSDL classes I need to update has 181 types on the classmap. But the I saw that I can actually run the wsdl2phpgenerator with a namespace flag and it will do this for us. So this was kind of a pointless endeavor, but at least now I'll understand everything that's happening, including the quirks.
|
# ? May 5, 2015 15:46 |
|
|
# ? Jun 1, 2024 16:04 |
|
I have a class which has a function in it that puts an array in memcached. At the start of the function I'm using creating a memcached object with: code:
Aside from it feeling a bit messy, will this cause problems? Is PHP smart enough to see that localhost is already a memcache server it's using? Or will I end up with a huge "pool" that consists of only one server repeated multiple times?
|
# ? May 7, 2015 19:50 |