Skip to main content

Posts

Showing posts with the label php

Cannot access my wordpress site in Localhost using MAMP

I am very new to MAMP and localhost. I have been on the process of develop my wordpress website on localhost (on my PC) for almost 3 months. The sad thing is that my new website is going to finish very soon but suddenly today when I tried to access my wordpress site on locahost, I could not access anymore. It states that "There has been a critical error on this website". I turned on the wordpress debugging mode and found below error logs. Fatal error: require(): Failed opening required 'C:\MAMP\htdocs\testsite/wp-includes/blocks/post-featured-image.php' (include_path='.;C:\php\pear') in C:\MAMP\htdocs\testsite\wp-includes\blocks\index.php on line 22 Please help Thanks Methee source https://stackoverflow.com/questions/70625859/cannot-access-my-wordpress-site-in-localhost-using-mamp

Missing required parameters for [Route: show.product] [URI: products/{id}/{slug}]

I bought this script from an codecanyon and I have a little experience with php. I'm using a different template. So, I'm customizing the front end and connecting with backend. Been on this error since the first week of December, last year. Made some progress so I'm kinda hooked PS: I want to use mainly simple product The script has the products, simple products, and digital products. However, when you create a simple products, it gets saved to the simple products directory in mysql. And not the products. I really need help with getting pass this error. I am working on a fashion store. I want to add a section for featured products on the homepage, I'm stuck for weeks now. Please does anyone know what I could do to solve this. Am I doing it right? Thanks in advance. ROUTE Web.php Route::get('/','Web\HomeController@newHomepage')->name('mainindex')->middleware('visiting_track'); Route::get('products/{id}/{slug}','Simp

Cannot update code with lorisleiva/laravel-deployer when deploying

I am quite new to laravel deployment using this CI/CD lorisleiva/laravel-deployer. I don't know why my code on server doesn't update when doing php vendor/bin/dep deploy staging while it is successfully deployed. Here is my deploy.yaml import: - recipe/laravel.php config: application: 'application-name' repository: 'repo' remote_user: ubuntu base_deploy_path: '/var/www' hosts: prod: hostname: 'ip' deploy_path: '/' staging: hostname: 'ip' deploy_path: '/-dev' I wonder why is it that it don't update my code. Thanks for the help. Screenshot source https://stackoverflow.com/questions/70595852/cannot-update-code-with-lorisleiva-laravel-deployer-when-deploying

Overwrite an existing phrase in Wordpress

I'm trying to write a plugin in wordpress to change an if phrase in wp-includes/comment.php. In PHP you can't override functions unfortunately, but is there any way I can get wordpress to use my phrase instead of the (almost identical) original phrase in comment.php? I want comments that don't pass the block list to be moved to spam. Normally the comments are moved to trash. This can be solved in comment.php (l. 837): Original: $approved = EMPTY_TRASH_DAYS ? 'trash' : 'spam'; Modified: $approved = 'spam'; Now I want to put this in an extra plugin to not change the wordpress core itself, but don't know hot to solve this source https://stackoverflow.com/questions/70611473/overwrite-an-existing-phrase-in-wordpress

Get Where with substr in laravel

Hello Sir I want to search use collect (Where) in laravel 2 => array:13 [▶] 3 => array:13 [▼ ".id" => "*15E" "name" => "yuliano" "password" => "panji123" "profile" => "voucher2menit" "limit-bytes-out" => "104857600" "uptime" => "0s" "bytes-in" => "0" "bytes-out" => "0" "packets-in" => "0" "packets-out" => "0" "dynamic" => "false" "disabled" => "false" "comment" => "jan/14/2022 00:18:53 up" ] i want to get data is only "UP" $response2 = $query->Where("comment", substr(-2) == "vc"); please help me sir source https://stackoverflow.com/questions/70597402/get-where-with-substr-in-laravel

I don't understand how to install MySQL [closed]

I installed the installer from the official website, I have Apache Service Monitor, I connect it to localhost. PHP works without problems. Then, I install MySQL in C:/mysql. Now I don't know how to continue, I can't connect MySQL to localhost, it returns this error . I tried to find solutions on several sites but with no success, I read about a my.cnf file that I should edit, but I have 2 my.cnf files in different directories. I'm a beginner with PHP/MySQL, so can somebody help me please? source https://stackoverflow.com/questions/70611348/i-dont-understand-how-to-install-mysql

How to reduce the white space between two line in CKeditor

I want to remove the space between two line in CKeditor. After tpying a line if I hit on enter button then its taking some exyra space between two line. How to remove it. I have highlighted the line space in the image. source https://stackoverflow.com/questions/70608222/how-to-reduce-the-white-space-between-two-line-in-ckeditor

Get wordpress thumbnail via RSS with fetch_feed

I'm triyng to fetch the thumbnail from a wordpress rss article via fetch_feed but I can't find a way work with the array the RSS send me. Example: 1 - From print_r feed I have this [xml_base] => [xml_base_explicit] => [xml_lang] => ) ) ) [http://webnus.net/rss/mec/] => Array ( [startDate] => Array ( [0] => Array ( [data] => 2022-01-17 [attribs] => Array ( ) I can call it with this: echo $item->get_item_tags('http://webnus.net/rss/mec/','startDate')[0]['data']; How can I get the url of the image from here: [xml_base] => [xml_base_explicit] => [xml_lang] => ) ) ) [http://search.yahoo.com/mrss/] => Array ( [content] => Array ( [0] => Array ( [data] => [attribs] => Array ( [] => Array ( [medium] => image [url] => https://www.example.com/wp-content/uploads/2022/01/image.jpg [width] => 648 [height] => 430 ) ) I tried everything... without success.. The method I'm using is this one:

Prepared Statements not returning the required multiple results

I have made this function after getting some help from How to perform a LIKE query using multiple keywords from search field using mysqli prepared statement , but made some changes as I have only one search parameter. function searchResult($con, $search) { $keywords = explode(" ", $search); $total_keywords = count($keywords); $myquery = "SELECT * FROM products WHERE name LIKE CONCAT('%',?,'%')"; for ($i=1 ; $i < $total_keywords; $i++) { $myquery .= " OR name LIKE CONCAT('%',?,'%')"; } $stmt = mysqli_stmt_init($con); //check if the statement is not prepared if (!mysqli_stmt_prepare($stmt, $myquery)) { header("location: search.php?errorid=stmt_failed"); exit(); } $typeparam = ''; foreach ($keywords as $key => $value) { $typeparam .= 's'; } $bind_param = array(); $bind_param[] =& $typeparam; foreach ($keywords

How to redirect from rules with no old values laravel

So i know it's weird and but I'm trying to make custom validation rule in laravel for a password so that the new password can't be the same as the old one when i try to change my password but I want to empty the fields when i redirect back so i don't want any old values for security purposes to fill the inputs for that exact validation only but the others can redirect back and fill the old values easily so how can I do that with the custom rules source https://stackoverflow.com/questions/70571357/how-to-redirect-from-rules-with-no-old-values-laravel

php mssql insert into database [duplicate]

Currently trying to add a record into my database using a html for into php. I've got the posting working from the form into the php I've tested this with a string. However I just can't seem to get my database connection down correctly. //This bit is working $reportedby = $_POST['reportedBy']; $location = $_POST['loc']; $desc = $_POST['desc']; $link = mssql_connect("host", "user*", "pw", "db"); // insert $sql = "INSERT INTO maintapp (reportedby, loc, brief) VALUES ('$reportedby', '$location', '$desc')"; mssql_query($link, $sql) // Close connection mssql_close($link); ?> Error_Log [05-Jan-2022 10:43:18 America/Boise] PHP Fatal error: Uncaught Error: Call to undefined function mssql_connect() in /home1/jcodecou/public_html/jwebdesign/maintapp/upload.php:9 Stack trace: #0 {main} thrown in /home1/jcodecou/public_html/jwebdesign/maintapp/upload.php on line 9 sou

JSON.parse not working when I use "success" as a key

I am working on a project where I use a lot of http requests. Most of the time the server will respond as a json with either: {"error": "Request invalid"} or {"success": "Request successful"} The server side page that returns the response looks like this: <?php header('Content-type: application/json'); $data = []; if (isset($_POST['action']) { if ($_POST['action'] == 'function_one') { /* Arbitary Function... */ $data['success'] = 'This works...'; } elseif ($_POST['action'] == 'function_two') { /* Arbitary Function... */ $data['error'] = 'Example error'; } elseif ($_POST['action'] == 'function_that_is_not_working') { $data['success'] = 'This unexpectedly does not interpret correctly...'; } } $post_data = json_encode(

move_uploaded_file Failed to open stream: Permission denied in XAMPP MacOS

I was trying to upload a file using php to my local using XAMPP on MacOS. Whenever I tried to upload a file through script, I got thi error. move_uploaded_file - Failed to open stream: Permission denied So I tried some fixes I saw on internet, like chmod -R 777 , changing the user-group and also tried to give read&write permisson to every user; None of them works. I wanna know how this error can be fixed. I think this is some security issues of MacOS. source https://stackoverflow.com/questions/70583017/move-uploaded-file-failed-to-open-stream-permission-denied-in-xampp-macos

JWT token generation fails, MUX API responds with error

I'm trying to run the PHP example code documented here on the MUX website. I have just generated a brand new API key + secret and have stored them in a mux-credentials.php file: define('MUX_TOKEN_ID', 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'); define('MUX_TOKEN_SECRET', '<base64-encoded-string-here>'); I used composer to install Firebase\JWT as instructed here and then ran the exact code specified in the MUX documentation: // load libs require_once 'vendor/autoload.php'; // load MUX credentials require_once 'mux-credentials.php'; use \Firebase\JWT\JWT; $myId = "<MY-ASSET-ID-HERE>"; // Enter the id for which you would like to get counts here $myIdType = "asset_id"; // Enter the type of ID provided in my_id; one of video_id | asset_id | playback_id | live_stream_id $keyId = MUX_TOKEN_ID; // Enter your signing key id here $keySecret = MUX_TOKEN_SECRET; // Enter your base64 encoded pri

toc on more then one page is creating issue in dompdf

I have created TOC in dompdf toc is for chapters and figures are working fine until both toc are short and fit on the same page otherwise toc content on the next page does not work correctly. More info about my issue can be found at dompdf issues here on the link . Any help will be highly appreciated. source https://stackoverflow.com/questions/70583075/toc-on-more-then-one-page-is-creating-issue-in-dompdf

How Can remove /checkout/ word from the thank you URL in WordPress

I have store on WordPress and I used woocommerce plugin this is my thank you page URL "example.com/checkout-2/order-received/2943/" I need to remove "checkout-2" from it to be like this "example.com/order-received/2943/" how can I do this. source https://stackoverflow.com/questions/70570793/how-can-remove-checkout-word-from-the-thank-you-url-in-wordpress

How to improve our current dev and prod workflow using git [closed]

I'm trying to come up with a solution that would help us alleviate constant issues within our company. We have dozens of websites that are not very consistent, meaning their file structures differ and require different PHP versions(5.3, 7.0, and 7.4). When we need to make some changes to a project, we usually modify files that are stored on our dev server(Windows) where Apache, MySQL, and PHP are running. Our projects are then available on http://{PROJECT_NAME}.example.com. The pros are that all projects are served by the dev server, and developers don't need to waste time on installing and configuring Apache, MySQL, and different versions of PHP on their machines. If something needs to be modified, they simply make the necessary changes directly over LAN, and can immediately see what changes they've made. The cons are that it's very difficult to keep track of changes, especially when multiple people are involved. When we work on an old project for a few weeks or mo

Response Server duration in Laravel Middleware

I am Trying to get the response Server Duration in my Middelware and save it in Sql DataBase , Here is my middelware public function handle(LaravelRequest $request, Closure $next) { $this->startTime = microtime(true); return $next($request); } class AfterMiddleware { public function handle(LaravelRequest $request, Closure $next) { $response = $next($request); $request->fingerprint(); $RequestSaving = new Request(); $endpoint=Endpoint::where("url",$request->url())->firstOrCreate(["url"=>$request->url()]); $RequestSaving->endpoint()->associate($endpoint); $RequestSaving->method = $request->getMethod(); $RequestSaving->status = $response->Status(); $RequestSaving->user_id = Auth::id(); $RequestSaving->duration=microtime(true)-$this->startTime; $RequestSaving->result =$respons

Get ODBC Driver Name with PDO

Here is my connection string (set elsewhere): $dns = "odbc:Driver=MDBTools;DBQ=/home/mbi-admin/scripts/RE/ConstituentData.MDB;" Here is my code function InitializeDB($dsn, $user, $pass) { echo "************** \n"; //$dsn = "mysql:host=$host;dbname=$db;charset=$charset"; $options = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, ]; /* echo "***DSN: $dsn \n"; echo "***User: $user \n"; echo "***Pass: $pass \n"; echo "********Option: " ; print_r($options); echo " \n"; */ try { $pdo = new PDO($dsn, $user, $pass, $options); return $pdo; } catch (\PDOException $e) { throw new \PDOException($e->getMessage(), (int)$e->getCode()); } } Later on in my code I want to be able to determine that this is MDBTools, however when I try to do getAttribu