Autor wpisu: stormfly, dodany: 07.04.2014 14:47, tagi: php
Autor wpisu: Jacek Skirzyński, dodany: 31.03.2014 23:38, tagi: php
Ze współdzielonymi hostingami bywa różnie – czasem nie udostępniają php.ini
. Jednak w wielu przypadkach jest inna możliwość – chodzi o pliki .user.ini
. Pozwalają one modyfikować działanie PHP w taki sam sposób jak poprzez php.ini
.
PHP obsługuje tą metodę zmiany konfiguracji od wersji 5.3, a pliki można umieszczać w katalogu projektu (te pliki definiują konfigurację „dla katalogu”). Minusem tego rozwiązania jest ograniczony zakres zmian – tylko poziomy: PHP_INI_USER
i PHP_INI_PERDIR
(więcej).
Gdyby plik nie działał warto sprawdzić czy jego nazwa na danym serwerze nie została zmieniona. Nazwa jest zawarta w dyrektywie user_ini.filename
, której wartość można sprawdzić na przykład poprzez phpinfo()
.
Przydatne linki:
Autor wpisu: Śpiechu, dodany: 29.03.2014 15:57, tagi: php
Today is the last installment about PHP streams. This time we will borrow some images from GitHub octodex using remote streams and stream copying. To add some spice, we’re going to use PHP in parallel processing. If you thought PHP is single process srcripting language, I will ruin your world, sorry ;-)
Of course in real world projects there is always a trade off between time and resources. Forking process is CPU expensive work for server. We’re assuming we have plenty of CPU cycles and RAM, but short on time. Take a look on code below: It took 5 secs to fetch 127 images. The same thing run in single foreach loop takes about 2 minutes…
Autor wpisu: Śpiechu, dodany: 24.03.2014 23:34, tagi: php
Perhaps you used once or twice builtin zlib.* or mcrypt.* stream filters. Have you tried making your own stream filter? Maybe you didn’t need to. There are ways to accomplish business needs without making hands dirty by not well documented stuff like user filters. I need to know that topic like I said before, because of certification :-)
We’re going to make stream filter capable of computing hash checksum from stream contents on the fly. Rich documented code below:
Autor wpisu: zleek, dodany: 24.03.2014 08:20, tagi: css, javascript, php
Autor wpisu: Śpiechu, dodany: 20.03.2014 22:30, tagi: php
This entry is the first part of three parts covering streams in PHP. I’m preparing for ZCE certification and streams are important part to pass the exam.
Now to the point. By using stream contexts we can „hook up” to stream notifications by stream_context_set_params
function. When you want to know what’s happening during stream processing live, the best way is to use stream context notification param. Take a look at the simplest snippet: Notice that even when we didn’t start fetching stream contents yet, a few interesting things happened:
- stream has connected,
- retreived mime type,
- redirect took place (not always),
- retrieved file size (not always),
- notified 0 bytes progress.
Also notice that this method won’t work with local resources (at least on my server doesn’t work), what brings us to second method involving stream reading. This method will always work under 2 conditions:
- you fetched enough bytes (for eg. Adobe PDF full recognition needs about 10 bytes),
- you check mimetype with first pass (it’s obvious) or you end up with octet stream generics.
Stay tuned for second part about custom stream filters.