In order to prevent email delivery during development and log all email messages that would have been delivered, you can actually do a simple trick: Replace the file /usr/sbin/sendmail (on Ubuntu, use ‘locate sendmail’ to find it if it lies elsewhere) with this little shell-script, or rather make a _bak of the original and save [...]
Posts Tagged ‘php’
Filed under: Linux, Serverstuff, Tools
Social Tagging: development • Linux • php • Serverstuff • Tools
Filed under: Linux, Snippets, Tools
Social Tagging: Linux • php • script • Tools
If you have to deal with very old PHP4 legacy code containing every syntax crime you may know from the early years, how would you handle it? Give it to your junior people to fix it manually? I like to have at least some handy helpers for the first rough corrections. I found sed to [...]
Filed under: Problems, Snippets
Social Tagging: mySQL • php • script
We have just had the case of having ftp access to a site on a shared hosting LAMP webspace but needed also the database and mainly the database scheme to setup our own development-system for the app. This is actually very straight forward using the following snippet uploaded and executed on the webserver: <?php exec( ’mysqldump [...]
Filed under: Snippets, Tools
Social Tagging: commandline • php
I just hacked together the following quick and dirty PHP-script to use the tidy-extension from the command line. Maybe somebody else needs something like this somewhere. Check the comment for details: <?php // // (a) Save this as tidy.php // (b) Call it from commandline like this: $ php tidy.php trashed.html > tidy.html // to [...]
Filed under: Snippets, Tools, Uncategorized
Social Tagging: OSX • php
Here is how you install PEAR on Mac OSX: sudo mkdir /usr/local/temp; sudo chmod -R 777 /usr/local/temp; sudo mkdir /usr/local/share/pear; sudo chmod -R 777 /usr/local/share/pear; curl http://pear.php.net/go-pear | sudo php; Set /usr/local as path prefix and install. You should then be able to use pear, e.g.: pear help. In order to install modules you also [...]
Filed under: Linux, Problems, Serverstuff
Social Tagging: Debian • Linux • php
I was having trouble with a server running Debian 4.0 (etch). Using the standard sources in the /etc/apt/sources.list the supported PHP5 version was 5.2.0-8+etch13 which contained a very annoying bug for my application. A daily running script – let’s call it the Importer – regularly exited randomly with a “Fatal error: Out of memory (allocated [...]
Filed under: Snippets, mySQL
Social Tagging: cli • mySQL • php • script • variables
Case: I was building a CLI script to aggregate data from one MySql database and write results to another MySql database using 2 open db-connections. This way the script’s execution time was in the some-minutes-range… not good! I tried a more effective attempt: I let the CLI script output all necessary statements to drop and [...]
I needed to see some debug output on a production system and used the following hack: error_log(“\n@@@\n” . var_export($this->config, true) . “\n”); To see the output, I set a tail on the error-log-file: tail -f ~/sites/logs/php_error.log
Filed under: Snippets, Tools
Social Tagging: mySQL • php • scripts • Tools
I had a bunch of .dbf (source was Lotus Approach) files, at which I wanted to shoot SQL-like queries to generate some meaningful reports. So there were 2 tasks to be accomplished: Read the data into a tool or database and formulate and perform the queries to generate results to base your reports on. As [...]





RSS