I have a Zend Framework 1 (1.12) MVC application that has been running in production for years. It runs on my laptop under Windows 10 using xampp 1.8.2.6 (PHP 5.4.34) as well as on Amazon Linux under …
Where is the preload.php file, and how is it generated?
With Symfony 5.1 and PHP 7.4, I want to add preload.php in opcache. Symfony documentation : During container compilation (e.g. when running the cache:clear command), Symfony generates a file called preload.php in the config/ directory with the list of classes to preload. opcache.preload=/path/to/project/confi…
Sorting alphabetically by Array Value in Multidimensional Indexed Array After Custom Sort (usort) / Sort Array by Two Values
Original Array: Applied usort($terms, “mysort”); via the following function(s) This successfully ordered the array by the $sortOrder array in the getSortOrder function (base material first, and then color) Now I am trying to sort this new sorted array by name while keeping the previously applied s…
Getting error response while sending email from ionic using PHPMailer
I am trying to create a reset password page in ionic where the user enter his email ,to reset the password of his account on my application. The thing is that I want to send a response from php telling the user if the email was sent to his email or not depending on values sent from php to ionic.
PHPWord not saving file in /tmp directory
I am trying to run PHPWord’s basic example in here on my Mac. I am using XAMPP as app server. I only changed the require_once part and added sys_get_temp_dir() in front of the file name because of the “ZipArchive::close(): Failure to create temporary file: Permission denied” error as same as…
How to check duplicate but without refresh page? PHP
this is my coding. I want to check the duplicate data. If duplicate data exists, the alert will pop-out, but once I click on OK, it will go to a blank page and cannot return to the form. How to make it pop-out an alert but without refresh the page? Answer One of the solutions is to do a javascript
Laravel CRUD API Fatal Error: Trait ‘IlluminateDatabaseEloquentFactoriesHasFactory’ not found
I was following this tutorial, but with my own dataset: https://www.positronx.io/php-laravel-crud-operations-mysql-tutorial And I got stuck on the phase of Creating and storing data. After filling all the fields: Im getting this error: When I comment use HasFactory it’s showing this Please help! Answer …
MySQL SUM of multiple rows from multiple table
I am trying to get the sum of multiple rows from 2 different tables, but somehow the result returns multiple rows. I need to get the SUM of quotation_item_amount (group by quotation_id) and invoice_item_amount (group by invoice_id) and if I query unpaid quotation, I need to get WHERE SUM(invoice) < SUM(quo…
Design pattern to reduce cyclomatic complexity
I have to send invoices to cutomers through the related customer’s API. Each customer chooses how to be contacted (email, fax, sms…). My problem is that each time I add a new “contact type” I increase the cyclomatic complexity of my script. Here is my code : As you can see the switch s…
string to xHH in PHP
I am curious is that any build in or easier way to encode string to xHH format in PHP? I am trying to implement rule 3 and rule 4 from XSS OWASP Prevention with build in function or easier approach. but, I can’t find any in the internet. as far as I found, I need to make manual encoder/decoder for