Hey, i am a Junior developer in a FinTech company (and its my first company) and our main project i.e. client onboarding and verification is on Laravel. Right now we are not using cache, jobs, server events, concurrency or anything like that and I feel the system is pretty slow. What are the industry standards for using these tools and techniques and how common are they in the production apps (I have no idea about it as it’s the first organisation i am working for). Recently i was studying about queues, workers , supervisors, etc, what’s the scenarios where these could come handy. Also I was looking for a comprehensive guide on implementing workers and supervisors with CI/CD pipelines (Gitlab)
Why isn't this working? My code scans all PHP files in a WordPress theme, extracts user-facing strings with regex, translates them using Gemini, and replaces the originals. Then, I fix PHPStan-detected bugs, resolve formatting issues like duplicate quotes, and ensure LF line endings with UTF-8 encoding (without BOM). But after all that, it still doesn't work—any guesses why?
import os import re import time import threading import chardet from google import genai from google.genai import types
REQUESTS_PER_MINUTE = 14 REQUESTS_PER_DAY = 1499 current_requests_minute = 0 current_requests_day = 0 last_minute_timestamp = time.time() lock = threading.Lock() # Ensures thread safety def translate_text(USER_INPUT1): #print(USER_INPUT1) global current_requests_minute, current_requests_day, last_minute_timestamp with lock: # Prevent race conditions in multithreaded execution now = time.time() # Reset per-minute request count if 60 seconds have passed if now - last_minute_timestamp >= 60: current_requests_minute = 0 last_minute_timestamp = now # Enforce rate limits if current_requests_minute >= REQUESTS_PER_MINUTE: print(f"⚠ Rate limit reached: Waiting before sending more requests...") while time.time() - last_minute_timestamp < 60: # Wait for next minute time.sleep(1) if current_requests_day >= REQUESTS_PER_DAY: print(f"🚫 Daily limit exceeded: No more requests will be sent today.") return USER_INPUT1 # Return original text to avoid unnecessary API calls try: client = genai.Client( api_key=GEMINI_API_KEY ) model = "gemini-2.0-flash-lite" contents = [ types.Content( role="user", parts=[ types.Part.from_text(text=USER_INPUT1), ], ), ] generate_content_config = types.GenerateContentConfig( temperature=1.1, max_output_tokens=455, thinking_config=types.ThinkingConfig( thinking_budget=0, ), response_mime_type="text/plain", system_instruction=[ types.Part.from_text(text=r"""جمله یا کلمه رو برای وبسایت املاک ترجمه فارسی کن، یک کلمه هم اضافه تر از جمله نگو هرگونه کد php ازجمله string placeholders, escape sequencesو embedded syntax ها رو در جای خودشون قرار بده، مثلا: %f hello = %f سلام <strong> where $</strong> = <strong> کجا $</strong> """), ], ) translated_text = "" for chunk in client.models.generate_content_stream( model=model, contents=contents, config=generate_content_config, ): if "error" in chunk.text.lower() or "google.genai" in chunk.text.lower(): print(f"API ERROR at ('{USER_INPUT1}', 'houzez'): \n{chunk.text}") return USER_INPUT1 translated_text += chunk.text # Update request counters with lock: current_requests_minute += 1 current_requests_day += 1 return translated_text except Exception as e: print(f"API ERROR at ('{USER_INPUT1}', 'houzez'): \n{chunk.text}") print(e) return USER_INPUT1 def detect_encoding(file_path): """Detect encoding before opening the file.""" with open(file_path, "rb") as f: raw_data = f.read() encoding = chardet.detect(raw_data)["encoding"] return encoding if encoding else "utf-8" # Default fallback skipped= "فایل های رد شده:" def process_file(file_path): """Read and update file content using detected encoding.""" print(file_path, end="") encoding = detect_encoding(file_path) # Detect file encoding try: with open(file_path, "r", encoding=encoding, errors="replace") as file: content = file.read() except UnicodeDecodeError: skipped += f"\n {file_path} ." with open("skipped.log", "a") as log: log.write(file_path + "\n") return # Find all matches matches = pattern.findall(content) # Translate each match and replace in content for match2 in matches: try: one, match, three, four = match2 translated = translate_text(match) translated = translated.replace("\n", "") content = content.replace(f"{one}{match}{one}, {three}{four}{three}", f"{one}{translated}{one}, {three}{four}{three}") except Exception as e: with open(file_path, "w", encoding="utf-8") as file: file.write(content) print(f"{translated} \n {e} \n") return 1 # Write back the updated content with open(file_path, "w", encoding="utf-8") as file: file.write(content) print(" DONE.") def process_folder(folder): """Recursively process all files in the folder.""" for root, _, files in os.walk(folder): for file in files: if file.endswith(".php"): # Ensure only PHP files are processed file_path = os.path.join(root, file) process_file(file_path) if name == "main": process_folder(folder_path) print(f"Translation completed successfully! \n\n {skipped}")
Hello. I have project setup on Laravel 12 using the Livewire starter kit and I am having trouble getting authentication to work under the tenant domain, using stancl/tenancy. I would like the user to register and create their tenant on the central domain ( which is working) and then login on their tenant domain. When I try to do so, I keep getting the error that the page has expired. I have followed the docs to get Livewire 3 working ( and it appears to be). I am sort of at a loss as to what I have wrong. My tenant and auth routes are below, but I am not sure what else to share that might point to the problem:
tenant.php
Route::middleware([
'web',
InitializeTenancyByDomain::class,
PreventAccessFromCentralDomains::class,
])->group(function () {
Route::get('/user', function () {
$user = Auth::user();
dd($user);
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');
});
Route::get('login', Login::class)->name('login');
#Route::get('register', Register::class)->name('register');
Route::get('forgot-password', ForgotPassword::class)->name('password.request');
Route::get('reset-password/{token}', ResetPassword::class)->name('password.reset');
Route::view('dashboard', 'dashboard')
->middleware(['auth', 'verified'])
->name('dashboard');
Route::middleware(['auth'])->group(function () {
Route::redirect('settings', 'settings/profile');
Route::get('settings/profile', Profile::class)->name('settings.profile');
Route::get('settings/password', Password::class)->name('settings.password');
Route::get('settings/appearance', Appearance::class)->name('settings.appearance');
});
});
Was trying to install laravel and after copying the specified command from the website it produced this error.
Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 29 installs, 0 updates, 0 removals Failed to download doctrine/inflector from dist: The zip extension and unzip/7z commands are both missing, skipping. The php.ini used by your command-line PHP is: C:\xampp\php\php.ini Now trying to download from source
In GitDownloader.php line 82:
git was not found in your PATH, skipping source download
I wish to establish a hierarchical structure in an .ini file to organize information on golf courses. This would be read into an array by php and accessed from there.
Is what I'm trying to do possible, or is it beyond the capabilities of PHP? I'd really rather not get into a database for this.
For the golfers reading this, I'm creating a script that will take my handicap index and tee choice and show my handicap strokes for each hole, along with other info like pace of play, yardage, etc. This would give me a game chart that I'd have up on my phone throughout my round showing me the relevant info for each hole on the course.
Below is the general idea of what I'm trying to do. There will be some base information for the webapp, then information on each golf course (only dealing with one course for the moment but I want it to be scaleable in case I decide to add others.)
(Lots of info on php.ini to be found, not so much for using an .ini file otherwise.)
[webapp]
name = golfinfo
revision = 0.0.1
[course]
name = Rainy Day Golf Course
mens handicap = 71
womens handicap = 73
Rating = 70.3
Slope = 123
[tee]
[White]
handicap order men = 5,13,7,1,15,11,9,17,3,12,4,16,8,18,2,10,6,14
Hello there! I would like to ask you something because I've seen many tips and pieces of advice. Is it better to write PHP code above the HTML code? I mean like this:
I think that I'm getting the right answer based on the requirements of the test, but the system keeps telling me that 2 of my test cases return the wrong answer.
Here is my solution to that test. Where am I going wrong??
<?php
/**
* @return boolean The destination is reachable or not
*/
function canTravelTo(array $gameMatrix, int $fromRow, int $fromColumn,
int $toRow, int $toColumn) : bool
{
if (!isset($gameMatrix[$toRow][$toColumn])) {
// out of bounds
return false;
}
$currentRow = $fromRow;
$currentColumn = $fromColumn;
$direction = match (true) {
$toRow < $fromRow => 'Up',
$toRow > $fromRow => 'Down',
$toColumn < $fromColumn => 'Left',
$toColumn > $fromColumn => 'Right',
default => false // move is invalid
};
if (false === $direction) {
return false;
}
while ($currentRow !== $toRow || $currentColumn !== $toColumn) {
match ($direction) {
'Up' => $currentRow--,
'Down' => $currentRow++,
'Left' => $currentColumn--,
'Right' => $currentColumn++
};
$gameValue = $gameMatrix[$currentRow][$currentColumn];
if (!$gameValue) {
// hit land
return false;
}
}
// valid
return true;
}
$gameMatrix = [
[false, true, true, false, false, false],
[true, true, true, false, false, false],
[true, true, true, true, true, true],
[false, true, true, false, true, true],
[false, true, true, true, false, true],
[false, false, false, false, false, false],
];
echo canTravelTo($gameMatrix, 3, 2, 2, 2) ? "true\n" : "false\n"; // true, Valid move
echo canTravelTo($gameMatrix, 3, 2, 3, 4) ? "true\n" : "false\n"; // false, Can't travel through land
echo canTravelTo($gameMatrix, 3, 2, 6, 2) ? "true\n" : "false\n"; // false, Out of bounds
Turns out, the igbinary package is installed but somehow loaded after memcached. But it was installed. Due to a github discussion, it seems important in which order the packages are installed. Therefore, I first uninstalled both and then installed igbinary and memcached in the correct order:
Let me start with the fact I am NOT a PHP person, but because my team initially only had me as their web dev, building our platform fell mostly on my shoulders, and I feel pretty good about myself in navigating PHP the way I have.
However, our site is running into a problem with spam bots, and I want to be able to blacklist the domains they use, and be able to assure that even subdomains cannot be used either.
I cannot get Libsodium installed or to work with PHP 8.3.6 on Linux Mint 22.1.
I tried to install libsodium and even build libsodium from source but I always get this error when I run the test script to see if libsodium is installed and working in PHP.
$ php script.php
PHP Fatal error: Uncaught Error: Call to undefined function Sodium\library_version_major() in /home/john/Desktop/script.php:4
Stack trace:
#0 {main}
thrown in /home/john/Desktop/script.php on line 4
Is there a way to get libsodium installed on Linux Mint 22.1 or to install it inside a docker container and have it working?
How do you include the passphrase in the keys when signing and verifying the data in asymmetric encryption? I was able to get asymmetric encryption to work with and without a passphrase thanks to ayeshrajans in this post!
However the same concepts do not seem to work when working with signatures. I am unable to execute the openssl_sign(MY_TEXT, $signatureBinary, $privateKey, OPENSSL_ALGO_SHA512); function when using a passphrase in the private key.
I was able to the signing and verifying to work with the example below by replacing openssl_pkey_export($publicPrivateKeys, $privateKey, MY_PASSPHRASE); with openssl_pkey_export($publicPrivateKeys, $privateKey); which removes the use of a passphrase.
My website was working yesterday and I have not touched any of the code.
Anyone else having sudden issues with Code Igniter 4?
The log file says:
31-May-2025 13:29:18 America/Chicago] PHP Fatal error: Uncaught Error: Class "" not found in /mnt/stor13-wc2-dfw1/418424/554279/www.........com/web/content/system/Config/BaseService.php:383 Stack trace:
thrown in /mnt/stor13-wc2-dfw1/418424/554279/www......com/web/content/system/Config/BaseService.php on line 383
I didn't change any of the config files since it last worked. Also happened to another website of mine on a different server that has similar code base.
Oddly, the sites render on my mobile phone but not my desktop web browser.
Hello, my xampp is not working properly like it should be. Usually when i start apache and MySql there are no problems. But ever since i havent start the server in a long time, it would not load. MySql is also frequently crashing. Is there any fix. Im desperate to fix this thing since this kinda determine my SPM grade ( hardass final year exam in Malaysia). Hopefully anyone has the solution for this :)
I am creating a Laravel app, that will be consumed by a single user. Nothing too fancy, just an order management with a couple of tables.
I am considering using Hetzner web host for it, not the lowest tier, but the one above as I need cron jobs as well for some stuff.
My only "concern" is, that I am using spatie/laravel-pdf package for dynamically creating invoices, which behind the scenes uses the puppeteer node package.
Would I need to run "npm run build" before uploading it to Hetzner, or how could I make it work? I don't have much experience with hosting, so help/explanation would be appreciated
How do you include the passphrase in decrypting the data in asymmetric encryption? I was able to get asymmetric encryption to work without a passphrase and was able to encrypt the data using asymmetric with a passphrase but cannot figure out how to decrypt the data with the passphrase.
Migré un servidor que tenía 15 años en PHP 5.3.x y Apache 2.2, mysql viejo también.
El tema es que migré muchas bases de datos, las cuales fui actualizando, debido a que ahora utilizamos PHP 7.4.3 (Tuve que migrar GLPI desde una versión MUY antigua hasta la 9.4 por eso lo dejé en PHP 7.4), y fui actualizando muchas sintaxis de PHP:
- Por ejemplo "mysql" pasa a ser "mysqli". - Declarar $conexion o $connection y luego pegarla en los mysqli_query (que piden 2 variables, no una). - Etc etc.
El problema es que llegué a un PHP que me trae formularios que están cargados en una base de datos (En la Consola F12 me trae los datos, pero no me los muestra) En el servidor viejo funciona tal cual está todo configurado, y en el nuevo hice los cambios que estuve haciendo con el resto de PHP (que sí funcionaron), pero justamente con este tengo el problema de que no carga la vista del formulario.
Que sintaxis o que otra cosa se me está pasando actualmente que pueda ser el error ?
En consola me tira "data is not defined", pero data si está correctamente definida.
No me deja cargar el form_sit.php ni form_sit.txt. Si me dan una mano para poder subir el archivo les agradecería.
Help, does anyone know why I'm getting this error? The truth is, I'm a junior. In fact, I'm in high school, and this is a project they assigned me. Does anyone know why I'm getting this error? I asked chatgpt, claude, and gemini, but none of them could help. Here's my code in case anyone can help.
500 Internal Server Error
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require("include/conexion.php");
include("include/menu.php");
$choferSeleccionado = "";
$result = null;
if (!$conexion) {
die("Error de conexión: " . mysqli_connect_error());
}
$choferes = mysqli_query($conexion, "SELECT id, nombre, apeP, apeM FROM chofer");
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['chofer'])) {
$choferSeleccionado = $_POST['chofer'];
if (!is_numeric($choferSeleccionado)) {
die("ID de chofer inválido.");
}
$query = "
SELECT
p.capacidad, p.marca, p.modelo, p.placas,
g.nombre AS gasolinera, g.direccion, g.capacidad AS capacidad_gasolinera, g.precio,
r.id AS ruta_id
FROM ruta r
JOIN pipas p ON r.id_pipa = p.id
JOIN gasolinera g ON r.id_gasolinera = g.id
WHERE r.id_chofer = ?
";
$stmt = mysqli_prepare($conexion, $query);
if ($stmt) {
mysqli_stmt_bind_param($stmt, "i", $choferSeleccionado);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
} else {
die("Error en la consulta: " . mysqli_error($conexion));
}
}
?>
<h2>Tabla 2: Información por Chofer</h2>
<form method="POST">
<label for="chofer">Selecciona un Chofer:</label>
<select name="chofer" id="chofer" required>
<option value="">-- Selecciona --</option>
<?php while($c = mysqli_fetch_assoc($choferes)): ?>
<option value="<?= $c['id'] ?>" <?= $choferSeleccionado == $c['id'] ? 'selected' : '' ?>>
<?= htmlspecialchars("{$c['nombre']} {$c['apeP']} {$c['apeM']}") ?>
</option>
<?php endwhile; ?>
</select>
<button type="submit">Mostrar</button>
</form>
<?php if ($result): ?>
<h3>Datos relacionados:</h3>
<table border="1" cellpadding="5" cellspacing="0">
<thead>
<tr>
<th>Pipa</th>
<th>Gasolinera</th>
<th>Ruta</th>
</tr>
</thead>
<tbody>
<?php while($row = mysqli_fetch_assoc($result)): ?>
<tr>
<td><?= htmlspecialchars("{$row['capacidad']} / {$row['marca']} / {$row['modelo']} / {$row['placas']}") ?></td>
<td><?= htmlspecialchars("{$row['gasolinera']} / {$row['direccion']} / {$row['capacidad_gasolinera']} / \${$row['precio']}") ?></td>
<td><?= htmlspecialchars($row['ruta_id']) ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php elseif ($_SERVER["REQUEST_METHOD"] == "POST"): ?>
<p>No se encontraron datos para el chofer seleccionado.</p>
<?php endif; ?>
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require("include/conexion.php");
include("include/menu.php");
$choferSeleccionado = "";
$result = null;
if (!$conexion) {
die("Error de conexión: " . mysqli_connect_error());
}
$choferes = mysqli_query($conexion, "SELECT id, nombre, apeP, apeM FROM chofer");
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['chofer'])) {
$choferSeleccionado = $_POST['chofer'];
if (!is_numeric($choferSeleccionado)) {
die("ID de chofer inválido.");
}
$query = "
SELECT
p.capacidad, p.marca, p.modelo, p.placas,
g.nombre AS gasolinera, g.direccion, g.capacidad AS capacidad_gasolinera, g.precio,
r.id AS ruta_id
FROM ruta r
JOIN pipas p ON r.id_pipa = p.id
JOIN gasolinera g ON r.id_gasolinera = g.id
WHERE r.id_chofer = ?
";
$stmt = mysqli_prepare($conexion, $query);
if ($stmt) {
mysqli_stmt_bind_param($stmt, "i", $choferSeleccionado);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
} else {
die("Error en la consulta: " . mysqli_error($conexion));
}
}
?>
<h2>Tabla 2: Información por Chofer</h2>
<form method="POST">
<label for="chofer">Selecciona un Chofer:</label>
<select name="chofer" id="chofer" required>
<option value="">-- Selecciona --</option>
<?php while($c = mysqli_fetch_assoc($choferes)): ?>
<option value="<?= $c['id'] ?>" <?= $choferSeleccionado == $c['id'] ? 'selected' : '' ?>>
<?= htmlspecialchars("{$c['nombre']} {$c['apeP']} {$c['apeM']}") ?>
</option>
<?php endwhile; ?>
</select>
<button type="submit">Mostrar</button>
</form>
<?php if ($result): ?>
<h3>Datos relacionados:</h3>
<table border="1" cellpadding="5" cellspacing="0">
<thead>
<tr>
<th>Pipa</th>
<th>Gasolinera</th>
<th>Ruta</th>
</tr>
</thead>
<tbody>
<?php while($row = mysqli_fetch_assoc($result)): ?>
<tr>
<td><?= htmlspecialchars("{$row['capacidad']} / {$row['marca']} / {$row['modelo']} / {$row['placas']}") ?></td>
<td><?= htmlspecialchars("{$row['gasolinera']} / {$row['direccion']} / {$row['capacidad_gasolinera']} / \${$row['precio']}") ?></td>
<td><?= htmlspecialchars($row['ruta_id']) ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php elseif ($_SERVER["REQUEST_METHOD"] == "POST"): ?>
<p>No se encontraron datos para el chofer seleccionado.</p>
<?php endif; ?>
Help, does anyone know why I'm getting this error? The truth is,
I'm a junior. In fact, I'm in high school, and this is a project they
assigned me. Does anyone know why I'm getting this error? I asked
chatgpt, claude, and gemini, but none of them could help. Here's my code
in case anyone can help.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require("include/conexion.php");
include("include/menu.php");
$choferSeleccionado = "";
$result = null;
if (!$conexion) {
die("Error de conexión: " . mysqli_connect_error());
}
$choferes = mysqli_query($conexion, "SELECT id, nombre, apeP, apeM FROM chofer");
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['chofer'])) {
$choferSeleccionado = $_POST['chofer'];
if (!is_numeric($choferSeleccionado)) {
die("ID de chofer inválido.");
}
$query = "
SELECT
p.capacidad, p.marca, p.modelo, p.placas,
g.nombre AS gasolinera, g.direccion, g.capacidad AS capacidad_gasolinera, g.precio,
r.id AS ruta_id
FROM ruta r
JOIN pipas p ON r.id_pipa = p.id
JOIN gasolinera g ON r.id_gasolinera = g.id
WHERE r.id_chofer = ?
";
$stmt = mysqli_prepare($conexion, $query);
if ($stmt) {
mysqli_stmt_bind_param($stmt, "i", $choferSeleccionado);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
} else {
die("Error en la consulta: " . mysqli_error($conexion));
}
}
?>
<h2>Tabla 2: Información por Chofer</h2>
<form method="POST">
<label for="chofer">Selecciona un Chofer:</label>
<select name="chofer" id="chofer" required>
<option value="">-- Selecciona --</option>
<?php while($c = mysqli_fetch_assoc($choferes)): ?>
<option value="<?= $c['id'] ?>" <?= $choferSeleccionado == $c['id'] ? 'selected' : '' ?>>
<?= htmlspecialchars("{$c['nombre']} {$c['apeP']} {$c['apeM']}") ?>
</option>
<?php endwhile; ?>
</select>
<button type="submit">Mostrar</button>
</form>
<?php if ($result): ?>
<h3>Datos relacionados:</h3>
<table border="1" cellpadding="5" cellspacing="0">
<thead>
<tr>
<th>Pipa</th>
<th>Gasolinera</th>
<th>Ruta</th>
</tr>
</thead>
<tbody>
<?php while($row = mysqli_fetch_assoc($result)): ?>
<tr>
<td><?= htmlspecialchars("{$row['capacidad']} / {$row['marca']} / {$row['modelo']} / {$row['placas']}") ?></td>
<td><?= htmlspecialchars("{$row['gasolinera']} / {$row['direccion']} / {$row['capacidad_gasolinera']} / \${$row['precio']}") ?></td>
<td><?= htmlspecialchars($row['ruta_id']) ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php elseif ($_SERVER["REQUEST_METHOD"] == "POST"): ?>
<p>No se encontraron datos para el chofer seleccionado.</p>
<?php endif; ?>
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require("include/conexion.php");
include("include/menu.php");
$choferSeleccionado = "";
$result = null;
if (!$conexion) {
die("Error de conexión: " . mysqli_connect_error());
}
$choferes = mysqli_query($conexion, "SELECT id, nombre, apeP, apeM FROM chofer");
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['chofer'])) {
$choferSeleccionado = $_POST['chofer'];
if (!is_numeric($choferSeleccionado)) {
die("ID de chofer inválido.");
}
$query = "
SELECT
p.capacidad, p.marca, p.modelo, p.placas,
g.nombre AS gasolinera, g.direccion, g.capacidad AS capacidad_gasolinera, g.precio,
r.id AS ruta_id
FROM ruta r
JOIN pipas p ON r.id_pipa = p.id
JOIN gasolinera g ON r.id_gasolinera = g.id
WHERE r.id_chofer = ?
";
$stmt = mysqli_prepare($conexion, $query);
if ($stmt) {
mysqli_stmt_bind_param($stmt, "i", $choferSeleccionado);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
} else {
die("Error en la consulta: " . mysqli_error($conexion));
}
}
?>
<h2>Tabla 2: Información por Chofer</h2>
<form method="POST">
<label for="chofer">Selecciona un Chofer:</label>
<select name="chofer" id="chofer" required>
<option value="">-- Selecciona --</option>
<?php while($c = mysqli_fetch_assoc($choferes)): ?>
<option value="<?= $c['id'] ?>" <?= $choferSeleccionado == $c['id'] ? 'selected' : '' ?>>
<?= htmlspecialchars("{$c['nombre']} {$c['apeP']} {$c['apeM']}") ?>
</option>
<?php endwhile; ?>
</select>
<button type="submit">Mostrar</button>
</form>
<?php if ($result): ?>
<h3>Datos relacionados:</h3>
<table border="1" cellpadding="5" cellspacing="0">
<thead>
<tr>
<th>Pipa</th>
<th>Gasolinera</th>
<th>Ruta</th>
</tr>
</thead>
<tbody>
<?php while($row = mysqli_fetch_assoc($result)): ?>
<tr>
<td><?= htmlspecialchars("{$row['capacidad']} / {$row['marca']} / {$row['modelo']} / {$row['placas']}") ?></td>
<td><?= htmlspecialchars("{$row['gasolinera']} / {$row['direccion']} / {$row['capacidad_gasolinera']} / \${$row['precio']}") ?></td>
<td><?= htmlspecialchars($row['ruta_id']) ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php elseif ($_SERVER["REQUEST_METHOD"] == "POST"): ?>
<p>No se encontraron datos para el chofer seleccionado.</p>
<?php endif; ?>
"The PHP exe file you specified did not run correctly:
C:\xampp\php\php.exe
The php.ini used by your command-line PHP is: C:\xampp\php\php.ini
A duplicate setting in your php.ini could be causing the problem.
Program Output:
PHP Warning: Module "openssl" is already loaded"
I dont, know what to do. I have been re-installing and looking around what to do. Im pretty much new in this world of programming and all and :c I run out of ideas
Fatal error: Uncaught PDOException: could not find driver in /path/index.php:13 Stack trace: #0 /path/index.php(13): PDO->__construct() #1 thrown in /path/index.php on line 13
The pdo_mysql extension is loaded in the php.ini file. There didn't seem to be a separate extenstion just for pdo, so I added that in, and it still didn't do anything. Mariadb is running. Everything is spelled right that I can find. Arch Wiki doesn't say anything about this error that I can find.
I'm building a social media app and I only know pure PHP.
I know there are frameworks out there that make it very easy to implement basic user registration and security features into your website with a few lines of code.
But at this point, I'm wondering just how long will it take to even learn those frameworks? And I'm deciding which will take less time - learning those frameworks or just making the user registration mysel?
It took me about a year just to get the hang of React after knowing only vanilla JS.
Or unless.....is there some way of using a library just for the user registration and security features, and then continuing to use pure php for the rest of the site?
it will show me pdf content at browser. How to download it and get origin filename? I can do it at browser and I see filename "UPOZORNĚNÍ - kaštan- otevřená na 24.5.2025.pdf" but how to do it with PHP?
As the AI/LLM field in PHP continues to grow, I wanted to see what people think of the three main frameworks available for PHP. Here are my thoughts.
Prism -> Good Approach, but no encapsulation. Great for simple projects where code reuse it not really needed, or where you are doing a lot of isolated calls to the LLM (i.e to summarize text), but not conversations. Great framework though!
Neuron AI -> Good tool and a good small community rallying behind it - documentation seriously needs work, and the framework seems primitive with many features not being built out properly yet. Some things are hardcoded in which definitely shouldn't be (i.e vector embedding dimensions????), and it definitely still needs work. But it's a great framework and I hope these issues can be resolved.
Lar Agent -> I haven't used this one yet. It has significantly less community than Neuron AI, and so I think many people are skipping over it. It also doesn't have good vector db support or LLM Provider support - both of these elements are very weak. However, the actual agent framework seems very strong - the documentation is much better developer than Neuron and overall features seem to be built out more than Neuron. I would love to try this one and think it may be a strong contender against Neuron and may be more worthy of attention.