Creating the Singleton design pattern in PHP5

How would one create a Singleton class using PHP5 classes?

json_decode returns NULL after webservice call

There is a strange behaviour with json_encode and json_decode and I can't find a solution: My php application calls a php web service. The webservice returns json that looks like...

How can I get a hex dump of a string in PHP?

I'm investigating encodings in PHP5. Is there some way to get a raw hex dump of a string? i.e. a hex representation of each of the bytes (not characters) in a string?

PHP errors NOT being displayed in the browser [Ubuntu 10.10]

I'm new to PHP and the whole LAMP stack but I've managed to get it up and running on my Ubuntu 10.10 system. Everything seems to be working with the exception of error reposting in the browser...

How do I supply the login to a wordpress site through a url?

I am linking to a protected Wordpress site through my website, and I would like to provide a link that automatically provides login credentials when clicked. I'm running an apache serving with...

php.ini changes, but not effective on Ubuntu

I want change the limit of PHP upload file's size And this is some information of the output my phpinfo: Configuration File (php.ini) Path /etc/php5/apache2 Loaded Configuration File ...

How to install symfony2 app in a subdirectory in nginx

I need to install multiple symfony2 applications on the same host but on different subdirectories (or location blocks). With this config nginx throws a "file not found" or redirect loop message...

Check if xdebug is working

Without installing a texteditor or an IDE, is it possible to test if xdebug is working, i.e. if it can debug php code? The only part xdebug comes up in phpinfo() is the following: Additional .ini...

Prevent nginx 504 Gateway timeout using PHP set_time_limit()

I am getting 504 timeouts message from nginx when my PHP script is running longer than usual. set_time_limit(0) does not seem to prevent that! Does it not work when running php5-fpm on nginx? If...

Find the correct php.ini file

I am currently trying to locate the correct php.ini file to edit it and restart Apache, so the changes will take place and I'm stumped. What I have done... I have found three different php.ini...

upstream sent too big header while reading response header from upstream

I am getting these kind of errors: 2014/05/24 11:49:06 [error] 8376#0: *54031 upstream sent too big header while reading response header from upstream, client: 107.21.193.210, server:...

yii2 installation - migrate command not working

I am trying to install yii2 in ubuntu. yii2 migrate command not working yii migrate I am getting Below error php yii /var/www/event-tracking/migrate PHP Deprecated: Comments starting with '#'...

nginx - phppgadmin - *1 access forbidden by rule

I want to setup phppgadmin, postgresql is already - done by following this article but I have nginx, I did so far these configs: ln -s /usr/share/phppgadmin...

laravel 5.1 not seeing changes to Job file without VM restart

I have created a new Job in a laravel 5.1 app, running in Homestead VM. I've set it to be queued and have code in the handle method. The handle() method previous expected a param to be passed, but...

dpkg error: pycompile: not found

sudo apt-get remove --purge mysql-server mysql-client mysql-common I am getting the following error as I try to remove mysql using the above command: Reading package lists... Done Building...

GD installed or not?

Ubuntu 15.04 php-v PHP 5.6.4-4ubuntu6.2 (cli) (built: Jul 2 2015 15:29:28) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies apt-get install...

Xdebug laravel artisan commands

I regularly use xdebug to debug applications, I've built a laravel application that takes an upload of a csv inserts the data to the database and the ids to a job queue. I've written an artisan...

How do I install the ext-curl extension with PHP 7?

I've installed PHP 7 using this repo, but when I try to run composer install, it's giving this error: [package] requires ext-curl * -> the requested PHP extension curl is missing from your...

Docker and php-cli

I have installed PHP 7 (php-fpm and php-cli) and my app is working fine with new PHP, but tests (phpunit) don't because some extensions aren't updated yet. So I'm thinking to use/create some...

Install node in Dockerfile?

I am user of AWS elastic beanstalk, and I have a little problem. I want to build my CSS files with less+node. But I don`t know how to install node in my dockerfile, when building with...

Using nginx, how to conditionally hide multiple set-cookie response headers coming from backend?

I have an nginx config using fastcgi_pass. I'm sure it would work the same with proxy_pass. For anonymous/guest users, I wish to hide the set-cookie response header set by php's session_start() (I...

PHP modules don't load after installing PHP 7 to my server

I installed PHP 7 to my server (as a result, I have not /etc/php5 and /etc/php/7.0). When I run my web app, I cant see any of my previous CURL (or fork). at first I got this err msg: Message:...

Laravel 5.2: Class Imagick not found

We are converting PDF pages to multiple single images. We found a code snippet in stackoverflow and converted it to a service class. We have Imagick installed and it shows up in phpinfo() as well....

Extension gd is missing from your system - laravel composer Update

I newly install Dompdf in Laravel Project via Composer (composer require barryvdh/laravel-dompdf). After enter the Command Terminal Reply Following Errors. Problem 1 - dompdf/dompdf v0.7.0...

PHP7 installed by Homebrew doesn't work with Apache on macOS

I am trying to upgrade to php7 which I installed via homebrew. In CLI php -v returns PHP 7.0.10 (cli) (built: Aug 21 2016 19:14:33) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine...

php5-mysqlnd not installed on ubuntu

I have already install "mysql". Now, i want to installed or enabled "mysqlnd". for that i used sudo apt-get install php5-mysqlnd But following out put appears on terminal. Reading package...

http to https redirection through htaccess: incorrect redirection error

I need all HTTP requests to redirect to HTTPS: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^some-domain\.com$ [NC] RewriteRule ^(.*)$ https://some-domain.com/$1...

Nginx rewrite rules are not working as expected

I have a website https://dev.mywebsite.com/index.php?album=portraits which displays photo-albums dynamically based on a POST value. I want to rewrite this URL to...

Trying to install the GMP extension on Docker / php:5.3

I'm trying to test some PHP code on PHP 5.3 with the GMP extension installed. Here's my Dockerfile: FROM php:5.3 RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010...

Hacked Wordpress .htaccess

I have a wordpress site that features a .htaccess and a file called postfs.php. But when I try to delete them, they are written again. I tried to delete all the files on the site, change...